docs: backfill XML documentation across 756 files
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
Adds <summary>, <param>, <typeparam>, and <inheritdoc/> tags to public members surfaced by commentchecker — resolves 5,847 of 5,869 issues (99.6%) across three /fixdocs passes.
This commit is contained in:
@@ -8,7 +8,9 @@ public sealed class JwtOptions
|
||||
/// <summary>HS256 signing key. Must be at least 32 bytes (256 bits) UTF-8.</summary>
|
||||
public string SigningKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Gets or sets the JWT issuer identifier.</summary>
|
||||
public string Issuer { get; set; } = "otopcua";
|
||||
/// <summary>Gets or sets the JWT audience identifier.</summary>
|
||||
public string Audience { get; set; } = "otopcua";
|
||||
|
||||
/// <summary>Default token expiry. Mirrors ScadaLink (15 min).</summary>
|
||||
|
||||
@@ -16,6 +16,9 @@ public sealed class JwtTokenService
|
||||
private readonly JwtOptions _options;
|
||||
private readonly ILogger<JwtTokenService> _logger;
|
||||
|
||||
/// <summary>Initializes a new instance of the JwtTokenService class.</summary>
|
||||
/// <param name="options">The JWT options.</param>
|
||||
/// <param name="logger">The logger for the service.</param>
|
||||
public JwtTokenService(IOptions<JwtOptions> options, ILogger<JwtTokenService> logger)
|
||||
{
|
||||
_options = options.Value;
|
||||
@@ -32,6 +35,11 @@ public sealed class JwtTokenService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Issues a JWT token for the specified user with the given roles.</summary>
|
||||
/// <param name="displayName">The display name of the user.</param>
|
||||
/// <param name="username">The username of the user.</param>
|
||||
/// <param name="roles">The roles assigned to the user.</param>
|
||||
/// <returns>The JWT token string.</returns>
|
||||
public string Issue(string displayName, string username, IReadOnlyList<string> roles)
|
||||
{
|
||||
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_options.SigningKey));
|
||||
@@ -55,6 +63,10 @@ public sealed class JwtTokenService
|
||||
return new JwtSecurityTokenHandler().WriteToken(token);
|
||||
}
|
||||
|
||||
/// <summary>Attempts to validate a JWT token and extract the claims principal.</summary>
|
||||
/// <param name="token">The JWT token to validate.</param>
|
||||
/// <param name="principal">The claims principal extracted from the token, or null if validation failed.</param>
|
||||
/// <returns>True if the token is valid; otherwise false.</returns>
|
||||
public bool TryValidate(string token, out ClaimsPrincipal? principal)
|
||||
{
|
||||
principal = null;
|
||||
|
||||
Reference in New Issue
Block a user