diff --git a/src/PDNDClientAssertionGenerator/Services/ClientAssertionGeneratorService.cs b/src/PDNDClientAssertionGenerator/Services/ClientAssertionGeneratorService.cs index 2782e83..0b921b1 100644 --- a/src/PDNDClientAssertionGenerator/Services/ClientAssertionGeneratorService.cs +++ b/src/PDNDClientAssertionGenerator/Services/ClientAssertionGeneratorService.cs @@ -5,27 +5,38 @@ namespace PDNDClientAssertionGenerator.Services { - // This service handles the generation of client assertions and the retrieval of access tokens. + /// + /// This service handles the generation of client assertions and the retrieval of access tokens. + /// public class ClientAssertionGeneratorService : IClientAssertionGenerator { // Dependency on the OAuth2 service for generating client assertions and requesting tokens. private readonly IOAuth2Service _oauth2Service; - // Constructor that injects the IOAuth2Service dependency. - // Throws an ArgumentNullException if the provided OAuth2 service is null. + /// + /// Initializes a new instance of the class. + /// + /// An instance of used for generating client assertions and requesting tokens. + /// Thrown when is null. public ClientAssertionGeneratorService(IOAuth2Service oauth2Service) { _oauth2Service = oauth2Service ?? throw new ArgumentNullException(nameof(oauth2Service)); } - // Asynchronously generates a client assertion (JWT) by delegating to the OAuth2 service. + /// + /// Asynchronously generates a client assertion (JWT) by delegating to the OAuth2 service. + /// + /// A task that represents the asynchronous operation, containing the generated client assertion as a string. public async Task GetClientAssertionAsync() { return await _oauth2Service.GenerateClientAssertionAsync(); } - // Asynchronously requests an OAuth2 access token using the provided client assertion. - // Delegates the actual token request to the OAuth2 service. + /// + /// Asynchronously requests an OAuth2 access token using the provided client assertion. + /// + /// The client assertion (JWT) used for the token request. + /// A task that represents the asynchronous operation, containing the response with the access token as a . public async Task GetTokenAsync(string clientAssertion) { return await _oauth2Service.RequestAccessTokenAsync(clientAssertion); diff --git a/src/PDNDClientAssertionGenerator/Services/OAuth2Service.cs b/src/PDNDClientAssertionGenerator/Services/OAuth2Service.cs index 03137b3..755cc96 100644 --- a/src/PDNDClientAssertionGenerator/Services/OAuth2Service.cs +++ b/src/PDNDClientAssertionGenerator/Services/OAuth2Service.cs @@ -13,17 +13,27 @@ namespace PDNDClientAssertionGenerator.Services { + /// + /// Service for handling OAuth2 client assertion generation and token requests. + /// public class OAuth2Service : IOAuth2Service { private readonly ClientAssertionConfig _config; - // Constructor for OAuth2Service, takes a configuration object. + /// + /// Initializes a new instance of the class. + /// + /// An object containing the configuration for client assertion generation. + /// Thrown when is null. public OAuth2Service(IOptions config) { _config = config.Value ?? throw new ArgumentNullException(nameof(config)); } - // Asynchronously generates a client assertion JWT token. + /// + /// Asynchronously generates a client assertion (JWT) token. + /// + /// A task that represents the asynchronous operation, containing the generated client assertion as a string. public async Task GenerateClientAssertionAsync() { // Generate a unique token ID (JWT ID) @@ -83,7 +93,11 @@ public async Task GenerateClientAssertionAsync() return await Task.FromResult(clientAssertion); // Return the generated token as a string. } - // Asynchronously requests an access token by sending the client assertion to the OAuth2 server. + /// + /// Asynchronously requests an access token by sending the client assertion to the OAuth2 server. + /// + /// The client assertion (JWT) used for the token request. + /// A task that represents the asynchronous operation, containing the response with the access token as a . public async Task RequestAccessTokenAsync(string clientAssertion) { using var httpClient = new HttpClient();