diff --git a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs index 282458f7..32028c4d 100644 --- a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs +++ b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs @@ -175,31 +175,31 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder /// /// Sets the redirection URI, if applicable. /// - /// The redirection URI. + /// The redirection URI. /// The instance. - public {{ provider.name }} SetRedirectUri(Uri address) + public {{ provider.name }} SetRedirectUri(Uri uri) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - return Configure(options => options.RedirectUri = address); + return Configure(options => options.RedirectUri = uri); } /// /// Sets the redirection URI, if applicable. /// - /// The redirection URI. + /// The redirection URI. /// The instance. - public {{ provider.name }} SetRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string address) + public {{ provider.name }} SetRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string uri) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } - return SetRedirectUri(new Uri(address, UriKind.RelativeOrAbsolute)); + return SetRedirectUri(new Uri(uri, UriKind.RelativeOrAbsolute)); } /// @@ -813,7 +813,7 @@ public sealed partial class OpenIddictClientWebIntegrationOptions public string? ClientSecret { get; set; } /// - /// Gets or sets the redirection URL. + /// Gets or sets the redirect URI. /// public Uri? RedirectUri { get; set; } diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs b/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs index 10f72d17..430cfde5 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs @@ -216,7 +216,7 @@ namespace OpenIddict.Sandbox.AspNet.Client.Controllers var properties = new AuthenticationProperties(result.Properties.Dictionary .Where(item => item switch { - // Preserve the redirect URL. + // Preserve the return URL. { Key: ".redirect" } => true, // If needed, the tokens returned by the authorization server can be stored in the authentication cookie. diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs index 481eece4..aef2e3e3 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Client/Startup.cs @@ -69,7 +69,7 @@ namespace OpenIddict.Sandbox.AspNet.Client // Enable the redirection endpoint needed to handle the callback stage. // // Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - // address per provider, unless all the registered providers support returning an "iss" + // URI per provider, unless all the registered providers support returning a special "iss" // parameter containing their URL as part of authorization responses. For more information, // see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. options.SetRedirectionEndpointUris( diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthenticationController.cs b/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthenticationController.cs index 8800406b..aeedf784 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthenticationController.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthenticationController.cs @@ -109,7 +109,7 @@ namespace OpenIddict.Sandbox.AspNet.Server.Controllers var properties = new AuthenticationProperties(result.Properties.Dictionary .Where(item => item switch { - // Preserve the redirect URL. + // Preserve the return URL. { Key: ".redirect" } => true, // If needed, the tokens returned by the authorization server can be stored in the authentication cookie. diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs index e555ed36..f791627f 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs @@ -154,7 +154,7 @@ namespace OpenIddict.Sandbox.AspNet.Server // Enable the redirection endpoint needed to handle the callback stage. // // Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - // address per provider, unless all the registered providers support returning an "iss" + // URI per provider, unless all the registered providers support returning a special "iss" // parameter containing their URL as part of authorization responses. For more information, // see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. options.SetRedirectionEndpointUris("callback/login/github"); diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs index f981ddb7..408aa5ac 100644 --- a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs @@ -77,7 +77,7 @@ public class Startup // Enable the redirection endpoint needed to handle the callback stage. // // Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - // address per provider, unless all the registered providers support returning an "iss" + // URI per provider, unless all the registered providers support returning a special "iss" // parameter containing their URL as part of authorization responses. For more information, // see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. options.SetRedirectionEndpointUris( diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs index 5e7949de..77a750bf 100644 --- a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs @@ -71,7 +71,7 @@ public class Startup // Enable the redirection endpoint needed to handle the callback stage. // // Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - // address per provider, unless all the registered providers support returning an "iss" + // URI per provider, unless all the registered providers support returning a special "iss" // parameter containing their URL as part of authorization responses. For more information, // see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. options.SetRedirectionEndpointUris("callback/login/github"); diff --git a/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs b/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs index d5b39a6e..4f0118ed 100644 --- a/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs +++ b/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs @@ -172,18 +172,18 @@ internal static class OpenIddictHelpers /// /// Adds a query string parameter to the specified . /// - /// The address, to which the query string parameter will be appended. + /// The URI to which the query string parameter will be appended. /// The name of the query string parameter to append. /// The value of the query string parameter to append. /// The final instance, with the specified parameter appended. - public static Uri AddQueryStringParameter(Uri address, string name, string? value) + public static Uri AddQueryStringParameter(Uri uri, string name, string? value) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - var builder = new StringBuilder(address.Query); + var builder = new StringBuilder(uri.Query); if (builder.Length > 0) { builder.Append('&'); @@ -197,22 +197,22 @@ internal static class OpenIddictHelpers builder.Append(Uri.EscapeDataString(value)); } - return new UriBuilder(address) { Query = builder.ToString() }.Uri; + return new UriBuilder(uri) { Query = builder.ToString() }.Uri; } /// /// Adds query string parameters to the specified . /// - /// The address, to which the query string parameters will be appended. + /// The URI to which the query string parameters will be appended. /// The query string parameters to append. /// The final instance, with the specified parameters appended. - /// is . + /// is . /// is . - public static Uri AddQueryStringParameters(Uri address, IReadOnlyDictionary parameters) + public static Uri AddQueryStringParameters(Uri uri, IReadOnlyDictionary parameters) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } if (parameters is null) @@ -222,10 +222,10 @@ internal static class OpenIddictHelpers if (parameters.Count is 0) { - return address; + return uri; } - var builder = new StringBuilder(address.Query); + var builder = new StringBuilder(uri.Query); foreach (var parameter in parameters) { @@ -263,7 +263,7 @@ internal static class OpenIddictHelpers } } - return new UriBuilder(address) { Query = builder.ToString() }.Uri; + return new UriBuilder(uri) { Query = builder.ToString() }.Uri; } /// diff --git a/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs b/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs index 2f336326..ba6a8db1 100644 --- a/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs +++ b/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs @@ -45,22 +45,22 @@ public interface IOpenIddictApplicationCache where TApplication : ValueTask FindByIdAsync(string identifier, CancellationToken cancellationToken); /// - /// Retrieves all the applications associated with the specified redirect_uri. + /// Retrieves all the applications associated with the specified post_logout_redirect_uri. /// - /// The redirect_uri associated with the applications. + /// The post_logout_redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified redirect_uri. IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken); /// /// Retrieves all the applications associated with the specified redirect_uri. /// - /// The redirect_uri associated with the applications. + /// The redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified redirect_uri. IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken); /// /// Removes the specified application from the cache. diff --git a/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs b/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs index 46ba81e8..0399d0f0 100644 --- a/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs +++ b/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs @@ -41,7 +41,7 @@ public class OpenIddictApplicationDescriptor public HashSet Permissions { get; } = new(StringComparer.Ordinal); /// - /// Gets the logout callback URLs associated with the application. + /// Gets the post-logout redirect URIs associated with the application. /// public HashSet PostLogoutRedirectUris { get; } = new(); @@ -51,7 +51,7 @@ public class OpenIddictApplicationDescriptor public Dictionary Properties { get; } = new(StringComparer.Ordinal); /// - /// Gets the callback URLs associated with the application. + /// Gets the redirect URIs associated with the application. /// public HashSet RedirectUris { get; } = new(); diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs index 37293c92..6e184cff 100644 --- a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs +++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs @@ -115,20 +115,20 @@ public interface IOpenIddictApplicationManager /// /// Retrieves all the applications associated with the specified post_logout_redirect_uri. /// - /// The post_logout_redirect_uri associated with the applications. + /// The post_logout_redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified post_logout_redirect_uri. IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default); /// /// Retrieves all the applications associated with the specified redirect_uri. /// - /// The redirect_uri associated with the applications. + /// The redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified redirect_uri. IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default); /// /// Executes the specified query and returns the first element. @@ -264,7 +264,7 @@ public interface IOpenIddictApplicationManager ValueTask> GetPermissionsAsync(object application, CancellationToken cancellationToken = default); /// - /// Retrieves the logout callback addresses associated with an application. + /// Retrieves the post-logout redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -286,7 +286,7 @@ public interface IOpenIddictApplicationManager ValueTask> GetPropertiesAsync(object application, CancellationToken cancellationToken = default); /// - /// Retrieves the callback addresses associated with an application. + /// Retrieves the redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -457,7 +457,7 @@ public interface IOpenIddictApplicationManager /// Validates the post_logout_redirect_uri to ensure it's associated with an application. /// /// The application. - /// The address that should be compared to one of the post_logout_redirect_uri stored in the database. + /// The URI that should be compared to one of the post_logout_redirect_uri stored in the database. /// The that can be used to abort the operation. /// Note: if no client_id parameter is specified in logout requests, this method may not be called. /// @@ -465,18 +465,18 @@ public interface IOpenIddictApplicationManager /// whose result returns a boolean indicating whether the post_logout_redirect_uri was valid. /// ValueTask ValidatePostLogoutRedirectUriAsync(object application, - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default); /// /// Validates the redirect_uri to ensure it's associated with an application. /// /// The application. - /// The address that should be compared to one of the redirect_uri stored in the database. + /// The URI that should be compared to one of the redirect_uri stored in the database. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns a boolean indicating whether the redirect_uri was valid. /// ValueTask ValidateRedirectUriAsync(object application, - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default); } diff --git a/src/OpenIddict.Abstractions/OpenIddictResources.resx b/src/OpenIddict.Abstractions/OpenIddictResources.resx index 2f1ef58f..13050f5d 100644 --- a/src/OpenIddict.Abstractions/OpenIddictResources.resx +++ b/src/OpenIddict.Abstractions/OpenIddictResources.resx @@ -193,7 +193,7 @@ Alternatively, you can disable the built-in database-based server features by en A token cannot be created from a null principal. - The issuer must be a non-null, non-empty absolute URL. + The issuer must be a non-null, non-empty absolute URI. A sign-out response cannot be returned from this endpoint. @@ -367,7 +367,7 @@ Consider using 'options.AddSigningCredentials(SigningCredentials)' instead.The grant type cannot be null or empty. - Endpoint addresses must be valid URLs. + Endpoint URIs must be valid URIs. Claims cannot be null or empty. @@ -394,7 +394,7 @@ Consider using 'options.AddSigningCredentials(SigningCredentials)' instead.The verification endpoint must be enabled to use the device flow. - Endpoint addresses cannot start with '{0}'. + Endpoint URIs cannot start with '{0}'. Dependency injection support must be enabled in Quartz.NET when using the OpenIddict integration. @@ -550,7 +550,7 @@ To register the server services, use 'services.AddOpenIddict().AddServer()'.The base URI or request URI cannot be retrieved from the request context or are now valid absolute URIs. - An OAuth 2.0/OpenID Connect server configuration or an issuer address must be registered. + An OAuth 2.0/OpenID Connect server configuration or an issuer URI must be registered. To use a local OpenIddict server, reference the 'OpenIddict.Validation.ServerIntegration' package and call 'services.AddOpenIddict().AddValidation().UseLocalServer()' to import the server settings. To use a remote server, reference the 'OpenIddict.Validation.SystemNetHttp' package and call 'services.AddOpenIddict().AddValidation().UseSystemNetHttp()' and 'services.AddOpenIddict().AddValidation().SetIssuer()' to use server discovery. Alternatively, you can register a static server configuration by calling 'services.AddOpenIddict().AddValidation().SetConfiguration()'. @@ -560,7 +560,7 @@ Alternatively, you can register a static server configuration by calling 'servic Reference the 'OpenIddict.Validation.SystemNetHttp' package and call 'services.AddOpenIddict().AddValidation().UseSystemNetHttp()' to register the default System.Net.Http-based integration. - The issuer or the metadata address must be set when using introspection. + The issuer or the configuration endpoint URI must be set when using introspection. The client identifier cannot be null or empty when using introspection. @@ -579,10 +579,10 @@ Reference the 'OpenIddict.Validation.SystemNetHttp' package and call 'services.A Reference the 'OpenIddict.Validation.SystemNetHttp' package and call 'services.AddOpenIddict().AddValidation().UseSystemNetHttp()' to register the default System.Net.Http-based integration. - The authority must be provided and must be an absolute URL. + The issuer must be provided and must be an absolute URI. - The authority cannot contain a fragment or a query string. + The issuer cannot contain a fragment or a query string. The event handler of type '{0}' couldn't be resolved. @@ -603,10 +603,10 @@ To register the OpenIddict core services, reference the 'OpenIddict.Core' packag To register the OpenIddict core services, reference the 'OpenIddict.Core' package and call 'services.AddOpenIddict().AddCore()' from 'ConfigureServices'. - The address cannot be null or empty. + The URI cannot be null or empty. - The address must be a valid absolute URI. + The URI must be a valid absolute URI. The server configuration couldn't be retrieved. @@ -857,10 +857,10 @@ To register the validation services, use 'services.AddOpenIddict().AddValidation The requirement name cannot be null or empty. - Callback URLs cannot be null or empty. + Callback URIs cannot be null or empty. - Callback URLs must be valid absolute URLs. + Callback URIs must be valid absolute URIs. One or more validation error(s) occurred while trying to update an existing application: @@ -1111,7 +1111,7 @@ To register the OpenIddict core services, reference the 'OpenIddict.Core' packag The context type associated with the specified descriptor doesn't match the context type of this builder. - Endpoint addresses must be unique across endpoints. + Endpoint URIs must be unique across endpoints. The specified principal doesn't contain a valid claims-based identity. @@ -1180,7 +1180,7 @@ To apply redirection responses, create a class implementing 'IOpenIddictClientHa No issuer was specified in the challenge properties. When multiple clients are registered, an issuer (or a provider name) must be specified in the challenge properties. - The specified issuer is not a valid or absolute URL. + The specified issuer is not a valid or absolute URI. The issuer extracted from the server configuration metadata doesn't match the expected value. @@ -1484,7 +1484,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A The mandatory '{0}' parameter is missing. - The '{0}' parameter must be a valid absolute URL. + The '{0}' parameter must be a valid absolute URI. The '{0}' parameter must not include a fragment. @@ -1577,10 +1577,10 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A A scope with the same name already exists. - Callback URLs cannot be null or empty. + Callback URIs cannot be null or empty. - Callback URLs must be valid absolute URLs. + Callback URIs must be valid absolute URIs. This client application is not allowed to use the token endpoint. @@ -1610,7 +1610,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A The specified refresh token cannot be used by this client application. - The specified '{0}' parameter doesn't match the client redirection address the authorization code was initially sent to. + The specified '{0}' parameter doesn't match the client redirection URI the authorization code was initially sent to. The '{0}' parameter cannot be used when no '{1}' was specified in the authorization request. @@ -1694,7 +1694,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A No JWKS endpoint could be found in the server configuration. - A server configuration containing an invalid '{0}' URL was returned. + A server configuration containing an invalid '{0}' URI was returned. The JWKS document didn't contain a valid '{0}' node with at least one key. @@ -1736,7 +1736,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A A client secret cannot be associated with a public application. - Callback URLs cannot contain a fragment. + Callback URIs cannot contain a fragment. The authorization type cannot be null or empty. @@ -1793,7 +1793,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A The '{0}' claim returned in the specified userinfo response/token doesn't match the expected value. - Callback URLs cannot contain an "{0}" parameter. + Callback URIs cannot contain an "{0}" parameter. The '{0}' parameter must not include a '{1}' component. @@ -1805,7 +1805,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A An invalid JSON response was returned by the remote HTTP server. - The current address doesn't match the address of the redirection endpoint selected during the initial authorization request. + The current URI doesn't match the URI of the redirection endpoint selected during the initial authorization request. The specified state token has already been redeemed. @@ -1925,7 +1925,7 @@ Consider registering a certificate using 'services.AddOpenIddict().AddClient().A EC-based keys should have a non-null OID raw value or friendly name. - The issuer should be a valid absolute URL at this point. + The issuer should be a valid absolute URI at this point. The username shouldn't be null or empty at this point. @@ -1998,10 +1998,10 @@ The principal used to create the token contained the following claims: {Claims}. The authorization request was rejected because the mandatory '{Parameter}' parameter was missing. - The authorization request was rejected because the '{Parameter}' parameter wasn't a valid absolute URL: {RedirectUri}. + The authorization request was rejected because the '{Parameter}' parameter wasn't a valid absolute URI: {RedirectUri}. - The authorization request was rejected because the '{Parameter}' contained a URL fragment: {RedirectUri}. + The authorization request was rejected because the '{Parameter}' contained a URI fragment: {RedirectUri}. The authorization request was rejected because the '{ResponseType}' response type is not supported. @@ -2055,7 +2055,7 @@ The principal used to create the token contained the following claims: {Claims}. The authorization request was rejected because the application '{ClientId}' was not allowed to use the '{Scope}' scope. - The request address matched a server endpoint: {Endpoint}. + The request URI matched a server endpoint: {Endpoint}. The device request was successfully extracted: {Request}. @@ -2274,10 +2274,10 @@ The principal used to create the token contained the following claims: {Claims}. The logout request was successfully validated. - The logout request was rejected because the '{Parameter}' parameter wasn't a valid absolute URL: {PostLogoutRedirectUri}. + The logout request was rejected because the '{Parameter}' parameter wasn't a valid absolute URI: {PostLogoutRedirectUri}. - The logout request was rejected because the '{Parameter}' contained a URL fragment: {PostLogoutRedirectUri}. + The logout request was rejected because the '{Parameter}' contained a URI fragment: {PostLogoutRedirectUri}. The logout request was rejected because the specified post_logout_redirect_uri was invalid: {PostLogoutRedirectUri}. @@ -2455,34 +2455,34 @@ This may indicate that the hashed entry is corrupted or malformed. An unsupported {StatusCode} response was returned by the remote HTTP server: {ContentType} {Payload}. - The configuration request was successfully sent to {Address}: {Request}. + The configuration request was successfully sent to {Uri}: {Request}. - The configuration response returned by {Address} was successfully extracted: {Response}. + The configuration response returned by {Uri} was successfully extracted: {Response}. - The cryptography request was successfully sent to {Address}: {Request}. + The cryptography request was successfully sent to {Uri}: {Request}. - The cryptography response returned by {Address} was successfully extracted: {Response}. + The cryptography response returned by {Uri} was successfully extracted: {Response}. - The introspection request was successfully sent to {Address}: {Request}. + The introspection request was successfully sent to {Uri}: {Request}. - The introspection response returned by {Address} was successfully extracted: {Response}. + The introspection response returned by {Uri} was successfully extracted: {Response}. - The token request was successfully sent to {Address}: {Request}. + The token request was successfully sent to {Uri}: {Request}. - The token response returned by {Address} was successfully extracted: {Response}. + The token response returned by {Uri} was successfully extracted: {Response}. - The userinfo request was successfully sent to {Address}: {Request}. + The userinfo request was successfully sent to {Uri}: {Request}. - The userinfo response returned by {Address} was successfully extracted: {Response}. + The userinfo response returned by {Uri} was successfully extracted: {Response}. The logout request was rejected because the client application was not found: '{ClientId}'. diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs index 27213d07..df6aa479 100644 --- a/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs +++ b/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs @@ -17,7 +17,7 @@ namespace OpenIddict.Abstractions; public sealed class OpenIddictConfiguration { /// - /// Gets or sets the address of the authorization endpoint. + /// Gets or sets the URI of the authorization endpoint. /// public Uri? AuthorizationEndpoint { get; set; } @@ -32,7 +32,7 @@ public sealed class OpenIddictConfiguration public HashSet CodeChallengeMethodsSupported { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the end session endpoint. + /// Gets or sets the URI of the end session endpoint. /// public Uri? EndSessionEndpoint { get; set; } @@ -42,7 +42,7 @@ public sealed class OpenIddictConfiguration public HashSet GrantTypesSupported { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the introspection endpoint. + /// Gets or sets the URI of the introspection endpoint. /// public Uri? IntrospectionEndpoint { get; set; } @@ -52,7 +52,7 @@ public sealed class OpenIddictConfiguration public HashSet IntrospectionEndpointAuthMethodsSupported { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the issuer. + /// Gets or sets the URI of the issuer. /// public Uri? Issuer { get; set; } @@ -62,7 +62,7 @@ public sealed class OpenIddictConfiguration public JsonWebKeySet? JsonWebKeySet { get; set; } /// - /// Gets or sets the address of the JWKS endpoint. + /// Gets or sets the URI of the JWKS endpoint. /// public Uri? JwksUri { get; set; } @@ -92,7 +92,7 @@ public sealed class OpenIddictConfiguration public List SigningKeys { get; } = new(); /// - /// Gets or sets the address of the token endpoint. + /// Gets or sets the URI of the token endpoint. /// public Uri? TokenEndpoint { get; set; } @@ -102,7 +102,7 @@ public sealed class OpenIddictConfiguration public HashSet TokenEndpointAuthMethodsSupported { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the userinfo endpoint. + /// Gets or sets the URI of the userinfo endpoint. /// public Uri? UserinfoEndpoint { get; set; } } diff --git a/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs index 88193083..a146329f 100644 --- a/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs +++ b/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs @@ -80,20 +80,20 @@ public interface IOpenIddictApplicationStore where TApplication : /// /// Retrieves all the applications associated with the specified post_logout_redirect_uri. /// - /// The post_logout_redirect_uri associated with the applications. + /// The post_logout_redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified post_logout_redirect_uri. IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken); /// /// Retrieves all the applications associated with the specified redirect_uri. /// - /// The redirect_uri associated with the applications. + /// The redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified redirect_uri. IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken); + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken); /// /// Executes the specified query and returns the first element. @@ -202,7 +202,7 @@ public interface IOpenIddictApplicationStore where TApplication : ValueTask> GetPermissionsAsync(TApplication application, CancellationToken cancellationToken); /// - /// Retrieves the logout callback addresses associated with an application. + /// Retrieves the post-logout redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -224,7 +224,7 @@ public interface IOpenIddictApplicationStore where TApplication : ValueTask> GetPropertiesAsync(TApplication application, CancellationToken cancellationToken); /// - /// Retrieves the callback addresses associated with an application. + /// Retrieves the redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -344,14 +344,13 @@ public interface IOpenIddictApplicationStore where TApplication : ValueTask SetPermissionsAsync(TApplication application, ImmutableArray permissions, CancellationToken cancellationToken); /// - /// Sets the logout callback addresses associated with an application. + /// Sets the post-logout redirect URIs associated with an application. /// /// The application. - /// The logout callback addresses associated with the application + /// The post-logout redirect URIs associated with the application. /// The that can be used to abort the operation. /// A that can be used to monitor the asynchronous operation. - ValueTask SetPostLogoutRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken); + ValueTask SetPostLogoutRedirectUrisAsync(TApplication application, ImmutableArray uris, CancellationToken cancellationToken); /// /// Sets the additional properties associated with an application. @@ -364,14 +363,13 @@ public interface IOpenIddictApplicationStore where TApplication : ImmutableDictionary properties, CancellationToken cancellationToken); /// - /// Sets the callback addresses associated with an application. + /// Sets the redirect URIs associated with an application. /// /// The application. - /// The callback addresses associated with the application + /// The redirect URIs associated with the application. /// The that can be used to abort the operation. /// A that can be used to monitor the asynchronous operation. - ValueTask SetRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken); + ValueTask SetRedirectUrisAsync(TApplication application, ImmutableArray uris, CancellationToken cancellationToken); /// /// Sets the requirements associated with an application. diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs index 03b6201f..f6f365c7 100644 --- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs +++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs @@ -172,8 +172,8 @@ public sealed class OpenIddictClientAspNetCoreHandler : AuthenticationHandler? tokens = null; diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs index b39f3935..e1f80e69 100644 --- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs +++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs @@ -95,7 +95,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers // sent by the HTTP client) is not desirable as it would affect all requests, including requests // that are not meant to be handled by OpenIddict itself. To avoid that, a fake host is temporarily // used to build an absolute base URI and a request URI that will be used to determine whether the - // received request matches one of the addresses assigned to an OpenIddict endpoint. If the request + // received request matches one of the URIs assigned to an OpenIddict endpoint. If the request // is later handled by OpenIddict, an additional check will be made to require the Host header. (context.BaseUri, context.RequestUri) = request.Host switch @@ -464,7 +464,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers context.ProviderName = provider; } - // If a return URL was specified, use it as the target_link_uri claim. + // If a target link URI was specified, attach it to the context. if (!string.IsNullOrEmpty(properties.RedirectUri)) { context.TargetLinkUri = properties.RedirectUri; @@ -697,7 +697,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers context.ProviderName = provider; } - // If a return URL was specified, use it as the target_link_uri claim. + // If a target link URI was specified, attach it to the context. if (!string.IsNullOrEmpty(properties.RedirectUri)) { context.TargetLinkUri = properties.RedirectUri; diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs index 07449630..1931ce90 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs @@ -187,8 +187,8 @@ public sealed class OpenIddictClientOwinHandler : AuthenticationHandler descriptor.ServiceDescriptor)); // Register the built-in filters used by the default OpenIddict System.Net.Http event handlers. - builder.Services.TryAddSingleton(); + builder.Services.TryAddSingleton(); // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. builder.Services.TryAddEnumerable(new[] diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs index 08a9c826..43028296 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs @@ -12,9 +12,9 @@ namespace OpenIddict.Client.SystemNetHttp; public static class OpenIddictClientSystemNetHttpHandlerFilters { /// - /// Represents a filter that excludes the associated handlers if the metadata address of the issuer is not available. + /// Represents a filter that excludes the associated handlers if the metadata URI of the issuer is not available. /// - public sealed class RequireHttpMetadataAddress : IOpenIddictClientHandlerFilter + public sealed class RequireHttpMetadataUri : IOpenIddictClientHandlerFilter { public ValueTask IsActiveAsync(BaseExternalContext context) { @@ -24,8 +24,8 @@ public static class OpenIddictClientSystemNetHttpHandlerFilters } return new( - string.Equals(context.Address?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || - string.Equals(context.Address?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)); + string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || + string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)); } } } diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs index 12182db1..039698ed 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs @@ -46,7 +46,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachFormParameters.Descriptor.Order - 500) .SetType(OpenIddictClientHandlerType.BuiltIn) diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs index 199bd82a..546fac3f 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs @@ -47,7 +47,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachQueryStringParameters.Descriptor.Order - 500) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -88,7 +88,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(ExtractJsonHttpResponse.Descriptor.Order - 500) .SetType(OpenIddictClientHandlerType.BuiltIn) diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs index 6b944202..1270a3fa 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs @@ -36,7 +36,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MinValue + 100_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -52,7 +52,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers // Store the HttpRequestMessage in the transaction properties. context.Transaction.SetProperty(typeof(HttpRequestMessage).FullName!, - new HttpRequestMessage(HttpMethod.Get, context.Address)); + new HttpRequestMessage(HttpMethod.Get, context.RemoteUri)); return default; } @@ -68,7 +68,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(PrepareGetHttpRequest.Descriptor.Order + 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -84,7 +84,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers // Store the HttpRequestMessage in the transaction properties. context.Transaction.SetProperty(typeof(HttpRequestMessage).FullName!, - new HttpRequestMessage(HttpMethod.Post, context.Address)); + new HttpRequestMessage(HttpMethod.Post, context.RemoteUri)); return default; } @@ -101,7 +101,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(PreparePostHttpRequest.Descriptor.Order + 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -146,7 +146,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(AttachJsonAcceptHeaders.Descriptor.Order + 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -195,7 +195,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(AttachFormParameters.Descriptor.Order - 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -240,7 +240,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -287,7 +287,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(DecompressResponseContent.Descriptor.Order - 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -360,7 +360,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -398,7 +398,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ExtractJsonHttpResponse.Descriptor.Order - 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -537,7 +537,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ExtractWwwAuthenticateHeader.Descriptor.Order - 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -605,7 +605,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ValidateHttpResponse.Descriptor.Order - 1_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -688,7 +688,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(DisposeHttpResponse.Descriptor.Order - 50_000) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -758,7 +758,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictClientHandlerType.BuiltIn) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs index 1261276a..0b2bd843 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs @@ -38,7 +38,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachQueryStringParameters.Descriptor.Order + 500) .SetType(OpenIddictClientHandlerType.BuiltIn) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs index 29f09ea5..a62a8f52 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs @@ -44,7 +44,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachUserAgentHeader.Descriptor.Order + 250) .SetType(OpenIddictClientHandlerType.BuiltIn) @@ -88,7 +88,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers /// public static OpenIddictClientHandlerDescriptor Descriptor { get; } = OpenIddictClientHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachBearerAccessToken.Descriptor.Order + 250) .SetType(OpenIddictClientHandlerType.BuiltIn) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index c57ba988..8d6b5df5 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -258,7 +258,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { Providers.Deezer or Providers.Mixcloud => OpenIddictHelpers.AddQueryStringParameter( - address: new Uri(context.TokenRequest.RedirectUri, UriKind.Absolute), + uri: new Uri(context.TokenRequest.RedirectUri, UriKind.Absolute), name: Parameters.State, value: context.StateToken).AbsoluteUri, @@ -500,7 +500,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { Providers.Deezer or Providers.Mixcloud => (OpenIddictHelpers.AddQueryStringParameter( - address: new Uri(context.RedirectUri, UriKind.Absolute), + uri: new Uri(context.RedirectUri, UriKind.Absolute), name: Parameters.State, value: context.Request.State).AbsoluteUri, null), diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 0ec02767..0ebd62c7 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -56,14 +56,14 @@ + Description="The URI used to access the Keycloak identity provider (including the realm, if applicable)" /> diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd index 5afd0c22..bab197b7 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xsd @@ -216,7 +216,7 @@ - The issuer URL corresponding to the environment. + The issuer URI corresponding to the environment. @@ -421,7 +421,7 @@ - The documentation URL, if applicable. + The documentation URI, if applicable. diff --git a/src/OpenIddict.Client/OpenIddictClientBuilder.cs b/src/OpenIddict.Client/OpenIddictClientBuilder.cs index ff267f10..bd7e4574 100644 --- a/src/OpenIddict.Client/OpenIddictClientBuilder.cs +++ b/src/OpenIddict.Client/OpenIddictClientBuilder.cs @@ -999,108 +999,108 @@ public sealed class OpenIddictClientBuilder => Configure(options => options.GrantTypes.Add(GrantTypes.RefreshToken)); /// - /// Sets the relative or absolute URLs associated to the redirection endpoint. + /// Sets the relative or absolute URIs associated to the redirection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. /// /// /// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - /// address per provider, unless all the registered providers support returning an "iss" - /// parameter containing their URL as part of authorization responses. For more information, + /// URI per provider, unless all the registered providers support returning an "iss" parameter + /// containing their identity as part of authorization responses. For more information, /// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictClientBuilder SetRedirectionEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetRedirectionEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetRedirectionEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the redirection endpoint. + /// Sets the relative or absolute URIs associated to the redirection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. /// /// /// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint - /// address per provider, unless all the registered providers support returning an "iss" - /// parameter containing their URL as part of authorization responses. For more information, + /// URI per provider, unless all the registered providers support returning an "iss" parameter + /// containing their identity as part of authorization responses. For more information, /// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictClientBuilder SetRedirectionEndpointUris(params Uri[] addresses) + public OpenIddictClientBuilder SetRedirectionEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (Array.Exists(addresses, static address => !address.IsWellFormedOriginalString())) + if (Array.Exists(uris, static uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (Array.Exists(addresses, static address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (Array.Exists(uris, static uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.RedirectionEndpointUris.Clear(); - options.RedirectionEndpointUris.AddRange(addresses); + options.RedirectionEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the post-logout redirection endpoint. + /// Sets the relative or absolute URIs associated to the post-logout redirection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictClientBuilder SetPostLogoutRedirectionEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetPostLogoutRedirectionEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetPostLogoutRedirectionEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the post-logout redirection endpoint. + /// Sets the relative or absolute URIs associated to the post-logout redirection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictClientBuilder SetPostLogoutRedirectionEndpointUris(params Uri[] addresses) + public OpenIddictClientBuilder SetPostLogoutRedirectionEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (Array.Exists(addresses, static address => !address.IsWellFormedOriginalString())) + if (Array.Exists(uris, static uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (Array.Exists(addresses, static address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (Array.Exists(uris, static uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.PostLogoutRedirectionEndpointUris.Clear(); - options.PostLogoutRedirectionEndpointUris.AddRange(addresses); + options.PostLogoutRedirectionEndpointUris.AddRange(uris); }); } @@ -1127,19 +1127,19 @@ public sealed class OpenIddictClientBuilder => Configure(options => options.StateTokenLifetime = lifetime); /// - /// Sets the client URI, which is used as the value for the "issuer" claim. + /// Sets the client URI, which is used as the value of the "issuer" claim. /// - /// The client URI. + /// The client URI. /// The instance. [EditorBrowsable(EditorBrowsableState.Advanced)] - public OpenIddictClientBuilder SetClientUri(Uri address) + public OpenIddictClientBuilder SetClientUri(Uri uri) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - return Configure(options => options.ClientUri = address); + return Configure(options => options.ClientUri = uri); } /// diff --git a/src/OpenIddict.Client/OpenIddictClientConfiguration.cs b/src/OpenIddict.Client/OpenIddictClientConfiguration.cs index bdab197b..98a6788d 100644 --- a/src/OpenIddict.Client/OpenIddictClientConfiguration.cs +++ b/src/OpenIddict.Client/OpenIddictClientConfiguration.cs @@ -70,12 +70,12 @@ public sealed class OpenIddictClientConfiguration : IPostConfigureOptions( - registration.MetadataAddress.AbsoluteUri, new OpenIddictClientRetriever(_service, registration)) + registration.ConfigurationEndpoint.AbsoluteUri, new OpenIddictClientRetriever(_service, registration)) { AutomaticRefreshInterval = ConfigurationManager.DefaultAutomaticRefreshInterval, RefreshInterval = ConfigurationManager.DefaultRefreshInterval @@ -90,12 +90,12 @@ public sealed class OpenIddictClientConfiguration : IPostConfigureOptions - /// Gets or sets the address of the external endpoint to communicate with. + /// Gets or sets the URI of the external endpoint to communicate with. /// - public Uri? Address { get; set; } + public Uri? RemoteUri { get; set; } } /// @@ -271,7 +271,7 @@ public static partial class OpenIddictClientEvents public string? ErrorDescription { get; set; } /// - /// Gets or sets the error URL returned to the caller. + /// Gets or sets the error URI returned to the caller. /// public string? ErrorUri { get; set; } @@ -334,12 +334,12 @@ public static partial class OpenIddictClientEvents public HashSet Scopes { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the token endpoint, if applicable. + /// Gets or sets the URI of the token endpoint, if applicable. /// public Uri? TokenEndpoint { get; set; } /// - /// Gets or sets the address of the userinfo endpoint, if applicable. + /// Gets or sets the URI of the userinfo endpoint, if applicable. /// public Uri? UserinfoEndpoint { get; set; } @@ -803,7 +803,7 @@ public static partial class OpenIddictClientEvents public string? RequestForgeryProtection { get; set; } /// - /// Gets or sets the optional return URL that will be stored in the state token, if applicable. + /// Gets or sets the optional target link URI that will be stored in the state token, if applicable. /// [StringSyntax(StringSyntaxAttribute.Uri)] public string? TargetLinkUri { get; set; } @@ -925,7 +925,7 @@ public static partial class OpenIddictClientEvents public string? LoginHint { get; set; } /// - /// Gets or sets the optional return URL that will be stored in the state token, if applicable. + /// Gets or sets the optional target link URI that will be stored in the state token, if applicable. /// public string? TargetLinkUri { get; set; } diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs index 2246f7fe..346a92f4 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs @@ -135,7 +135,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for attaching the address of the authorization request to the request. + /// Contains the logic responsible for attaching the URI of the authorization request to the request. /// public sealed class AttachAuthorizationEndpoint : IOpenIddictClientHandler { @@ -156,7 +156,7 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - // Ensure the authorization endpoint is present and is a valid absolute URL. + // Ensure the authorization endpoint is present and is a valid absolute URI. if (context.Configuration.AuthorizationEndpoint is not { IsAbsoluteUri: true } || !context.Configuration.AuthorizationEndpoint.IsWellFormedOriginalString()) { diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs index 7829b832..60298ce2 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs @@ -201,7 +201,7 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - // Note: the issuer returned in the discovery document must exactly match the URL used to access it. + // Note: the issuer returned in the discovery document must exactly match the URI used to access it. // See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation. var issuer = (string?) context.Response[Metadata.Issuer]; @@ -215,7 +215,7 @@ public static partial class OpenIddictClientHandlers return default; } - if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri? address)) + if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri? uri)) { context.Reject( error: Errors.ServerError, @@ -226,7 +226,7 @@ public static partial class OpenIddictClientHandlers } // Ensure the issuer matches the expected value. - if (address != context.Registration.Issuer) + if (uri != context.Registration.Issuer) { context.Reject( error: Errors.ServerError, @@ -236,14 +236,14 @@ public static partial class OpenIddictClientHandlers return default; } - context.Configuration.Issuer = address; + context.Configuration.Issuer = uri; return default; } } /// - /// Contains the logic responsible for extracting the authorization endpoint address from the discovery document. + /// Contains the logic responsible for extracting the authorization endpoint URI from the discovery document. /// public sealed class ExtractAuthorizationEndpoint : IOpenIddictClientHandler { @@ -269,15 +269,15 @@ public static partial class OpenIddictClientHandlers // but is optional in the OAuth 2.0 authorization server metadata specification. To make OpenIddict // compatible with the newer OAuth 2.0 specification, null/empty and missing values are allowed here. // - // Handlers that require a non-null authorization endpoint URL are expected to return an error - // if the authorization endpoint URL couldn't be resolved from the authorization server metadata. + // Handlers that require a non-null authorization endpoint URI are expected to return an error + // if the authorization endpoint URI couldn't be resolved from the authorization server metadata. // See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationClient // and https://datatracker.ietf.org/doc/html/rfc8414#section-2 for more information. // - var address = (string?) context.Response[Metadata.AuthorizationEndpoint]; - if (!string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.AuthorizationEndpoint]; + if (!string.IsNullOrEmpty(endpoint)) { - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, @@ -295,7 +295,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for extracting the JWKS endpoint address from the discovery document. + /// Contains the logic responsible for extracting the JWKS endpoint URI from the discovery document. /// public sealed class ExtractCryptographyEndpoint : IOpenIddictClientHandler { @@ -319,8 +319,8 @@ public static partial class OpenIddictClientHandlers // Note: the jwks_uri node is required by the OpenID Connect discovery specification. // See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationClient. - var address = (string?) context.Response[Metadata.JwksUri]; - if (string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.JwksUri]; + if (string.IsNullOrEmpty(endpoint)) { context.Reject( error: Errors.ServerError, @@ -330,7 +330,7 @@ public static partial class OpenIddictClientHandlers return default; } - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, @@ -347,7 +347,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for extracting the logout endpoint address from the discovery document. + /// Contains the logic responsible for extracting the logout endpoint URI from the discovery document. /// public sealed class ExtractLogoutEndpoint : IOpenIddictClientHandler { @@ -369,10 +369,10 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - var address = (string?) context.Response[Metadata.EndSessionEndpoint]; - if (!string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.EndSessionEndpoint]; + if (!string.IsNullOrEmpty(endpoint)) { - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, @@ -390,7 +390,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for extracting the token endpoint address from the discovery document. + /// Contains the logic responsible for extracting the token endpoint URI from the discovery document. /// public sealed class ExtractTokenEndpoint : IOpenIddictClientHandler { @@ -412,10 +412,10 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - var address = (string?) context.Response[Metadata.TokenEndpoint]; - if (!string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.TokenEndpoint]; + if (!string.IsNullOrEmpty(endpoint)) { - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, @@ -433,7 +433,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for extracting the userinfo endpoint address from the discovery document. + /// Contains the logic responsible for extracting the userinfo endpoint URI from the discovery document. /// public sealed class ExtractUserinfoEndpoint : IOpenIddictClientHandler { @@ -455,10 +455,10 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - var address = (string?) context.Response[Metadata.UserinfoEndpoint]; - if (!string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.UserinfoEndpoint]; + if (!string.IsNullOrEmpty(endpoint)) { - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs index 16ce2a10..d75924a9 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs @@ -83,10 +83,10 @@ public static partial class OpenIddictClientHandlers { // When only state tokens are considered valid, use the token validation parameters of the client. 1 when context.ValidTokenTypes.Contains(TokenTypeHints.StateToken) - => GetClientTokenValidationParameters(context.BaseUri, context.Options), + => GetClientTokenValidationParameters(), // Otherwise, use the token validation parameters of the authorization server. - _ => GetServerTokenValidationParameters(context.Registration, context.Configuration) + _ => GetServerTokenValidationParameters() }; context.SecurityTokenHandler = context.Options.JsonWebTokenHandler; @@ -94,11 +94,11 @@ public static partial class OpenIddictClientHandlers return default; - static TokenValidationParameters GetClientTokenValidationParameters(Uri? address, OpenIddictClientOptions options) + TokenValidationParameters GetClientTokenValidationParameters() { - var parameters = options.TokenValidationParameters.Clone(); + var parameters = context.Options.TokenValidationParameters.Clone(); - parameters.ValidIssuers ??= (options.ClientUri ?? address) switch + parameters.ValidIssuers ??= (context.Options.ClientUri ?? context.BaseUri) switch { null => null, @@ -122,12 +122,11 @@ public static partial class OpenIddictClientHandlers return parameters; } - static TokenValidationParameters GetServerTokenValidationParameters( - OpenIddictClientRegistration registration, OpenIddictConfiguration configuration) + TokenValidationParameters GetServerTokenValidationParameters() { - var parameters = registration!.TokenValidationParameters.Clone(); + var parameters = context.Registration.TokenValidationParameters.Clone(); - parameters.ValidIssuers ??= configuration.Issuer switch + parameters.ValidIssuers ??= context.Configuration.Issuer switch { null => null, @@ -148,7 +147,7 @@ public static partial class OpenIddictClientHandlers // Combine the signing keys registered statically in the token validation parameters // with the signing keys resolved from the OpenID Connect server configuration. parameters.IssuerSigningKeys = - parameters.IssuerSigningKeys?.Concat(configuration.SigningKeys) ?? configuration.SigningKeys; + parameters.IssuerSigningKeys?.Concat(context.Configuration.SigningKeys) ?? context.Configuration.SigningKeys; // For maximum compatibility, all "typ" values are accepted for all types of JSON Web Tokens, // which typically includes identity tokens but can also include access tokens, authorization diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs index 58ae4ea9..16bf8d4a 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs @@ -128,7 +128,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for attaching the address of the authorization request to the request. + /// Contains the logic responsible for attaching the URI of the authorization request to the request. /// public sealed class AttachLogoutEndpoint : IOpenIddictClientHandler { @@ -149,7 +149,7 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - // Ensure the end session endpoint is present and is a valid absolute URL. + // Ensure the end session endpoint is present and is a valid absolute URI. if (context.Configuration.EndSessionEndpoint is not { IsAbsoluteUri: true } || !context.Configuration.EndSessionEndpoint.IsWellFormedOriginalString()) { diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.cs index e6526697..e9d1a7cd 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.cs @@ -142,7 +142,7 @@ public static partial class OpenIddictClientHandlers .AddRange(Userinfo.DefaultHandlers); /// - /// Contains the logic responsible for inferring the endpoint type from the request address. + /// Contains the logic responsible for inferring the endpoint type from the request URI. /// public sealed class InferEndpointType : IOpenIddictClientHandler { @@ -176,14 +176,14 @@ public static partial class OpenIddictClientHandlers return default; - bool Matches(IReadOnlyList addresses) + bool Matches(IReadOnlyList candidates) { - for (var index = 0; index < addresses.Count; index++) + for (var index = 0; index < candidates.Count; index++) { - var address = addresses[index]; - if (address.IsAbsoluteUri) + var candidate = candidates[index]; + if (candidate.IsAbsoluteUri) { - if (Equals(address, context.RequestUri)) + if (Equals(candidate, context.RequestUri)) { return true; } @@ -191,7 +191,7 @@ public static partial class OpenIddictClientHandlers else { - var uri = OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, address); + var uri = OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, candidate); if (uri.IsWellFormedOriginalString() && OpenIddictHelpers.IsBaseOf(context.BaseUri, uri) && Equals(uri, context.RequestUri)) { @@ -737,7 +737,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for comparing the current request URL to the expected URL stored in the state token. + /// Contains the logic responsible for comparing the current request URI to the expected URI stored in the state token. /// public sealed class ValidateEndpointUri : IOpenIddictClientHandler { @@ -789,7 +789,7 @@ public static partial class OpenIddictClientHandlers return default; } - // Compare the current HTTP request address to the original endpoint URI. If the two don't + // Compare the current HTTP request URI to the original endpoint URI. If the two don't // match, this may indicate a mix-up attack. While the authorization server is expected to // abort the authorization flow by rejecting the token request that may be eventually sent // with the original endpoint URI, many servers are known to incorrectly implement this @@ -800,8 +800,8 @@ public static partial class OpenIddictClientHandlers // // See https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-19#section-4.4.2.2 // for more information. - var address = new Uri(value, UriKind.Absolute); - if (new UriBuilder(address) { Query = null }.Uri != + var uri = new Uri(value, UriKind.Absolute); + if (new UriBuilder(uri) { Query = null }.Uri != new UriBuilder(context.RequestUri!) { Query = null }.Uri) { context.Reject( @@ -815,11 +815,11 @@ public static partial class OpenIddictClientHandlers // Ensure all the query string parameters that were part of the original endpoint URI // are present in the current request (parameters that were not part of the original // endpoint URI are assumed to be authorization response parameters and are ignored). - if (!string.IsNullOrEmpty(address.Query)) + if (!string.IsNullOrEmpty(uri.Query)) { var parameters = OpenIddictHelpers.ParseQuery(context.RequestUri!.Query); - foreach (var parameter in OpenIddictHelpers.ParseQuery(address.Query)) + foreach (var parameter in OpenIddictHelpers.ParseQuery(uri.Query)) { if (!parameters.TryGetValue(parameter.Key, out StringValues values) || !parameter.Value.Equals(values)) @@ -1953,7 +1953,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for resolving the address of the token endpoint. + /// Contains the logic responsible for resolving the URI of the token endpoint. /// public sealed class ResolveTokenEndpoint : IOpenIddictClientHandler { @@ -1975,11 +1975,11 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - // If the address of the token endpoint wasn't explicitly set - // at this stage, try to extract it from the server configuration. + // If the URI of the token endpoint wasn't explicitly set at + // this stage, try to extract it from the server configuration. context.TokenEndpoint ??= context.Configuration.TokenEndpoint switch { - { IsAbsoluteUri: true } address when address.IsWellFormedOriginalString() => address, + { IsAbsoluteUri: true } uri when uri.IsWellFormedOriginalString() => uri, _ => null }; @@ -2193,7 +2193,7 @@ public static partial class OpenIddictClientHandlers principal.SetExpirationDate(principal.GetCreationDate() + lifetime.Value); } - // Use the address of the token endpoint as the audience, as recommended by the specifications. + // Use the URI of the token endpoint as the audience, as recommended by the specifications. // Applications that need to use a different value can register a custom event handler. // // See https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication @@ -2203,7 +2203,7 @@ public static partial class OpenIddictClientHandlers principal.SetAudiences(context.TokenEndpoint.OriginalString); } - // If the token endpoint address is not available, use the issuer address as the audience. + // If the token endpoint URI is not available, use the issuer URI as the audience. else { principal.SetAudiences(context.Issuer.OriginalString); @@ -2376,7 +2376,7 @@ public static partial class OpenIddictClientHandlers Debug.Assert(context.TokenRequest is not null, SR.GetResourceString(SR.ID4008)); - // Ensure the token endpoint is present and is a valid absolute URL. + // Ensure the token endpoint is present and is a valid absolute URI. if (context.TokenEndpoint is not { IsAbsoluteUri: true } || !context.TokenEndpoint.IsWellFormedOriginalString()) { @@ -3220,7 +3220,7 @@ public static partial class OpenIddictClientHandlers } /// - /// Contains the logic responsible for resolving the address of the userinfo endpoint. + /// Contains the logic responsible for resolving the URI of the userinfo endpoint. /// public sealed class ResolveUserinfoEndpoint : IOpenIddictClientHandler { @@ -3242,11 +3242,11 @@ public static partial class OpenIddictClientHandlers throw new ArgumentNullException(nameof(context)); } - // If the address of the userinfo endpoint wasn't explicitly set - // at this stage, try to extract it from the server configuration. + // If the URI of the userinfo endpoint wasn't explicitly set at + // this stage, try to extract it from the server configuration. context.UserinfoEndpoint ??= context.Configuration.UserinfoEndpoint switch { - { IsAbsoluteUri: true } address when address.IsWellFormedOriginalString() => address, + { IsAbsoluteUri: true } uri when uri.IsWellFormedOriginalString() => uri, _ => null }; @@ -3362,7 +3362,7 @@ public static partial class OpenIddictClientHandlers Debug.Assert(context.UserinfoRequest is not null, SR.GetResourceString(SR.ID4008)); - // Ensure the userinfo endpoint is present and is a valid absolute URL. + // Ensure the userinfo endpoint is present and is a valid absolute URI. if (context.UserinfoEndpoint is not { IsAbsoluteUri: true } || !context.UserinfoEndpoint.IsWellFormedOriginalString()) { @@ -4127,7 +4127,7 @@ public static partial class OpenIddictClientHandlers // However, browser-based hosts like Blazor may typically want to use the fragment // response mode as it offers a better protection for SPA applications. // Unfortunately, server-side clients like ASP.NET Core applications cannot - // natively use response_mode=fragment as URL fragments are never sent to servers. + // natively use response_mode=fragment as URI fragments are never sent to servers. // // As such, this handler will not choose response_mode=fragment by default and it is // expected that specialized hosts like Blazor implement custom event handlers to @@ -4550,7 +4550,7 @@ public static partial class OpenIddictClientHandlers // ensure the authorization response sent to the redirection endpoint is not forged. principal.SetClaim(Claims.RequestForgeryProtection, context.RequestForgeryProtection); - // Store the optional return URL in the state token. + // Store the optional target link URI in the state token. principal.SetClaim(Claims.TargetLinkUri, context.TargetLinkUri); // Attach the negotiated grant type to the state token. @@ -4718,7 +4718,7 @@ public static partial class OpenIddictClientHandlers // Note: while the exact order of the parameters has typically no effect on how requests // are handled by an authorization server, client_id and redirect_uri are deliberately - // set first so that they appear early in the URL (when GET requests are used), making + // set first so that they appear early in the URI (when GET requests are used), making // mistyped values easier to spot when an error is returned by the identity provider. context.Request.ClientId = context.ClientId; context.Request.RedirectUri = context.RedirectUri; @@ -5160,7 +5160,7 @@ public static partial class OpenIddictClientHandlers // ensure the logout response sent to the post-logout redirection endpoint is not forged. principal.SetClaim(Claims.RequestForgeryProtection, context.RequestForgeryProtection); - // Store the optional return URL in the state token. + // Store the optional target link URI in the state token. principal.SetClaim(Claims.TargetLinkUri, context.TargetLinkUri); // Store the type of endpoint allowed to receive the generated state token. @@ -5168,7 +5168,7 @@ public static partial class OpenIddictClientHandlers typeof(OpenIddictClientEndpointType), OpenIddictClientEndpointType.PostLogoutRedirection)!.ToLowerInvariant()); - // Store the post_logout_redirect_uri to allow comparing to the actual redirection URL. + // Store the post_logout_redirect_uri to allow comparing to the actual redirection URI. principal.SetClaim(Claims.Private.PostLogoutRedirectUri, context.PostLogoutRedirectUri); // Store the nonce in the state token. @@ -5273,7 +5273,7 @@ public static partial class OpenIddictClientHandlers // Note: while the exact order of the parameters has typically no effect on how requests // are handled by an authorization server, client_id and post_logout_redirect_uri are - // set first so that they appear early in the URL (when GET requests are used), making + // set first so that they appear early in the URI (when GET requests are used), making // mistyped values easier to spot when an error is returned by the identity provider. context.Request.ClientId = context.ClientId; context.Request.PostLogoutRedirectUri = context.PostLogoutRedirectUri; diff --git a/src/OpenIddict.Client/OpenIddictClientOptions.cs b/src/OpenIddict.Client/OpenIddictClientOptions.cs index 3d51141a..9c4cd7c2 100644 --- a/src/OpenIddict.Client/OpenIddictClientOptions.cs +++ b/src/OpenIddict.Client/OpenIddictClientOptions.cs @@ -16,7 +16,7 @@ namespace OpenIddict.Client; public sealed class OpenIddictClientOptions { /// - /// Gets or sets the optional address used to uniquely identify the client/relying party. + /// Gets or sets the optional URI used to uniquely identify the client/relying party. /// The URI must be absolute and may contain a path, but no query string or fragment part. /// public Uri? ClientUri { get; set; } diff --git a/src/OpenIddict.Client/OpenIddictClientRegistration.cs b/src/OpenIddict.Client/OpenIddictClientRegistration.cs index 8b814350..43f301f9 100644 --- a/src/OpenIddict.Client/OpenIddictClientRegistration.cs +++ b/src/OpenIddict.Client/OpenIddictClientRegistration.cs @@ -27,12 +27,12 @@ public sealed class OpenIddictClientRegistration public string? ClientSecret { get; set; } /// - /// Gets or sets the address of the redirection endpoint that will handle the callback. + /// Gets or sets the URI of the redirection endpoint that will handle the callback. /// public Uri? RedirectUri { get; set; } /// - /// Gets or sets the address of the post-logout redirection endpoint that will handle the callback. + /// Gets or sets the URI of the post-logout redirection endpoint that will handle the callback. /// public Uri? PostLogoutRedirectUri { get; set; } @@ -91,7 +91,7 @@ public sealed class OpenIddictClientRegistration public HashSet ResponseModes { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the address of the authorization server. + /// Gets or sets the URI of the authorization server. /// public Uri? Issuer { get; set; } @@ -120,14 +120,10 @@ public sealed class OpenIddictClientRegistration public IConfigurationManager ConfigurationManager { get; set; } = default!; /// - /// Gets or sets the address of the authorization endpoint exposed by the server. + /// Gets or sets the URI of the configuration endpoint exposed by the server. + /// When the URI is relative, must be set and absolute. /// - public Uri? AuthorizationEndpoint { get; set; } - - /// - /// Gets or sets the address of the token endpoint exposed by the server. - /// - public Uri? TokenEndpoint { get; set; } + public Uri? ConfigurationEndpoint { get; set; } /// /// Gets or sets the token validation parameters associated with the authorization server. @@ -143,12 +139,6 @@ public sealed class OpenIddictClientRegistration ValidateLifetime = false }; - /// - /// Gets or sets the URL of the OAuth 2.0/OpenID Connect server discovery endpoint. - /// When the URL is relative, must be set and absolute. - /// - public Uri? MetadataAddress { get; set; } - /// /// Gets the list of scopes sent by default as part of authorization requests. /// diff --git a/src/OpenIddict.Client/OpenIddictClientRetriever.cs b/src/OpenIddict.Client/OpenIddictClientRetriever.cs index e309f175..4f64455a 100644 --- a/src/OpenIddict.Client/OpenIddictClientRetriever.cs +++ b/src/OpenIddict.Client/OpenIddictClientRetriever.cs @@ -29,7 +29,7 @@ public sealed class OpenIddictClientRetriever : IConfigurationRetriever - /// Retrieves the OpenID Connect server configuration from the specified address. + /// Retrieves the OpenID Connect server configuration from the specified URI. /// /// The address of the remote metadata endpoint. /// The retriever used by IdentityModel. diff --git a/src/OpenIddict.Client/OpenIddictClientService.cs b/src/OpenIddict.Client/OpenIddictClientService.cs index 20c595c1..188ab870 100644 --- a/src/OpenIddict.Client/OpenIddictClientService.cs +++ b/src/OpenIddict.Client/OpenIddictClientService.cs @@ -106,7 +106,7 @@ public sealed class OpenIddictClientService var configuration = await registration.ConfigurationManager.GetConfigurationAsync(default) ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); - if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } address || !address.IsWellFormedOriginalString()) + if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } uri || !uri.IsWellFormedOriginalString()) { throw new InvalidOperationException(SR.FormatID0301(Metadata.TokenEndpoint)); } @@ -132,7 +132,7 @@ public sealed class OpenIddictClientService GrantType = GrantTypes.ClientCredentials, Issuer = registration.Issuer, Registration = registration, - TokenEndpoint = address, + TokenEndpoint = uri, TokenRequest = parameters is not null ? new(parameters) : null, }; @@ -277,7 +277,7 @@ public sealed class OpenIddictClientService var configuration = await registration.ConfigurationManager.GetConfigurationAsync(default) ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); - if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } address || !address.IsWellFormedOriginalString()) + if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } uri || !uri.IsWellFormedOriginalString()) { throw new InvalidOperationException(SR.FormatID0301(Metadata.TokenEndpoint)); } @@ -304,7 +304,7 @@ public sealed class OpenIddictClientService Issuer = registration.Issuer, Password = password, Registration = registration, - TokenEndpoint = address, + TokenEndpoint = uri, TokenRequest = parameters is not null ? new(parameters) : null, Username = username }; @@ -442,7 +442,7 @@ public sealed class OpenIddictClientService var configuration = await registration.ConfigurationManager.GetConfigurationAsync(default) ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); - if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } address || !address.IsWellFormedOriginalString()) + if (configuration.TokenEndpoint is not { IsAbsoluteUri: true } uri || !uri.IsWellFormedOriginalString()) { throw new InvalidOperationException(SR.FormatID0301(Metadata.TokenEndpoint)); } @@ -469,7 +469,7 @@ public sealed class OpenIddictClientService Issuer = registration.Issuer, RefreshToken = token, Registration = registration, - TokenEndpoint = address, + TokenEndpoint = uri, TokenRequest = parameters is not null ? new(parameters) : null, }; @@ -519,28 +519,28 @@ public sealed class OpenIddictClientService } /// - /// Retrieves the OpenID Connect server configuration from the specified address. + /// Retrieves the OpenID Connect server configuration from the specified uri. /// /// The client registration. - /// The address of the remote metadata endpoint. + /// The uri of the remote metadata endpoint. /// The that can be used to abort the operation. /// The OpenID Connect server configuration retrieved from the remote server. internal async ValueTask GetConfigurationAsync( - OpenIddictClientRegistration registration, Uri address, CancellationToken cancellationToken = default) + OpenIddictClientRegistration registration, Uri uri, CancellationToken cancellationToken = default) { if (registration is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri || !address.IsWellFormedOriginalString()) + if (!uri.IsAbsoluteUri || !uri.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } cancellationToken.ThrowIfCancellationRequested(); @@ -570,7 +570,7 @@ public sealed class OpenIddictClientService { var context = new PrepareConfigurationRequestContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -591,7 +591,7 @@ public sealed class OpenIddictClientService { var context = new ApplyConfigurationRequestContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -605,7 +605,7 @@ public sealed class OpenIddictClientService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request); return context.Request; } @@ -614,7 +614,7 @@ public sealed class OpenIddictClientService { var context = new ExtractConfigurationResponseContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -630,7 +630,7 @@ public sealed class OpenIddictClientService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response); return context.Response; } @@ -639,7 +639,7 @@ public sealed class OpenIddictClientService { var context = new HandleConfigurationResponseContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request, Response = response @@ -676,25 +676,25 @@ public sealed class OpenIddictClientService /// Retrieves the security keys exposed by the specified JWKS endpoint. /// /// The client registration. - /// The address of the remote metadata endpoint. + /// The uri of the remote metadata endpoint. /// The that can be used to abort the operation. /// The security keys retrieved from the remote server. internal async ValueTask GetSecurityKeysAsync( - OpenIddictClientRegistration registration, Uri address, CancellationToken cancellationToken = default) + OpenIddictClientRegistration registration, Uri uri, CancellationToken cancellationToken = default) { if (registration is null) { throw new ArgumentNullException(nameof(registration)); } - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri || !address.IsWellFormedOriginalString()) + if (!uri.IsAbsoluteUri || !uri.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } cancellationToken.ThrowIfCancellationRequested(); @@ -725,7 +725,7 @@ public sealed class OpenIddictClientService { var context = new PrepareCryptographyRequestContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -746,7 +746,7 @@ public sealed class OpenIddictClientService { var context = new ApplyCryptographyRequestContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -760,7 +760,7 @@ public sealed class OpenIddictClientService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request); return context.Request; } @@ -769,7 +769,7 @@ public sealed class OpenIddictClientService { var context = new ExtractCryptographyResponseContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request }; @@ -785,7 +785,7 @@ public sealed class OpenIddictClientService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response); return context.Response; } @@ -794,7 +794,7 @@ public sealed class OpenIddictClientService { var context = new HandleCryptographyResponseContext(transaction) { - Address = address, + RemoteUri = uri, Registration = registration, Request = request, Response = response @@ -832,12 +832,12 @@ public sealed class OpenIddictClientService /// /// The client registration. /// The token request. - /// The address of the remote token endpoint. + /// The uri of the remote token endpoint. /// The that can be used to abort the operation. /// The token response. internal async ValueTask SendTokenRequestAsync( OpenIddictClientRegistration registration, OpenIddictRequest request, - Uri? address = null, CancellationToken cancellationToken = default) + Uri? uri = null, CancellationToken cancellationToken = default) { if (registration is null) { @@ -849,14 +849,14 @@ public sealed class OpenIddictClientService throw new ArgumentNullException(nameof(request)); } - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri || !address.IsWellFormedOriginalString()) + if (!uri.IsAbsoluteUri || !uri.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } var configuration = await registration.ConfigurationManager.GetConfigurationAsync(default) ?? @@ -888,7 +888,7 @@ public sealed class OpenIddictClientService { var context = new PrepareTokenRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -910,7 +910,7 @@ public sealed class OpenIddictClientService { var context = new ApplyTokenRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -925,7 +925,7 @@ public sealed class OpenIddictClientService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6192), context.RemoteUri, context.Request); return context.Request; } @@ -934,7 +934,7 @@ public sealed class OpenIddictClientService { var context = new ExtractTokenResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -951,7 +951,7 @@ public sealed class OpenIddictClientService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6193), context.RemoteUri, context.Response); return context.Response; } @@ -960,7 +960,7 @@ public sealed class OpenIddictClientService { var context = new HandleTokenResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request, @@ -999,25 +999,25 @@ public sealed class OpenIddictClientService /// /// The client registration. /// The userinfo request. - /// The address of the remote userinfo endpoint. + /// The uri of the remote userinfo endpoint. /// The that can be used to abort the operation. /// The response and the principal extracted from the userinfo response or the userinfo token. internal async ValueTask<(OpenIddictResponse Response, (ClaimsPrincipal? Principal, string? Token))> SendUserinfoRequestAsync( - OpenIddictClientRegistration registration, OpenIddictRequest request, Uri address, CancellationToken cancellationToken = default) + OpenIddictClientRegistration registration, OpenIddictRequest request, Uri uri, CancellationToken cancellationToken = default) { if (registration is null) { throw new ArgumentNullException(nameof(registration)); } - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri || !address.IsWellFormedOriginalString()) + if (!uri.IsAbsoluteUri || !uri.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } var configuration = await registration.ConfigurationManager.GetConfigurationAsync(default) ?? @@ -1049,7 +1049,7 @@ public sealed class OpenIddictClientService { var context = new PrepareUserinfoRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -1071,7 +1071,7 @@ public sealed class OpenIddictClientService { var context = new ApplyUserinfoRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -1086,7 +1086,7 @@ public sealed class OpenIddictClientService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6194), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6194), context.RemoteUri, context.Request); return context.Request; } @@ -1095,7 +1095,7 @@ public sealed class OpenIddictClientService { var context = new ExtractUserinfoResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request @@ -1112,7 +1112,7 @@ public sealed class OpenIddictClientService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6195), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6195), context.RemoteUri, context.Response); return (context.Response, context.UserinfoToken); } @@ -1121,7 +1121,7 @@ public sealed class OpenIddictClientService { var context = new HandleUserinfoResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Registration = registration, Request = request, diff --git a/src/OpenIddict.Core/Caches/OpenIddictApplicationCache.cs b/src/OpenIddict.Core/Caches/OpenIddictApplicationCache.cs index 868fd2f0..1c7286ee 100644 --- a/src/OpenIddict.Core/Caches/OpenIddictApplicationCache.cs +++ b/src/OpenIddict.Core/Caches/OpenIddictApplicationCache.cs @@ -57,21 +57,21 @@ public sealed class OpenIddictApplicationCache : IOpenIddictApplic Identifier = await _store.GetIdAsync(application, cancellationToken) }); - foreach (var address in await _store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) + foreach (var uri in await _store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) { _cache.Remove(new { Method = nameof(FindByPostLogoutRedirectUriAsync), - Address = address + Uri = uri }); } - foreach (var address in await _store.GetRedirectUrisAsync(application, cancellationToken)) + foreach (var uri in await _store.GetRedirectUrisAsync(application, cancellationToken)) { _cache.Remove(new { Method = nameof(FindByRedirectUriAsync), - Address = address + Uri = uri }); } @@ -169,11 +169,11 @@ public sealed class OpenIddictApplicationCache : IOpenIddictApplic /// public IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } return ExecuteAsync(cancellationToken); @@ -183,14 +183,14 @@ public sealed class OpenIddictApplicationCache : IOpenIddictApplic var parameters = new { Method = nameof(FindByPostLogoutRedirectUriAsync), - Address = address + Uri = uri }; if (!_cache.TryGetValue(parameters, out ImmutableArray applications)) { var builder = ImmutableArray.CreateBuilder(); - await foreach (var application in _store.FindByPostLogoutRedirectUriAsync(address, cancellationToken)) + await foreach (var application in _store.FindByPostLogoutRedirectUriAsync(uri, cancellationToken)) { builder.Add(application); @@ -211,11 +211,11 @@ public sealed class OpenIddictApplicationCache : IOpenIddictApplic /// public IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } return ExecuteAsync(cancellationToken); @@ -225,14 +225,14 @@ public sealed class OpenIddictApplicationCache : IOpenIddictApplic var parameters = new { Method = nameof(FindByRedirectUriAsync), - Address = address + Uri = uri }; if (!_cache.TryGetValue(parameters, out ImmutableArray applications)) { var builder = ImmutableArray.CreateBuilder(); - await foreach (var application in _store.FindByRedirectUriAsync(address, cancellationToken)) + await foreach (var application in _store.FindByRedirectUriAsync(uri, cancellationToken)) { builder.Add(application); diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index b16596cd..de7375f3 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -326,20 +326,20 @@ public class OpenIddictApplicationManager : IOpenIddictApplication /// /// Retrieves all the applications associated with the specified post_logout_redirect_uri. /// - /// The post_logout_redirect_uri associated with the applications. + /// The post_logout_redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified post_logout_redirect_uri. public virtual IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } var applications = Options.CurrentValue.DisableEntityCaching ? - Store.FindByPostLogoutRedirectUriAsync(address, cancellationToken) : - Cache.FindByPostLogoutRedirectUriAsync(address, cancellationToken); + Store.FindByPostLogoutRedirectUriAsync(uri, cancellationToken) : + Cache.FindByPostLogoutRedirectUriAsync(uri, cancellationToken); if (Options.CurrentValue.DisableAdditionalFiltering) { @@ -356,8 +356,8 @@ public class OpenIddictApplicationManager : IOpenIddictApplication { await foreach (var application in applications) { - var addresses = await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -368,20 +368,20 @@ public class OpenIddictApplicationManager : IOpenIddictApplication /// /// Retrieves all the applications associated with the specified redirect_uri. /// - /// The redirect_uri associated with the applications. + /// The redirect_uri associated with the applications. /// The that can be used to abort the operation. /// The client applications corresponding to the specified redirect_uri. public virtual IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } var applications = Options.CurrentValue.DisableEntityCaching ? - Store.FindByRedirectUriAsync(address, cancellationToken) : - Cache.FindByRedirectUriAsync(address, cancellationToken); + Store.FindByRedirectUriAsync(uri, cancellationToken) : + Cache.FindByRedirectUriAsync(uri, cancellationToken); if (Options.CurrentValue.DisableAdditionalFiltering) { @@ -398,8 +398,8 @@ public class OpenIddictApplicationManager : IOpenIddictApplication { await foreach (var application in applications) { - var addresses = await Store.GetRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await Store.GetRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -665,7 +665,7 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } /// - /// Retrieves the logout callback addresses associated with an application. + /// Retrieves the post-logout redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -705,7 +705,7 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } /// - /// Retrieves the callback addresses associated with an application. + /// Retrieves the redirect URIs associated with an application. /// /// The application. /// The that can be used to abort the operation. @@ -916,10 +916,10 @@ public class OpenIddictApplicationManager : IOpenIddictApplication await Store.SetDisplayNamesAsync(application, descriptor.DisplayNames.ToImmutableDictionary(), cancellationToken); await Store.SetPermissionsAsync(application, descriptor.Permissions.ToImmutableArray(), cancellationToken); await Store.SetPostLogoutRedirectUrisAsync(application, ImmutableArray.CreateRange( - descriptor.PostLogoutRedirectUris.Select(address => address.OriginalString)), cancellationToken); + descriptor.PostLogoutRedirectUris.Select(uri => uri.OriginalString)), cancellationToken); await Store.SetPropertiesAsync(application, descriptor.Properties.ToImmutableDictionary(), cancellationToken); await Store.SetRedirectUrisAsync(application, ImmutableArray.CreateRange( - descriptor.RedirectUris.Select(address => address.OriginalString)), cancellationToken); + descriptor.RedirectUris.Select(uri => uri.OriginalString)), cancellationToken); await Store.SetRequirementsAsync(application, descriptor.Requirements.ToImmutableArray(), cancellationToken); } @@ -963,21 +963,21 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } descriptor.PostLogoutRedirectUris.Clear(); - foreach (var address in await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) + foreach (var uri in await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) { - // Ensure the address is not null or empty. - if (string.IsNullOrEmpty(address)) + // Ensure the URI is not null or empty. + if (string.IsNullOrEmpty(uri)) { throw new ArgumentException(SR.GetResourceString(SR.ID0213)); } - // Ensure the address is a valid absolute URL. - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + // Ensure the URI is a valid absolute URI. + if (!Uri.TryCreate(uri, UriKind.Absolute, out Uri? value) || !value.IsWellFormedOriginalString()) { throw new ArgumentException(SR.GetResourceString(SR.ID0214)); } - descriptor.PostLogoutRedirectUris.Add(uri); + descriptor.PostLogoutRedirectUris.Add(value); } descriptor.Properties.Clear(); @@ -987,21 +987,21 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } descriptor.RedirectUris.Clear(); - foreach (var address in await Store.GetRedirectUrisAsync(application, cancellationToken)) + foreach (var uri in await Store.GetRedirectUrisAsync(application, cancellationToken)) { - // Ensure the address is not null or empty. - if (string.IsNullOrEmpty(address)) + // Ensure the URI is not null or empty. + if (string.IsNullOrEmpty(uri)) { throw new ArgumentException(SR.GetResourceString(SR.ID0213)); } - // Ensure the address is a valid absolute URL. - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + // Ensure the URI is a valid absolute URI. + if (!Uri.TryCreate(uri, UriKind.Absolute, out Uri? value) || !value.IsWellFormedOriginalString()) { throw new ArgumentException(SR.GetResourceString(SR.ID0214)); } - descriptor.RedirectUris.Add(uri); + descriptor.RedirectUris.Add(value); } } @@ -1192,30 +1192,30 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } } - // When callback URLs are specified, ensure they are valid and spec-compliant. + // When callback URIs are specified, ensure they are valid and spec-compliant. // See https://tools.ietf.org/html/rfc6749#section-3.1 for more information. - foreach (var address in ImmutableArray.Create() + foreach (var uri in ImmutableArray.Create() .AddRange(await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) .AddRange(await Store.GetRedirectUrisAsync(application, cancellationToken))) { - // Ensure the address is not null or empty. - if (string.IsNullOrEmpty(address)) + // Ensure the URI is not null or empty. + if (string.IsNullOrEmpty(uri)) { yield return new ValidationResult(SR.GetResourceString(SR.ID2061)); break; } - // Ensure the address is a valid absolute URL. - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + // Ensure the URI is a valid absolute URI. + if (!Uri.TryCreate(uri, UriKind.Absolute, out Uri? value) || !value.IsWellFormedOriginalString()) { yield return new ValidationResult(SR.GetResourceString(SR.ID2062)); break; } - // Ensure the address doesn't contain a fragment. - if (!string.IsNullOrEmpty(uri.Fragment)) + // Ensure the URI doesn't contain a fragment. + if (!string.IsNullOrEmpty(value.Fragment)) { yield return new ValidationResult(SR.GetResourceString(SR.ID2115)); @@ -1223,10 +1223,10 @@ public class OpenIddictApplicationManager : IOpenIddictApplication } // To prevent issuer fixation attacks where a malicious client would specify an "iss" parameter - // in the callback URL, ensure the query - if present - doesn't include an "iss" parameter. - if (!string.IsNullOrEmpty(uri.Query)) + // in the callback URI, ensure the query - if present - doesn't include an "iss" parameter. + if (!string.IsNullOrEmpty(value.Query)) { - var parameters = OpenIddictHelpers.ParseQuery(uri.Query); + var parameters = OpenIddictHelpers.ParseQuery(value.Query); if (parameters.ContainsKey(Parameters.Iss)) { yield return new ValidationResult(SR.FormatID2134(Parameters.Iss)); @@ -1289,7 +1289,7 @@ public class OpenIddictApplicationManager : IOpenIddictApplication /// Validates the post_logout_redirect_uri to ensure it's associated with an application. /// /// The application. - /// The address that should be compared to one of the post_logout_redirect_uri stored in the database. + /// The URI that should be compared to one of the post_logout_redirect_uri stored in the database. /// The that can be used to abort the operation. /// Note: if no client_id parameter is specified in logout requests, this method may not be called. /// @@ -1297,28 +1297,28 @@ public class OpenIddictApplicationManager : IOpenIddictApplication /// whose result returns a boolean indicating whether the post_logout_redirect_uri was valid. /// public virtual async ValueTask ValidatePostLogoutRedirectUriAsync(TApplication application, - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } - foreach (var uri in await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) + foreach (var candidate in await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) { // Note: the post_logout_redirect_uri must be compared using case-sensitive "Simple String Comparison". - if (string.Equals(uri, address, StringComparison.Ordinal)) + if (string.Equals(candidate, uri, StringComparison.Ordinal)) { return true; } } - Logger.LogInformation(SR.GetResourceString(SR.ID6202), address, await GetClientIdAsync(application, cancellationToken)); + Logger.LogInformation(SR.GetResourceString(SR.ID6202), uri, await GetClientIdAsync(application, cancellationToken)); return false; } @@ -1327,36 +1327,36 @@ public class OpenIddictApplicationManager : IOpenIddictApplication /// Validates the redirect_uri to ensure it's associated with an application. /// /// The application. - /// The address that should be compared to one of the redirect_uri stored in the database. + /// The URI that should be compared to one of the redirect_uri stored in the database. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns a boolean indicating whether the redirect_uri was valid. /// public virtual async ValueTask ValidateRedirectUriAsync(TApplication application, - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken = default) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken = default) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } - foreach (var uri in await Store.GetRedirectUrisAsync(application, cancellationToken)) + foreach (var candidate in await Store.GetRedirectUrisAsync(application, cancellationToken)) { // Note: the redirect_uri must be compared using case-sensitive "Simple String Comparison". // See http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest for more information. - if (string.Equals(uri, address, StringComparison.Ordinal)) + if (string.Equals(candidate, uri, StringComparison.Ordinal)) { return true; } } - Logger.LogInformation(SR.GetResourceString(SR.ID6162), address, await GetClientIdAsync(application, cancellationToken)); + Logger.LogInformation(SR.GetResourceString(SR.ID6162), uri, await GetClientIdAsync(application, cancellationToken)); return false; } @@ -1567,12 +1567,12 @@ public class OpenIddictApplicationManager : IOpenIddictApplication => await FindByIdAsync(identifier, cancellationToken); /// - IAsyncEnumerable IOpenIddictApplicationManager.FindByPostLogoutRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) - => FindByPostLogoutRedirectUriAsync(address, cancellationToken); + IAsyncEnumerable IOpenIddictApplicationManager.FindByPostLogoutRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) + => FindByPostLogoutRedirectUriAsync(uri, cancellationToken); /// - IAsyncEnumerable IOpenIddictApplicationManager.FindByRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) - => FindByRedirectUriAsync(address, cancellationToken); + IAsyncEnumerable IOpenIddictApplicationManager.FindByRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) + => FindByRedirectUriAsync(uri, cancellationToken); /// ValueTask IOpenIddictApplicationManager.GetAsync(Func, IQueryable> query, CancellationToken cancellationToken) where TResult : default @@ -1691,10 +1691,10 @@ public class OpenIddictApplicationManager : IOpenIddictApplication => ValidateClientSecretAsync((TApplication) application, secret, cancellationToken); /// - ValueTask IOpenIddictApplicationManager.ValidatePostLogoutRedirectUriAsync(object application, [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) - => ValidatePostLogoutRedirectUriAsync((TApplication) application, address, cancellationToken); + ValueTask IOpenIddictApplicationManager.ValidatePostLogoutRedirectUriAsync(object application, [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) + => ValidatePostLogoutRedirectUriAsync((TApplication) application, uri, cancellationToken); /// - ValueTask IOpenIddictApplicationManager.ValidateRedirectUriAsync(object application, [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) - => ValidateRedirectUriAsync((TApplication) application, address, cancellationToken); + ValueTask IOpenIddictApplicationManager.ValidateRedirectUriAsync(object application, [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) + => ValidateRedirectUriAsync((TApplication) application, uri, cancellationToken); } diff --git a/src/OpenIddict.EntityFramework.Models/OpenIddictEntityFrameworkApplication.cs b/src/OpenIddict.EntityFramework.Models/OpenIddictEntityFrameworkApplication.cs index 86014a95..b6d40109 100644 --- a/src/OpenIddict.EntityFramework.Models/OpenIddictEntityFrameworkApplication.cs +++ b/src/OpenIddict.EntityFramework.Models/OpenIddictEntityFrameworkApplication.cs @@ -83,7 +83,7 @@ public class OpenIddictEntityFrameworkApplication public virtual string? Permissions { get; set; } /// - /// Gets or sets the logout callback URLs associated with + /// Gets or sets the post-logout redirect URIs associated with /// the current application, serialized as a JSON array. /// [StringSyntax(StringSyntaxAttribute.Json)] @@ -97,7 +97,7 @@ public class OpenIddictEntityFrameworkApplication public virtual string? Properties { get; set; } /// - /// Gets or sets the callback URLs associated with the + /// Gets or sets the redirect URIs associated with the /// current application, serialized as a JSON array. /// [StringSyntax(StringSyntaxAttribute.Json)] diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs index dbab0916..508264d0 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs @@ -237,15 +237,15 @@ public class OpenIddictEntityFrameworkApplicationStore public virtual IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } // To optimize the efficiency of the query a bit, only applications whose stringified - // PostLogoutRedirectUris contains the specified URL are returned. Once the applications + // PostLogoutRedirectUris contains the specified URI are returned. Once the applications // are retrieved, a second pass is made to ensure only valid elements are returned. // Implementers that use this method in a hot path may want to override this method // to use SQL Server 2016 functions like JSON_VALUE to make the query more efficient. @@ -255,13 +255,13 @@ public class OpenIddictEntityFrameworkApplicationStore ExecuteAsync([EnumeratorCancellation] CancellationToken cancellationToken) { var applications = (from application in Applications - where application.PostLogoutRedirectUris!.Contains(address) + where application.PostLogoutRedirectUris!.Contains(uri) select application).AsAsyncEnumerable(cancellationToken); await foreach (var application in applications) { - var addresses = await GetPostLogoutRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await GetPostLogoutRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -271,15 +271,15 @@ public class OpenIddictEntityFrameworkApplicationStore public virtual IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } // To optimize the efficiency of the query a bit, only applications whose stringified - // RedirectUris property contains the specified URL are returned. Once the applications + // RedirectUris property contains the specified URI are returned. Once the applications // are retrieved, a second pass is made to ensure only valid elements are returned. // Implementers that use this method in a hot path may want to override this method // to use SQL Server 2016 functions like JSON_VALUE to make the query more efficient. @@ -289,13 +289,13 @@ public class OpenIddictEntityFrameworkApplicationStore ExecuteAsync([EnumeratorCancellation] CancellationToken cancellationToken) { var applications = (from application in Applications - where application.RedirectUris!.Contains(address) + where application.RedirectUris!.Contains(uri) select application).AsAsyncEnumerable(cancellationToken); await foreach (var application in applications) { - var addresses = await GetRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await GetRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -477,10 +477,10 @@ public class OpenIddictEntityFrameworkApplicationStore()); } - // Note: parsing the stringified addresses is an expensive operation. + // Note: parsing the stringified URIs is an expensive operation. // To mitigate that, the resulting array is stored in the memory cache. var key = string.Concat("fb14dfb9-9216-4b77-bfa9-7e85f8201ff4", "\x1e", application.PostLogoutRedirectUris); - var addresses = Cache.GetOrCreate(key, entry => + var uris = Cache.GetOrCreate(key, entry => { entry.SetPriority(CacheItemPriority.High) .SetSlidingExpiration(TimeSpan.FromMinutes(1)); @@ -502,7 +502,7 @@ public class OpenIddictEntityFrameworkApplicationStore @@ -553,10 +553,10 @@ public class OpenIddictEntityFrameworkApplicationStore()); } - // Note: parsing the stringified addresses is an expensive operation. + // Note: parsing the stringified URIs is an expensive operation. // To mitigate that, the resulting array is stored in the memory cache. var key = string.Concat("851d6f08-2ee0-4452-bbe5-ab864611ecaa", "\x1e", application.RedirectUris); - var addresses = Cache.GetOrCreate(key, entry => + var uris = Cache.GetOrCreate(key, entry => { entry.SetPriority(CacheItemPriority.High) .SetSlidingExpiration(TimeSpan.FromMinutes(1)); @@ -578,7 +578,7 @@ public class OpenIddictEntityFrameworkApplicationStore @@ -812,14 +812,14 @@ public class OpenIddictEntityFrameworkApplicationStore public virtual ValueTask SetPostLogoutRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.PostLogoutRedirectUris = null; @@ -835,9 +835,9 @@ public class OpenIddictEntityFrameworkApplicationStore public virtual ValueTask SetRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.RedirectUris = null; @@ -912,9 +912,9 @@ public class OpenIddictEntityFrameworkApplicationStore - /// Gets or sets the logout callback URLs associated with + /// Gets or sets the post-logout redirect URIs associated with /// the current application, serialized as a JSON array. /// [StringSyntax(StringSyntaxAttribute.Json)] @@ -105,7 +105,7 @@ public class OpenIddictEntityFrameworkCoreApplication - /// Gets or sets the callback URLs associated with the + /// Gets or sets the redirect URIs associated with the /// current application, serialized as a JSON array. /// [StringSyntax(StringSyntaxAttribute.Json)] diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs index 5492c94c..4dbfd6d5 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs @@ -279,15 +279,15 @@ public class OpenIddictEntityFrameworkCoreApplicationStore public virtual IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } // To optimize the efficiency of the query a bit, only applications whose stringified - // PostLogoutRedirectUris contains the specified URL are returned. Once the applications + // PostLogoutRedirectUris contains the specified URI are returned. Once the applications // are retrieved, a second pass is made to ensure only valid elements are returned. // Implementers that use this method in a hot path may want to override this method // to use SQL Server 2016 functions like JSON_VALUE to make the query more efficient. @@ -297,13 +297,13 @@ public class OpenIddictEntityFrameworkCoreApplicationStore ExecuteAsync([EnumeratorCancellation] CancellationToken cancellationToken) { var applications = (from application in Applications.AsTracking() - where application.PostLogoutRedirectUris!.Contains(address) + where application.PostLogoutRedirectUris!.Contains(uri) select application).AsAsyncEnumerable(cancellationToken); await foreach (var application in applications) { - var addresses = await GetPostLogoutRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await GetPostLogoutRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -313,15 +313,15 @@ public class OpenIddictEntityFrameworkCoreApplicationStore public virtual IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } // To optimize the efficiency of the query a bit, only applications whose stringified - // RedirectUris property contains the specified URL are returned. Once the applications + // RedirectUris property contains the specified URI are returned. Once the applications // are retrieved, a second pass is made to ensure only valid elements are returned. // Implementers that use this method in a hot path may want to override this method // to use SQL Server 2016 functions like JSON_VALUE to make the query more efficient. @@ -331,13 +331,13 @@ public class OpenIddictEntityFrameworkCoreApplicationStore ExecuteAsync([EnumeratorCancellation] CancellationToken cancellationToken) { var applications = (from application in Applications.AsTracking() - where application.RedirectUris!.Contains(address) + where application.RedirectUris!.Contains(uri) select application).AsAsyncEnumerable(cancellationToken); await foreach (var application in applications) { - var addresses = await GetRedirectUrisAsync(application, cancellationToken); - if (addresses.Contains(address, StringComparer.Ordinal)) + var uris = await GetRedirectUrisAsync(application, cancellationToken); + if (uris.Contains(uri, StringComparer.Ordinal)) { yield return application; } @@ -519,10 +519,10 @@ public class OpenIddictEntityFrameworkCoreApplicationStore()); } - // Note: parsing the stringified addresses is an expensive operation. + // Note: parsing the stringified URIs is an expensive operation. // To mitigate that, the resulting array is stored in the memory cache. var key = string.Concat("fb14dfb9-9216-4b77-bfa9-7e85f8201ff4", "\x1e", application.PostLogoutRedirectUris); - var addresses = Cache.GetOrCreate(key, entry => + var uris = Cache.GetOrCreate(key, entry => { entry.SetPriority(CacheItemPriority.High) .SetSlidingExpiration(TimeSpan.FromMinutes(1)); @@ -544,7 +544,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore @@ -595,10 +595,10 @@ public class OpenIddictEntityFrameworkCoreApplicationStore()); } - // Note: parsing the stringified addresses is an expensive operation. + // Note: parsing the stringified URIs is an expensive operation. // To mitigate that, the resulting array is stored in the memory cache. var key = string.Concat("851d6f08-2ee0-4452-bbe5-ab864611ecaa", "\x1e", application.RedirectUris); - var addresses = Cache.GetOrCreate(key, entry => + var uris = Cache.GetOrCreate(key, entry => { entry.SetPriority(CacheItemPriority.High) .SetSlidingExpiration(TimeSpan.FromMinutes(1)); @@ -620,7 +620,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore @@ -853,14 +853,14 @@ public class OpenIddictEntityFrameworkCoreApplicationStore public virtual ValueTask SetPostLogoutRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.PostLogoutRedirectUris = null; @@ -876,9 +876,9 @@ public class OpenIddictEntityFrameworkCoreApplicationStore public virtual ValueTask SetRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.RedirectUris = null; @@ -953,9 +953,9 @@ public class OpenIddictEntityFrameworkCoreApplicationStore? Permissions { get; set; } = ImmutableList.Create(); /// - /// Gets or sets the logout callback URLs associated with the current application. + /// Gets or sets the post-logout redirect URIs associated with the current application. /// [BsonElement("post_logout_redirect_uris"), BsonIgnoreIfNull] public virtual IReadOnlyList? PostLogoutRedirectUris { get; set; } = ImmutableList.Create(); @@ -79,7 +79,7 @@ public class OpenIddictMongoDbApplication public virtual BsonDocument? Properties { get; set; } /// - /// Gets or sets the callback URLs associated with the current application. + /// Gets or sets the redirect URIs associated with the current application. /// [BsonElement("redirect_uris"), BsonIgnoreIfNull] public virtual IReadOnlyList? RedirectUris { get; set; } = ImmutableList.Create(); diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs index ed4ff8d0..c1594152 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs @@ -138,11 +138,11 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic /// public virtual IAsyncEnumerable FindByPostLogoutRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } return ExecuteAsync(cancellationToken); @@ -153,7 +153,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic var collection = database.GetCollection(Options.CurrentValue.ApplicationsCollectionName); await foreach (var application in collection.Find(application => - application.PostLogoutRedirectUris!.Contains(address)).ToAsyncEnumerable(cancellationToken)) + application.PostLogoutRedirectUris!.Contains(uri)).ToAsyncEnumerable(cancellationToken)) { yield return application; } @@ -162,11 +162,11 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic /// public virtual IAsyncEnumerable FindByRedirectUriAsync( - [StringSyntax(StringSyntaxAttribute.Uri)] string address, CancellationToken cancellationToken) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0143), nameof(uri)); } return ExecuteAsync(cancellationToken); @@ -177,7 +177,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic var collection = database.GetCollection(Options.CurrentValue.ApplicationsCollectionName); await foreach (var application in collection.Find(application => - application.RedirectUris!.Contains(address)).ToAsyncEnumerable(cancellationToken)) + application.RedirectUris!.Contains(uri)).ToAsyncEnumerable(cancellationToken)) { yield return application; } @@ -554,21 +554,21 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic /// public virtual ValueTask SetPostLogoutRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.PostLogoutRedirectUris = null; return default; } - application.PostLogoutRedirectUris = addresses.ToImmutableList(); + application.PostLogoutRedirectUris = uris.ToImmutableList(); return default; } @@ -614,21 +614,21 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic /// public virtual ValueTask SetRedirectUrisAsync(TApplication application, - ImmutableArray addresses, CancellationToken cancellationToken) + ImmutableArray uris, CancellationToken cancellationToken) { if (application is null) { throw new ArgumentNullException(nameof(application)); } - if (addresses.IsDefaultOrEmpty) + if (uris.IsDefaultOrEmpty) { application.RedirectUris = null; return default; } - application.RedirectUris = addresses.ToImmutableList(); + application.RedirectUris = uris.ToImmutableList(); return default; } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs index a2f6a815..e4ff55f8 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs @@ -149,7 +149,7 @@ public sealed class OpenIddictServerAspNetCoreBuilder /// /// Sets the realm returned to the caller as part of the WWW-Authenticate header. /// - /// The issuer address. + /// The realm. /// The instance. public OpenIddictServerAspNetCoreBuilder SetRealm(string realm) { diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs index f017ed4c..637501c0 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs @@ -245,12 +245,12 @@ public static partial class OpenIddictServerAspNetCoreHandlers token, _options.CurrentValue.AuthorizationRequestCachingPolicy); // Create a new GET authorization request containing only the request_id parameter. - var address = QueryHelpers.AddQueryString( + var location = QueryHelpers.AddQueryString( uri: request.Scheme + Uri.SchemeDelimiter + request.Host + request.PathBase + request.Path, name: Parameters.RequestId, value: context.Request.RequestId); - request.HttpContext.Response.Redirect(address); + request.HttpContext.Response.Redirect(location); // Mark the response as handled to skip the rest of the pipeline. context.HandleRequest(); diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs index 70c73781..5a15c724 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs @@ -81,8 +81,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers var response = context.Transaction.GetHttpRequest()?.HttpContext.Response ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0114)); - // Note: this handler only redirects the user agent to the address specified in - // the properties when there's no error or if the error is an access_denied error. + // Note: this handler only redirects the user agent to the URI specified in the + // properties when there's no error or if the error is an access_denied error. if (!string.IsNullOrEmpty(context.Response.Error) && !string.Equals(context.Response.Error, Errors.AccessDenied, StringComparison.Ordinal)) { diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs index deb39ec2..0b2ed3f8 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs @@ -242,12 +242,12 @@ public static partial class OpenIddictServerAspNetCoreHandlers token, _options.CurrentValue.LogoutRequestCachingPolicy); // Create a new GET logout request containing only the request_id parameter. - var address = QueryHelpers.AddQueryString( + var location = QueryHelpers.AddQueryString( uri: request.Scheme + Uri.SchemeDelimiter + request.Host + request.PathBase + request.Path, name: Parameters.RequestId, value: context.Request.RequestId); - request.HttpContext.Response.Redirect(address); + request.HttpContext.Response.Redirect(location); // Mark the response as handled to skip the rest of the pipeline. context.HandleRequest(); diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs index f69a4add..7f11f711 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs @@ -96,7 +96,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers // sent by the HTTP client) is not desirable as it would affect all requests, including requests // that are not meant to be handled by OpenIddict itself. To avoid that, a fake host is temporarily // used to build an absolute base URI and a request URI that will be used to determine whether the - // received request matches one of the addresses assigned to an OpenIddict endpoint. If the request + // received request matches one of the URIs assigned to an OpenIddict endpoint. If the request // is later handled by OpenIddict, an additional check will be made to require the Host header. (context.BaseUri, context.RequestUri) = request.Host switch diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs index 763efe57..496e4cde 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs @@ -138,7 +138,7 @@ public sealed class OpenIddictServerOwinBuilder /// /// Sets the realm returned to the caller as part of the WWW-Authenticate header. /// - /// The issuer address. + /// The realm. /// The instance. public OpenIddictServerOwinBuilder SetRealm(string realm) { diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs index f8f8aa53..7b770e9c 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs @@ -241,12 +241,12 @@ public static partial class OpenIddictServerOwinHandlers token, _options.CurrentValue.AuthorizationRequestCachingPolicy); // Create a new GET authorization request containing only the request_id parameter. - var address = WebUtilities.AddQueryString( + var location = WebUtilities.AddQueryString( uri: request.Scheme + Uri.SchemeDelimiter + request.Host + request.PathBase + request.Path, name: Parameters.RequestId, value: context.Request.RequestId); - request.Context.Response.Redirect(address); + request.Context.Response.Redirect(location); // Mark the response as handled to skip the rest of the pipeline. context.HandleRequest(); diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs index cbd2ab88..251321b0 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs @@ -84,8 +84,8 @@ public static partial class OpenIddictServerOwinHandlers var response = context.Transaction.GetOwinRequest()?.Context.Response ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0120)); - // Note: this handler only redirects the user agent to the address specified in - // the properties when there's no error or if the error is an access_denied error. + // Note: this handler only redirects the user agent to the URI specified in the + // properties when there's no error or if the error is an access_denied error. if (!string.IsNullOrEmpty(context.Response.Error) && !string.Equals(context.Response.Error, Errors.AccessDenied, StringComparison.Ordinal)) { diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs index 9a683aaa..4f85c1ea 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs @@ -239,12 +239,12 @@ public static partial class OpenIddictServerOwinHandlers token, _options.CurrentValue.LogoutRequestCachingPolicy); // Create a new GET logout request containing only the request_id parameter. - var address = WebUtilities.AddQueryString( + var location = WebUtilities.AddQueryString( uri: request.Scheme + Uri.SchemeDelimiter + request.Host + request.PathBase + request.Path, name: Parameters.RequestId, value: context.Request.RequestId); - request.Context.Response.Redirect(address); + request.Context.Response.Redirect(location); // Mark the response as handled to skip the rest of the pipeline. context.HandleRequest(); diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs index bd7f57cf..018b8533 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs @@ -91,7 +91,7 @@ public static partial class OpenIddictServerOwinHandlers // sent by the HTTP client) is not desirable as it would affect all requests, including requests // that are not meant to be handled by OpenIddict itself. To avoid that, a fake host is temporarily // used to build an absolute base URI and a request URI that will be used to determine whether the - // received request matches one of the addresses assigned to an OpenIddict endpoint. If the request + // received request matches one of the URIs assigned to an OpenIddict endpoint. If the request // is later handled by OpenIddict, an additional check will be made to require the Host header. (context.BaseUri, context.RequestUri) = request.Host switch diff --git a/src/OpenIddict.Server/OpenIddictServerBuilder.cs b/src/OpenIddict.Server/OpenIddictServerBuilder.cs index 1c4149e8..d52f8acf 100644 --- a/src/OpenIddict.Server/OpenIddictServerBuilder.cs +++ b/src/OpenIddict.Server/OpenIddictServerBuilder.cs @@ -1002,492 +1002,492 @@ public sealed class OpenIddictServerBuilder }); /// - /// Sets the relative or absolute URLs associated to the authorization endpoint. + /// Sets the relative or absolute URIs associated to the authorization endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetAuthorizationEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetAuthorizationEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetAuthorizationEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the authorization endpoint. + /// Sets the relative or absolute URIs associated to the authorization endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetAuthorizationEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetAuthorizationEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.AuthorizationEndpointUris.Clear(); - options.AuthorizationEndpointUris.AddRange(addresses); + options.AuthorizationEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the configuration endpoint. + /// Sets the relative or absolute URIs associated to the configuration endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetConfigurationEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetConfigurationEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetConfigurationEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the configuration endpoint. + /// Sets the relative or absolute URIs associated to the configuration endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetConfigurationEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetConfigurationEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.ConfigurationEndpointUris.Clear(); - options.ConfigurationEndpointUris.AddRange(addresses); + options.ConfigurationEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the cryptography endpoint. + /// Sets the relative or absolute URIs associated to the cryptography endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetCryptographyEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetCryptographyEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetCryptographyEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the cryptography endpoint. + /// Sets the relative or absolute URIs associated to the cryptography endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetCryptographyEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetCryptographyEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.CryptographyEndpointUris.Clear(); - options.CryptographyEndpointUris.AddRange(addresses); + options.CryptographyEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the device endpoint. + /// Sets the relative or absolute URIs associated to the device endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetDeviceEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetDeviceEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetDeviceEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the device endpoint. + /// Sets the relative or absolute URIs associated to the device endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetDeviceEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetDeviceEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.DeviceEndpointUris.Clear(); - options.DeviceEndpointUris.AddRange(addresses); + options.DeviceEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the introspection endpoint. + /// Sets the relative or absolute URIs associated to the introspection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetIntrospectionEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetIntrospectionEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetIntrospectionEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the introspection endpoint. + /// Sets the relative or absolute URIs associated to the introspection endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetIntrospectionEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetIntrospectionEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.IntrospectionEndpointUris.Clear(); - options.IntrospectionEndpointUris.AddRange(addresses); + options.IntrospectionEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the logout endpoint. + /// Sets the relative or absolute URIs associated to the logout endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetLogoutEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetLogoutEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetLogoutEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the logout endpoint. + /// Sets the relative or absolute URIs associated to the logout endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetLogoutEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetLogoutEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.LogoutEndpointUris.Clear(); - options.LogoutEndpointUris.AddRange(addresses); + options.LogoutEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the revocation endpoint. + /// Sets the relative or absolute URIs associated to the revocation endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetRevocationEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetRevocationEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetRevocationEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the revocation endpoint. + /// Sets the relative or absolute URIs associated to the revocation endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetRevocationEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetRevocationEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.RevocationEndpointUris.Clear(); - options.RevocationEndpointUris.AddRange(addresses); + options.RevocationEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the token endpoint. + /// Sets the relative or absolute URIs associated to the token endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetTokenEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetTokenEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetTokenEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the token endpoint. + /// Sets the relative or absolute URIs associated to the token endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetTokenEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetTokenEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.TokenEndpointUris.Clear(); - options.TokenEndpointUris.AddRange(addresses); + options.TokenEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the userinfo endpoint. + /// Sets the relative or absolute URIs associated to the userinfo endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetUserinfoEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetUserinfoEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetUserinfoEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the userinfo endpoint. + /// Sets the relative or absolute URIs associated to the userinfo endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned as part of the discovery document. + /// Note: only the first URI will be returned as part of the discovery document. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetUserinfoEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetUserinfoEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.UserinfoEndpointUris.Clear(); - options.UserinfoEndpointUris.AddRange(addresses); + options.UserinfoEndpointUris.AddRange(uris); }); } /// - /// Sets the relative or absolute URLs associated to the verification endpoint. + /// Sets the relative or absolute URIs associated to the verification endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned by the device endpoint. + /// Note: only the first URI will be returned by the device endpoint. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. public OpenIddictServerBuilder SetVerificationEndpointUris( - [StringSyntax(StringSyntaxAttribute.Uri)] params string[] addresses) + [StringSyntax(StringSyntaxAttribute.Uri)] params string[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - return SetVerificationEndpointUris(addresses.Select(address => new Uri(address, UriKind.RelativeOrAbsolute)).ToArray()); + return SetVerificationEndpointUris(uris.Select(uri => new Uri(uri, UriKind.RelativeOrAbsolute)).ToArray()); } /// - /// Sets the relative or absolute URLs associated to the verification endpoint. + /// Sets the relative or absolute URIs associated to the verification endpoint. /// If an empty array is specified, the endpoint will be considered disabled. - /// Note: only the first address will be returned by the device endpoint. + /// Note: only the first URI will be returned by the device endpoint. /// - /// The addresses associated to the endpoint. + /// The URIs associated to the endpoint. /// The instance. - public OpenIddictServerBuilder SetVerificationEndpointUris(params Uri[] addresses) + public OpenIddictServerBuilder SetVerificationEndpointUris(params Uri[] uris) { - if (addresses is null) + if (uris is null) { - throw new ArgumentNullException(nameof(addresses)); + throw new ArgumentNullException(nameof(uris)); } - if (addresses.Any(address => !address.IsWellFormedOriginalString())) + if (uris.Any(uri => !uri.IsWellFormedOriginalString())) { - throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(addresses)); + throw new ArgumentException(SR.GetResourceString(SR.ID0072), nameof(uris)); } - if (addresses.Any(address => address.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) + if (uris.Any(uri => uri.OriginalString.StartsWith("~", StringComparison.OrdinalIgnoreCase))) { - throw new ArgumentException(SR.FormatID0081("~"), nameof(addresses)); + throw new ArgumentException(SR.FormatID0081("~"), nameof(uris)); } return Configure(options => { options.VerificationEndpointUris.Clear(); - options.VerificationEndpointUris.AddRange(addresses); + options.VerificationEndpointUris.AddRange(uris); }); } @@ -1714,19 +1714,19 @@ public sealed class OpenIddictServerBuilder => Configure(options => options.UserCodeLifetime = lifetime); /// - /// Sets the issuer address, which is used as the value for the "issuer" claim and + /// Sets the issuer URI, which is used as the value of the "issuer" claim and /// is returned from the discovery endpoint to identify the authorization server. /// - /// The issuer address. + /// The issuer uri. /// The instance. - public OpenIddictServerBuilder SetIssuer(Uri address) + public OpenIddictServerBuilder SetIssuer(Uri uri) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - return Configure(options => options.Issuer = address); + return Configure(options => options.Issuer = uri); } /// diff --git a/src/OpenIddict.Server/OpenIddictServerConfiguration.cs b/src/OpenIddict.Server/OpenIddictServerConfiguration.cs index d7d247da..55a6f477 100644 --- a/src/OpenIddict.Server/OpenIddictServerConfiguration.cs +++ b/src/OpenIddict.Server/OpenIddictServerConfiguration.cs @@ -57,7 +57,7 @@ public sealed class OpenIddictServerConfiguration : IPostConfigureOptions /// Populates the property with the specified redirect_uri. /// - /// The redirect_uri to use when redirecting the user agent. - public void SetRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string address) + /// The redirect_uri to use when redirecting the user agent. + public void SetRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string uri) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0100), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0100), nameof(uri)); } // Don't allow validation to alter the redirect_uri parameter extracted - // from the request if the address was explicitly provided by the client. + // from the request if the URI was explicitly provided by the client. if (!string.IsNullOrEmpty(Request?.RedirectUri) && - !string.Equals(Request.RedirectUri, address, StringComparison.Ordinal)) + !string.Equals(Request.RedirectUri, uri, StringComparison.Ordinal)) { throw new InvalidOperationException(SR.GetResourceString(SR.ID0101)); } - RedirectUri = address; + RedirectUri = uri; } } @@ -206,10 +206,10 @@ public static partial class OpenIddictServerEvents public string? Error => Response?.Error; /// - /// Gets or sets the callback URL the user agent will be redirected to, if applicable. + /// Gets or sets the redirect URI the user agent will be redirected to, if applicable. /// Note: manually changing the value of this property is generally not recommended /// and extreme caution must be taken to ensure the user agent is not redirected to - /// an untrusted address, which would result in an "open redirection" vulnerability. + /// an untrusted URI, which would result in an "open redirection" vulnerability. /// public string? RedirectUri { get; set; } diff --git a/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs b/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs index 46975702..df52c5fe 100644 --- a/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs +++ b/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs @@ -87,47 +87,47 @@ public static partial class OpenIddictServerEvents public Dictionary Metadata { get; } = new(StringComparer.Ordinal); /// - /// Gets or sets the issuer address. + /// Gets or sets the issuer URI. /// public Uri? Issuer { get; set; } /// - /// Gets or sets the authorization endpoint address. + /// Gets or sets the authorization endpoint URI. /// public Uri? AuthorizationEndpoint { get; set; } /// - /// Gets or sets the JWKS endpoint address. + /// Gets or sets the JWKS endpoint URI. /// public Uri? CryptographyEndpoint { get; set; } /// - /// Gets or sets the device endpoint address. + /// Gets or sets the device endpoint URI. /// public Uri? DeviceEndpoint { get; set; } /// - /// Gets or sets the introspection endpoint address. + /// Gets or sets the introspection endpoint URI. /// public Uri? IntrospectionEndpoint { get; set; } /// - /// Gets or sets the logout endpoint address. + /// Gets or sets the logout endpoint URI. /// public Uri? LogoutEndpoint { get; set; } /// - /// Gets or sets the revocation endpoint address. + /// Gets or sets the revocation endpoint URI. /// public Uri? RevocationEndpoint { get; set; } /// - /// Gets or sets the token endpoint address. + /// Gets or sets the token endpoint URI. /// public Uri? TokenEndpoint { get; set; } /// - /// Gets or sets the userinfo endpoint address. + /// Gets or sets the userinfo endpoint URI. /// public Uri? UserinfoEndpoint { get; set; } diff --git a/src/OpenIddict.Server/OpenIddictServerEvents.Session.cs b/src/OpenIddict.Server/OpenIddictServerEvents.Session.cs index 03a88aae..ef72363e 100644 --- a/src/OpenIddict.Server/OpenIddictServerEvents.Session.cs +++ b/src/OpenIddict.Server/OpenIddictServerEvents.Session.cs @@ -78,23 +78,23 @@ public static partial class OpenIddictServerEvents /// /// Populates the property with the specified redirect_uri. /// - /// The post_logout_redirect_uri to use when redirecting the user agent. - public void SetPostLogoutRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string address) + /// The post_logout_redirect_uri to use when redirecting the user agent. + public void SetPostLogoutRedirectUri([StringSyntax(StringSyntaxAttribute.Uri)] string uri) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0102), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0102), nameof(uri)); } // Don't allow validation to alter the post_logout_redirect_uri parameter extracted - // from the request if the address was explicitly provided by the client application. + // from the request if the URI was explicitly provided by the client application. if (!string.IsNullOrEmpty(Request?.PostLogoutRedirectUri) && - !string.Equals(Request.PostLogoutRedirectUri, address, StringComparison.Ordinal)) + !string.Equals(Request.PostLogoutRedirectUri, uri, StringComparison.Ordinal)) { throw new InvalidOperationException(SR.GetResourceString(SR.ID0103)); } - PostLogoutRedirectUri = address; + PostLogoutRedirectUri = uri; } } @@ -193,10 +193,10 @@ public static partial class OpenIddictServerEvents public string? Error => Response.Error; /// - /// Gets or sets the callback URL the user agent will be redirected to, if applicable. + /// Gets or sets the post-logout redirect URI the user agent will be redirected to, if applicable. /// Note: manually changing the value of this property is generally not recommended /// and extreme caution must be taken to ensure the user agent is not redirected to - /// an untrusted address, which would result in an "open redirection" vulnerability. + /// an untrusted URI, which would result in an "open redirection" vulnerability. /// public string? PostLogoutRedirectUri { get; set; } } diff --git a/src/OpenIddict.Server/OpenIddictServerEvents.cs b/src/OpenIddict.Server/OpenIddictServerEvents.cs index f8d60c6f..48062d1a 100644 --- a/src/OpenIddict.Server/OpenIddictServerEvents.cs +++ b/src/OpenIddict.Server/OpenIddictServerEvents.cs @@ -266,7 +266,7 @@ public static partial class OpenIddictServerEvents public string? ErrorDescription { get; set; } /// - /// Gets or sets the error URL returned to the caller. + /// Gets or sets the error URI returned to the caller. /// public string? ErrorUri { get; set; } diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs index 1d9db753..e3790530 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs @@ -510,7 +510,7 @@ public static partial class OpenIddictServerHandlers // See http://tools.ietf.org/html/rfc6749#section-3.1.2 // and http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest. // - // Note: on Linux/macOS, "/path" URLs are treated as valid absolute file URLs. + // Note: on Linux/macOS, "/path" URIs are treated as valid absolute file URIs. // To ensure relative redirect_uris are correctly rejected on these platforms, // an additional check using IsWellFormedOriginalString() is made here. // See https://github.com/dotnet/corefx/issues/22098 for more information. @@ -1168,12 +1168,12 @@ public static partial class OpenIddictServerHandlers var application = await _applicationManager.FindByClientIdAsync(context.ClientId) ?? throw new InvalidOperationException(SR.GetResourceString(SR.ID0032)); - // If no explicit redirect_uri was specified, retrieve the addresses associated with - // the client and ensure exactly one redirect_uri was attached to the client definition. + // If no explicit redirect_uri was specified, retrieve the URI associated with the + // client and ensure exactly one redirect_uri was attached to the client definition. if (string.IsNullOrEmpty(context.RedirectUri)) { - var addresses = await _applicationManager.GetRedirectUrisAsync(application); - if (addresses.Length is not 1) + var uris = await _applicationManager.GetRedirectUrisAsync(application); + if (uris.Length is not 1) { context.Logger.LogInformation(SR.GetResourceString(SR.ID6033), Parameters.RedirectUri); @@ -1185,7 +1185,7 @@ public static partial class OpenIddictServerHandlers return; } - context.SetRedirectUri(addresses[0]); + context.SetRedirectUri(uris[0]); return; } @@ -1782,7 +1782,7 @@ public static partial class OpenIddictServerHandlers } /// - /// Contains the logic responsible for inferring the redirect URL + /// Contains the logic responsible for inferring the redirect URI /// used to send the response back to the client application. /// public sealed class AttachRedirectUri : IOpenIddictServerHandler @@ -1905,7 +1905,7 @@ public static partial class OpenIddictServerHandlers /// /// Contains the logic responsible for attaching an "iss" parameter - /// containing the address of the authorization server to the response. + /// containing the URI of the authorization server to the response. /// public sealed class AttachIssuer : IOpenIddictServerHandler { @@ -1928,7 +1928,7 @@ public static partial class OpenIddictServerHandlers } // If the user agent is expected to be redirected to the client application, attach the - // issuer address to the authorization response to help the client detect mix-up attacks. + // issuer URI to the authorization response to help the client detect mix-up attacks. // // Note: this applies to all authorization responses, whether they represent valid or errored responses. // For more information, see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-iss-auth-resp-05. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs index ba3099f6..994b3d3f 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs @@ -341,7 +341,7 @@ public static partial class OpenIddictServerHandlers } /// - /// Contains the logic responsible for attaching the endpoint URLs to the provider discovery document. + /// Contains the logic responsible for attaching the endpoint URIs to the provider discovery document. /// public sealed class AttachEndpoints : IOpenIddictServerHandler { @@ -363,8 +363,8 @@ public static partial class OpenIddictServerHandlers throw new ArgumentNullException(nameof(context)); } - // Note: while OpenIddict allows specifying multiple endpoint addresses, the OAuth 2.0 - // and OpenID Connect discovery specifications only allow a single address per endpoint. + // Note: while OpenIddict allows specifying multiple endpoint URIs, the OAuth 2.0 + // and OpenID Connect discovery specifications only allow a single URI per endpoint. context.AuthorizationEndpoint ??= OpenIddictHelpers.CreateAbsoluteUri( context.BaseUri, context.Options.AuthorizationEndpointUris.FirstOrDefault()); @@ -739,7 +739,7 @@ public static partial class OpenIddictServerHandlers context.Metadata[Metadata.RequestParameterSupported] = false; context.Metadata[Metadata.RequestUriParameterSupported] = false; - // As of 3.2.0, OpenIddict automatically returns an "iss" parameter containing its own address as + // As of 3.2.0, OpenIddict automatically returns an "iss" parameter containing its identity as // part of authorization responses to help clients mitigate mix-up attacks. For more information, // see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-iss-auth-resp-05. context.Metadata[Metadata.AuthorizationResponseIssParameterSupported] = true; diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs index 048292f5..4f0f8a6d 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs @@ -1486,8 +1486,8 @@ public static partial class OpenIddictServerHandlers // if the authorization request didn't contain an explicit redirect_uri. // See https://tools.ietf.org/html/rfc6749#section-4.1.3 // and http://openid.net/specs/openid-connect-core-1_0.html#TokenRequestValidation. - var address = context.Principal.GetClaim(Claims.Private.RedirectUri); - if (string.IsNullOrEmpty(address)) + var uri = context.Principal.GetClaim(Claims.Private.RedirectUri); + if (string.IsNullOrEmpty(uri)) { return default; } @@ -1504,7 +1504,7 @@ public static partial class OpenIddictServerHandlers return default; } - if (!string.Equals(address, context.Request.RedirectUri, StringComparison.Ordinal)) + if (!string.Equals(uri, context.Request.RedirectUri, StringComparison.Ordinal)) { context.Logger.LogInformation(SR.GetResourceString(SR.ID6092), Parameters.RedirectUri); diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs index 0b5b498e..4d9f423a 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs @@ -472,7 +472,7 @@ public static partial class OpenIddictServerHandlers // // * The client_id parameter is supported by the client and was explicitly sent: // in this case, the post_logout_redirect_uris allowed for this client application - // are retrieved from the database: if one of them matches the specified address, + // are retrieved from the database: if one of them matches the specified URI, // the request is considered valid. Otherwise, it's automatically rejected. // // * The client_id parameter is not supported by the client or was not explicitly sent: @@ -514,12 +514,12 @@ public static partial class OpenIddictServerHandlers return; } - async ValueTask ValidatePostLogoutRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string address) + async ValueTask ValidatePostLogoutRedirectUriAsync([StringSyntax(StringSyntaxAttribute.Uri)] string uri) { // To be considered valid, a post_logout_redirect_uri must correspond to an existing client application // that was granted the ept:logout permission, unless endpoint permissions checking was explicitly disabled. - await foreach (var application in _applicationManager.FindByPostLogoutRedirectUriAsync(address)) + await foreach (var application in _applicationManager.FindByPostLogoutRedirectUriAsync(uri)) { if (context.Options.IgnoreEndpointPermissions || await _applicationManager.HasPermissionAsync(application, Permissions.Endpoints.Logout)) @@ -755,12 +755,12 @@ public static partial class OpenIddictServerHandlers } async ValueTask ValidateAuthorizedParty(ClaimsPrincipal principal, - [StringSyntax(StringSyntaxAttribute.Uri)] string address) + [StringSyntax(StringSyntaxAttribute.Uri)] string uri) { // To be considered valid, one of the clients matching the specified post_logout_redirect_uri // must be listed either as an audience or as a presenter in the identity token hint. - await foreach (var application in _applicationManager.FindByPostLogoutRedirectUriAsync(address)) + await foreach (var application in _applicationManager.FindByPostLogoutRedirectUriAsync(uri)) { var identifier = await _applicationManager.GetClientIdAsync(application); if (!string.IsNullOrEmpty(identifier) && (principal.HasAudience(identifier) || @@ -810,7 +810,7 @@ public static partial class OpenIddictServerHandlers } /// - /// Contains the logic responsible for inferring the redirect URL + /// Contains the logic responsible for inferring the redirect URI /// used to send the response back to the client application. /// public sealed class AttachPostLogoutRedirectUri : IOpenIddictServerHandler diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.cs index 508e3437..9432d019 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.cs @@ -106,7 +106,7 @@ public static partial class OpenIddictServerHandlers .AddRange(Userinfo.DefaultHandlers); /// - /// Contains the logic responsible for inferring the endpoint type from the request address. + /// Contains the logic responsible for inferring the endpoint type from the request URI. /// public sealed class InferEndpointType : IOpenIddictServerHandler { @@ -153,14 +153,14 @@ public static partial class OpenIddictServerHandlers return default; - bool Matches(IReadOnlyList addresses) + bool Matches(IReadOnlyList candidates) { - for (var index = 0; index < addresses.Count; index++) + for (var index = 0; index < candidates.Count; index++) { - var address = addresses[index]; - if (address.IsAbsoluteUri) + var candidate = candidates[index]; + if (candidate.IsAbsoluteUri) { - if (Equals(address, context.RequestUri)) + if (Equals(candidate, context.RequestUri)) { return true; } @@ -168,7 +168,7 @@ public static partial class OpenIddictServerHandlers else { - var uri = OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, address); + var uri = OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, candidate); if (uri.IsWellFormedOriginalString() && OpenIddictHelpers.IsBaseOf(context.BaseUri, uri) && Equals(uri, context.RequestUri)) { @@ -3073,16 +3073,15 @@ public static partial class OpenIddictServerHandlers { context.Response.UserCode = context.UserCode; - var address = OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, - context.Options.VerificationEndpointUris.FirstOrDefault()); - if (address is not null) + if (OpenIddictHelpers.CreateAbsoluteUri(context.BaseUri, + context.Options.VerificationEndpointUris.FirstOrDefault()) is Uri uri) { - var builder = new UriBuilder(address) + var builder = new UriBuilder(uri) { Query = string.Concat(Parameters.UserCode, "=", context.UserCode) }; - context.Response[Parameters.VerificationUri] = address.AbsoluteUri; + context.Response[Parameters.VerificationUri] = uri.AbsoluteUri; context.Response[Parameters.VerificationUriComplete] = builder.Uri.AbsoluteUri; } } diff --git a/src/OpenIddict.Server/OpenIddictServerOptions.cs b/src/OpenIddict.Server/OpenIddictServerOptions.cs index 0656c497..14e92f8d 100644 --- a/src/OpenIddict.Server/OpenIddictServerOptions.cs +++ b/src/OpenIddict.Server/OpenIddictServerOptions.cs @@ -16,7 +16,7 @@ namespace OpenIddict.Server; public sealed class OpenIddictServerOptions { /// - /// Gets or sets the optional address used to uniquely identify the authorization server. + /// Gets or sets the optional URI used to uniquely identify the authorization server. /// The URI must be absolute and may contain a path, but no query string or fragment part. /// public Uri? Issuer { get; set; } diff --git a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreBuilder.cs b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreBuilder.cs index 5cc43f4d..17234f81 100644 --- a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreBuilder.cs +++ b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreBuilder.cs @@ -49,7 +49,7 @@ public sealed class OpenIddictValidationAspNetCoreBuilder /// /// Sets the realm returned to the caller as part of the WWW-Authenticate header. /// - /// The issuer address. + /// The realm. /// The instance. public OpenIddictValidationAspNetCoreBuilder SetRealm(string realm) { diff --git a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs index 3ee1c6df..d54bd473 100644 --- a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs +++ b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs @@ -96,7 +96,7 @@ public static partial class OpenIddictValidationAspNetCoreHandlers // sent by the HTTP client) is not desirable as it would affect all requests, including requests // that are not meant to be handled by OpenIddict itself. To avoid that, a fake host is temporarily // used to build an absolute base URI and a request URI that will be used to determine whether the - // received request matches one of the addresses assigned to an OpenIddict endpoint. If the request + // received request matches one of the URIs assigned to an OpenIddict endpoint. If the request // is later handled by OpenIddict, an additional check will be made to require the Host header. (context.BaseUri, context.RequestUri) = request.Host switch diff --git a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinBuilder.cs b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinBuilder.cs index ea1c93d3..fdd69153 100644 --- a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinBuilder.cs +++ b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinBuilder.cs @@ -64,7 +64,7 @@ public sealed class OpenIddictValidationOwinBuilder /// /// Sets the realm returned to the caller as part of the WWW-Authenticate header. /// - /// The issuer address. + /// The realm. /// The instance. public OpenIddictValidationOwinBuilder SetRealm(string realm) { diff --git a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs index 9041fc13..65d4e25b 100644 --- a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs +++ b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs @@ -94,7 +94,7 @@ public static partial class OpenIddictValidationOwinHandlers // sent by the HTTP client) is not desirable as it would affect all requests, including requests // that are not meant to be handled by OpenIddict itself. To avoid that, a fake host is temporarily // used to build an absolute base URI and a request URI that will be used to determine whether the - // received request matches one of the addresses assigned to an OpenIddict endpoint. If the request + // received request matches one of the URIs assigned to an OpenIddict endpoint. If the request // is later handled by OpenIddict, an additional check will be made to require the Host header. (context.BaseUri, context.RequestUri) = request.Host switch diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs index f6ebe726..c312bb0c 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs @@ -37,7 +37,7 @@ public static class OpenIddictValidationSystemNetHttpExtensions builder.Services.TryAdd(OpenIddictValidationSystemNetHttpHandlers.DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor)); // Register the built-in filters used by the default OpenIddict System.Net.Http event handlers. - builder.Services.TryAddSingleton(); + builder.Services.TryAddSingleton(); // Note: TryAddEnumerable() is used here to ensure the initializers are registered only once. builder.Services.TryAddEnumerable(new[] diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs index d9621b9d..29f11ec3 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs @@ -12,9 +12,9 @@ namespace OpenIddict.Validation.SystemNetHttp; public static class OpenIddictValidationSystemNetHttpHandlerFilters { /// - /// Represents a filter that excludes the associated handlers if the metadata address of the issuer is not available. + /// Represents a filter that excludes the associated handlers if the metadata URI of the issuer is not available. /// - public sealed class RequireHttpMetadataAddress : IOpenIddictValidationHandlerFilter + public sealed class RequireHttpMetadataUri : IOpenIddictValidationHandlerFilter { public ValueTask IsActiveAsync(BaseExternalContext context) { @@ -24,8 +24,8 @@ public static class OpenIddictValidationSystemNetHttpHandlerFilters } return new( - string.Equals(context.Address?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || - string.Equals(context.Address?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)); + string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || + string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)); } } } diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs index 8de79b19..f1582426 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs @@ -46,7 +46,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler() .SetOrder(AttachFormParameters.Descriptor.Order - 500) .SetType(OpenIddictValidationHandlerType.BuiltIn) diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs index 9db99571..18612b67 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs @@ -35,7 +35,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MinValue + 100_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -51,7 +51,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers // Store the HttpRequestMessage in the transaction properties. context.Transaction.SetProperty(typeof(HttpRequestMessage).FullName!, - new HttpRequestMessage(HttpMethod.Get, context.Address)); + new HttpRequestMessage(HttpMethod.Get, context.RemoteUri)); return default; } @@ -67,7 +67,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(PrepareGetHttpRequest.Descriptor.Order + 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -83,7 +83,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers // Store the HttpRequestMessage in the transaction properties. context.Transaction.SetProperty(typeof(HttpRequestMessage).FullName!, - new HttpRequestMessage(HttpMethod.Post, context.Address)); + new HttpRequestMessage(HttpMethod.Post, context.RemoteUri)); return default; } @@ -100,7 +100,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(PreparePostHttpRequest.Descriptor.Order + 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -145,7 +145,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(AttachJsonAcceptHeaders.Descriptor.Order + 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -196,7 +196,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(AttachFormParameters.Descriptor.Order - 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -241,7 +241,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -288,7 +288,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(DisposeHttpRequest.Descriptor.Order - 50_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -361,7 +361,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -399,7 +399,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ExtractJsonHttpResponse.Descriptor.Order - 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -538,7 +538,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ExtractWwwAuthenticateHeader.Descriptor.Order - 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -606,7 +606,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(ValidateHttpResponse.Descriptor.Order - 1_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -689,7 +689,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(DisposeHttpResponse.Descriptor.Order - 50_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) @@ -759,7 +759,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers /// public static OpenIddictValidationHandlerDescriptor Descriptor { get; } = OpenIddictValidationHandlerDescriptor.CreateBuilder() - .AddFilter() + .AddFilter() .UseSingletonHandler>() .SetOrder(int.MaxValue - 100_000) .SetType(OpenIddictValidationHandlerType.BuiltIn) diff --git a/src/OpenIddict.Validation/OpenIddictValidationBuilder.cs b/src/OpenIddict.Validation/OpenIddictValidationBuilder.cs index a717aa25..189bb0ec 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationBuilder.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationBuilder.cs @@ -433,40 +433,40 @@ public sealed class OpenIddictValidationBuilder } /// - /// Sets the issuer address, which is used to determine the actual location of the + /// Sets the issuer URI, which is used to determine the actual location of the /// OAuth 2.0/OpenID Connect configuration document when using provider discovery. /// - /// The issuer address. + /// The issuer URI. /// The instance. - public OpenIddictValidationBuilder SetIssuer(Uri address) + public OpenIddictValidationBuilder SetIssuer(Uri uri) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - return Configure(options => options.Issuer = address); + return Configure(options => options.Issuer = uri); } /// - /// Sets the issuer address, which is used to determine the actual location of the + /// Sets the issuer URI, which is used to determine the actual location of the /// OAuth 2.0/OpenID Connect configuration document when using provider discovery. /// - /// The issuer address. + /// The issuer URI. /// The instance. - public OpenIddictValidationBuilder SetIssuer([StringSyntax(StringSyntaxAttribute.Uri)] string address) + public OpenIddictValidationBuilder SetIssuer([StringSyntax(StringSyntaxAttribute.Uri)] string uri) { - if (string.IsNullOrEmpty(address)) + if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException(SR.GetResourceString(SR.ID0126), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0126), nameof(uri)); } - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(uri, UriKind.Absolute, out Uri? value) || !value.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0023), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0023), nameof(uri)); } - return SetIssuer(uri); + return SetIssuer(value); } /// diff --git a/src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs b/src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs index 6c48facd..ebaa60ad 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs @@ -40,11 +40,17 @@ public sealed class OpenIddictValidationConfiguration : IPostConfigureOptions descriptor.ContextType == typeof(ApplyIntrospectionRequestContext))) @@ -52,7 +58,7 @@ public sealed class OpenIddictValidationConfiguration : IPostConfigureOptions( - options.MetadataAddress.AbsoluteUri, new OpenIddictValidationRetriever(_service)) + options.ConfigurationEndpoint.AbsoluteUri, new OpenIddictValidationRetriever(_service)) { AutomaticRefreshInterval = ConfigurationManager.DefaultAutomaticRefreshInterval, RefreshInterval = ConfigurationManager.DefaultRefreshInterval diff --git a/src/OpenIddict.Validation/OpenIddictValidationEvents.cs b/src/OpenIddict.Validation/OpenIddictValidationEvents.cs index 90149c0b..4c5d15f4 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationEvents.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationEvents.cs @@ -130,9 +130,9 @@ public static partial class OpenIddictValidationEvents } /// - /// Gets or sets the address of the external endpoint to communicate with. + /// Gets or sets the URI of the external endpoint to communicate with. /// - public Uri? Address { get; set; } + public Uri? RemoteUri { get; set; } } /// @@ -241,7 +241,7 @@ public static partial class OpenIddictValidationEvents public string? ErrorDescription { get; set; } /// - /// Gets or sets the error URL returned to the caller. + /// Gets or sets the error URI returned to the caller. /// public string? ErrorUri { get; set; } diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs index 16c5bdea..17112453 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs @@ -179,7 +179,7 @@ public static partial class OpenIddictValidationHandlers throw new ArgumentNullException(nameof(context)); } - // Note: the issuer returned in the discovery document must exactly match the URL used to access it. + // Note: the issuer returned in the discovery document must exactly match the URI used to access it. // See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation. var issuer = (string?) context.Response[Metadata.Issuer]; @@ -193,7 +193,7 @@ public static partial class OpenIddictValidationHandlers return default; } - if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri? address)) + if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri? uri)) { context.Reject( error: Errors.ServerError, @@ -204,7 +204,7 @@ public static partial class OpenIddictValidationHandlers } // Ensure the issuer matches the expected value. - if (address != context.Options.Issuer) + if (uri != context.Options.Issuer) { context.Reject( error: Errors.ServerError, @@ -214,14 +214,14 @@ public static partial class OpenIddictValidationHandlers return default; } - context.Configuration.Issuer = address; + context.Configuration.Issuer = uri; return default; } } /// - /// Contains the logic responsible for extracting the JWKS endpoint address from the discovery document. + /// Contains the logic responsible for extracting the JWKS endpoint URI from the discovery document. /// public sealed class ExtractCryptographyEndpoint : IOpenIddictValidationHandler { @@ -245,8 +245,8 @@ public static partial class OpenIddictValidationHandlers // Note: the jwks_uri node is required by the OpenID Connect discovery specification. // See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation. - var address = (string?) context.Response[Metadata.JwksUri]; - if (string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.JwksUri]; + if (string.IsNullOrEmpty(endpoint)) { context.Reject( error: Errors.ServerError, @@ -256,7 +256,7 @@ public static partial class OpenIddictValidationHandlers return default; } - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, @@ -273,7 +273,7 @@ public static partial class OpenIddictValidationHandlers } /// - /// Contains the logic responsible for extracting the introspection endpoint address from the discovery document. + /// Contains the logic responsible for extracting the introspection endpoint URI from the discovery document. /// public sealed class ExtractIntrospectionEndpoint : IOpenIddictValidationHandler { @@ -295,10 +295,10 @@ public static partial class OpenIddictValidationHandlers throw new ArgumentNullException(nameof(context)); } - var address = (string?) context.Response[Metadata.IntrospectionEndpoint]; - if (!string.IsNullOrEmpty(address)) + var endpoint = (string?) context.Response[Metadata.IntrospectionEndpoint]; + if (!string.IsNullOrEmpty(endpoint)) { - if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) + if (!Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) || !uri.IsWellFormedOriginalString()) { context.Reject( error: Errors.ServerError, diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs index 4c5a60c0..dbc08b76 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs @@ -320,7 +320,7 @@ public static partial class OpenIddictValidationHandlers Debug.Assert(!string.IsNullOrEmpty(context.Token), SR.GetResourceString(SR.ID4010)); - // Ensure the introspection endpoint is present and is a valid absolute URL. + // Ensure the introspection endpoint is present and is a valid absolute URI. if (context.Configuration.IntrospectionEndpoint is not { IsAbsoluteUri: true } || !context.Configuration.IntrospectionEndpoint.IsWellFormedOriginalString()) { diff --git a/src/OpenIddict.Validation/OpenIddictValidationOptions.cs b/src/OpenIddict.Validation/OpenIddictValidationOptions.cs index 7a1b69ec..35b14532 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationOptions.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationOptions.cs @@ -79,15 +79,15 @@ public sealed class OpenIddictValidationOptions public bool EnableTokenEntryValidation { get; set; } /// - /// Gets or sets the absolute URL of the OAuth 2.0/OpenID Connect server. + /// Gets or sets the absolute URI of the OAuth 2.0/OpenID Connect server. /// public Uri? Issuer { get; set; } /// - /// Gets or sets the URL of the OAuth 2.0/OpenID Connect server discovery endpoint. - /// When the URL is relative, must be set and absolute. + /// Gets or sets the URI of the configuration endpoint exposed by the server. + /// When the URI is relative, must be set and absolute. /// - public Uri? MetadataAddress { get; set; } + public Uri? ConfigurationEndpoint { get; set; } /// /// Gets or sets the OAuth 2.0/OpenID Connect static server configuration, if applicable. diff --git a/src/OpenIddict.Validation/OpenIddictValidationService.cs b/src/OpenIddict.Validation/OpenIddictValidationService.cs index 232e6af9..22ec6fcd 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationService.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationService.cs @@ -93,21 +93,21 @@ public sealed class OpenIddictValidationService } /// - /// Retrieves the OpenID Connect server configuration from the specified address. + /// Retrieves the OpenID Connect server configuration from the specified URI. /// - /// The address of the remote metadata endpoint. + /// The URI of the remote metadata endpoint. /// The that can be used to abort the operation. /// The OpenID Connect server configuration retrieved from the remote server. - internal async ValueTask GetConfigurationAsync(Uri address, CancellationToken cancellationToken = default) + internal async ValueTask GetConfigurationAsync(Uri uri, CancellationToken cancellationToken = default) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri) + if (!uri.IsAbsoluteUri) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } cancellationToken.ThrowIfCancellationRequested(); @@ -137,7 +137,7 @@ public sealed class OpenIddictValidationService { var context = new PrepareConfigurationRequestContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -157,7 +157,7 @@ public sealed class OpenIddictValidationService { var context = new ApplyConfigurationRequestContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -170,7 +170,7 @@ public sealed class OpenIddictValidationService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6186), context.RemoteUri, context.Request); return context.Request; } @@ -179,7 +179,7 @@ public sealed class OpenIddictValidationService { var context = new ExtractConfigurationResponseContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -194,7 +194,7 @@ public sealed class OpenIddictValidationService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6187), context.RemoteUri, context.Response); return context.Response; } @@ -203,7 +203,7 @@ public sealed class OpenIddictValidationService { var context = new HandleConfigurationResponseContext(transaction) { - Address = address, + RemoteUri = uri, Request = request, Response = response }; @@ -238,19 +238,19 @@ public sealed class OpenIddictValidationService /// /// Retrieves the security keys exposed by the specified JWKS endpoint. /// - /// The address of the remote metadata endpoint. + /// The URI of the remote metadata endpoint. /// The that can be used to abort the operation. /// The security keys retrieved from the remote server. - internal async ValueTask GetSecurityKeysAsync(Uri address, CancellationToken cancellationToken = default) + internal async ValueTask GetSecurityKeysAsync(Uri uri, CancellationToken cancellationToken = default) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri) + if (!uri.IsAbsoluteUri) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } cancellationToken.ThrowIfCancellationRequested(); @@ -281,7 +281,7 @@ public sealed class OpenIddictValidationService { var context = new PrepareCryptographyRequestContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -301,7 +301,7 @@ public sealed class OpenIddictValidationService { var context = new ApplyCryptographyRequestContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -314,7 +314,7 @@ public sealed class OpenIddictValidationService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6188), context.RemoteUri, context.Request); return context.Request; } @@ -323,7 +323,7 @@ public sealed class OpenIddictValidationService { var context = new ExtractCryptographyResponseContext(transaction) { - Address = address, + RemoteUri = uri, Request = request }; @@ -338,7 +338,7 @@ public sealed class OpenIddictValidationService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6189), context.RemoteUri, context.Response); return context.Response; } @@ -379,24 +379,24 @@ public sealed class OpenIddictValidationService } /// - /// Sends an introspection request to the specified address and returns the corresponding principal. + /// Sends an introspection request to the specified URI and returns the corresponding principal. /// - /// The address of the remote metadata endpoint. + /// The URI of the remote metadata endpoint. /// The token to introspect. /// The token type to introspect, used as a hint by the authorization server. /// The that can be used to abort the operation. /// The claims principal created from the claim retrieved from the remote server. internal async ValueTask IntrospectTokenAsync( - Uri address, string token, string? hint, CancellationToken cancellationToken = default) + Uri uri, string token, string? hint, CancellationToken cancellationToken = default) { - if (address is null) + if (uri is null) { - throw new ArgumentNullException(nameof(address)); + throw new ArgumentNullException(nameof(uri)); } - if (!address.IsAbsoluteUri || !address.IsWellFormedOriginalString()) + if (!uri.IsAbsoluteUri || !uri.IsWellFormedOriginalString()) { - throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(address)); + throw new ArgumentException(SR.GetResourceString(SR.ID0144), nameof(uri)); } if (string.IsNullOrEmpty(token)) @@ -435,7 +435,7 @@ public sealed class OpenIddictValidationService { var context = new PrepareIntrospectionRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Request = request, Token = token, @@ -458,7 +458,7 @@ public sealed class OpenIddictValidationService { var context = new ApplyIntrospectionRequestContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Request = request }; @@ -472,7 +472,7 @@ public sealed class OpenIddictValidationService context.Error, context.ErrorDescription, context.ErrorUri); } - context.Logger.LogInformation(SR.GetResourceString(SR.ID6190), context.Address, context.Request); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6190), context.RemoteUri, context.Request); return context.Request; } @@ -481,7 +481,7 @@ public sealed class OpenIddictValidationService { var context = new ExtractIntrospectionResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Request = request }; @@ -497,7 +497,7 @@ public sealed class OpenIddictValidationService Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007)); - context.Logger.LogInformation(SR.GetResourceString(SR.ID6191), context.Address, context.Response); + context.Logger.LogInformation(SR.GetResourceString(SR.ID6191), context.RemoteUri, context.Response); return context.Response; } @@ -506,7 +506,7 @@ public sealed class OpenIddictValidationService { var context = new HandleIntrospectionResponseContext(transaction) { - Address = address, + RemoteUri = uri, Configuration = configuration, Request = request, Response = response, diff --git a/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs b/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs index e95a13c5..207d4d3f 100644 --- a/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs +++ b/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs @@ -269,7 +269,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_RejectsInsecureHttpRequests(string address) + public async Task ProcessRequest_RejectsInsecureHttpRequests(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -283,7 +283,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal(Errors.InvalidRequest, response.Error); @@ -303,7 +303,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_AllowsHandlingResponse(string address) + public async Task ProcessRequest_AllowsHandlingResponse(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -327,7 +327,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal("Bob le Bricoleur", (string?) response["name"]); @@ -345,7 +345,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_AllowsSkippingHandler(string address) + public async Task ProcessRequest_AllowsSkippingHandler(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -364,7 +364,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal("Bob le Magnifique", (string?) response["name"]); diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTestClient.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTestClient.cs index 9ce0c4d9..819cb75c 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTestClient.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTestClient.cs @@ -91,7 +91,7 @@ public class OpenIddictServerIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return GetAsync(new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -123,7 +123,7 @@ public class OpenIddictServerIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return PostAsync(new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -161,7 +161,7 @@ public class OpenIddictServerIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return SendAsync(new HttpMethod(method), uri, request); @@ -189,7 +189,7 @@ public class OpenIddictServerIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return SendAsync(method, new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -222,7 +222,7 @@ public class OpenIddictServerIntegrationTestClient : IAsyncDisposable if (HttpClient.BaseAddress is null && !uri.IsAbsoluteUri) { - throw new ArgumentException("The address cannot be a relative URI when no base address " + + throw new ArgumentException("The URI cannot be a relative URI when no base URI " + "is associated with the HTTP client.", nameof(uri)); } diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs index 23e63a11..d698c31d 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs @@ -222,7 +222,7 @@ public abstract partial class OpenIddictServerIntegrationTests [InlineData("/tmp/file.xml", SR.ID2030)] [InlineData("C:\\tmp\\file.xml", SR.ID2030)] [InlineData("http://www.fabrikam.com/path#param=value", SR.ID2031)] - public async Task ValidateAuthorizationRequest_InvalidRedirectUriCausesAnError(string address, string message) + public async Task ValidateAuthorizationRequest_InvalidRedirectUriCausesAnError(string uri, string message) { // Arrange await using var server = await CreateServerAsync(options => options.EnableDegradedMode()); @@ -232,7 +232,7 @@ public abstract partial class OpenIddictServerIntegrationTests var response = await client.PostAsync("/connect/authorize", new OpenIddictRequest { ClientId = "Fabrikam", - RedirectUri = address, + RedirectUri = uri, Scope = Scopes.OpenId }); @@ -257,7 +257,7 @@ public abstract partial class OpenIddictServerIntegrationTests [InlineData("http://www.fabrikam.com/path?state=abc;iss=value")] [InlineData("http://www.fabrikam.com/path?state=abc&iss")] [InlineData("http://www.fabrikam.com/path?state=abc&iss=value")] - public async Task ValidateAuthorizationRequest_RedirectUriWithIssuerParameterCausesAnError(string address) + public async Task ValidateAuthorizationRequest_RedirectUriWithIssuerParameterCausesAnError(string uri) { // Arrange await using var server = await CreateServerAsync(options => options.EnableDegradedMode()); @@ -267,7 +267,7 @@ public abstract partial class OpenIddictServerIntegrationTests var response = await client.PostAsync("/connect/authorize", new OpenIddictRequest { ClientId = "Fabrikam", - RedirectUri = address, + RedirectUri = uri, Scope = Scopes.OpenId }); diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs index 912a7dc9..83c2feef 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs @@ -134,7 +134,7 @@ public abstract partial class OpenIddictServerIntegrationTests [InlineData("/tmp/file.xml", SR.ID2030)] [InlineData("C:\\tmp\\file.xml", SR.ID2030)] [InlineData("http://www.fabrikam.com/path#param=value", SR.ID2031)] - public async Task ValidateLogoutRequest_InvalidRedirectUriCausesAnError(string address, string message) + public async Task ValidateLogoutRequest_InvalidRedirectUriCausesAnError(string uri, string message) { // Arrange await using var server = await CreateServerAsync(); @@ -143,7 +143,7 @@ public abstract partial class OpenIddictServerIntegrationTests // Act var response = await client.PostAsync("/connect/logout", new OpenIddictRequest { - PostLogoutRedirectUri = address + PostLogoutRedirectUri = uri }); // Assert diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs index 55fe7954..bb09a511 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs @@ -391,7 +391,7 @@ public abstract partial class OpenIddictServerIntegrationTests [InlineData("/custom/connect/token", OpenIddictServerEndpointType.Token)] [InlineData("/custom/connect/userinfo", OpenIddictServerEndpointType.Userinfo)] [InlineData("/custom/connect/verification", OpenIddictServerEndpointType.Verification)] - public async Task ProcessRequest_AllowsOverridingEndpoint(string address, OpenIddictServerEndpointType type) + public async Task ProcessRequest_AllowsOverridingEndpoint(string uri, OpenIddictServerEndpointType type) { // Arrange await using var server = await CreateServerAsync(options => @@ -434,7 +434,7 @@ public abstract partial class OpenIddictServerIntegrationTests await using var client = await server.CreateClientAsync(); // Act - await client.PostAsync(address, new OpenIddictRequest()); + await client.PostAsync(uri, new OpenIddictRequest()); } [Fact] diff --git a/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs b/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs index e489d04d..880b92c2 100644 --- a/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs +++ b/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs @@ -254,7 +254,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_RejectsInsecureHttpRequests(string address) + public async Task ProcessRequest_RejectsInsecureHttpRequests(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -268,7 +268,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal(Errors.InvalidRequest, response.Error); @@ -288,7 +288,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_AllowsHandlingResponse(string address) + public async Task ProcessRequest_AllowsHandlingResponse(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -312,7 +312,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal("Bob le Bricoleur", (string?) response["name"]); @@ -330,7 +330,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte [InlineData("/connect/token")] [InlineData("/connect/userinfo")] [InlineData("/connect/verification")] - public async Task ProcessRequest_AllowsSkippingHandler(string address) + public async Task ProcessRequest_AllowsSkippingHandler(string uri) { // Arrange await using var server = await CreateServerAsync(options => @@ -349,7 +349,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte await using var client = await server.CreateClientAsync(); // Act - var response = await client.PostAsync(address, new OpenIddictRequest()); + var response = await client.PostAsync(uri, new OpenIddictRequest()); // Assert Assert.Equal("Bob le Magnifique", (string?) response["name"]); diff --git a/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs b/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs index 7035bb86..9f8a28ff 100644 --- a/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs +++ b/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs @@ -753,27 +753,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetAuthorizationEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetAuthorizationEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetAuthorizationEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetAuthorizationEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -786,7 +786,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -800,7 +800,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetAuthorizationEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -837,27 +837,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetConfigurationEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetConfigurationEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetConfigurationEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetConfigurationEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -870,7 +870,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -884,7 +884,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetConfigurationEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -921,27 +921,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetCryptographyEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetCryptographyEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetCryptographyEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetCryptographyEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -954,7 +954,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -968,7 +968,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetCryptographyEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1005,27 +1005,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetDeviceEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetDeviceEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetDeviceEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetDeviceEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1038,7 +1038,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1052,7 +1052,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetDeviceEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1089,27 +1089,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetIntrospectionEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetIntrospectionEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetIntrospectionEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetIntrospectionEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1122,7 +1122,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1136,7 +1136,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetIntrospectionEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1173,27 +1173,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetLogoutEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetLogoutEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetLogoutEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetLogoutEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1206,7 +1206,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1220,7 +1220,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetLogoutEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1257,27 +1257,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetRevocationEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetRevocationEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetRevocationEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetRevocationEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1290,7 +1290,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1304,7 +1304,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetRevocationEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1341,27 +1341,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetTokenEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetTokenEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetTokenEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetTokenEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetTokenEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetTokenEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetTokenEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetTokenEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1374,7 +1374,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetTokenEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1388,7 +1388,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetTokenEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1425,27 +1425,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetUserinfoEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetUserinfoEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetUserinfoEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetUserinfoEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1458,7 +1458,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1472,7 +1472,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetUserinfoEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1509,27 +1509,27 @@ public class OpenIddictServerBuilderTests } [Fact] - public void SetVerificationEndpointUris_ThrowsExceptionWhenAddressesIsNull() + public void SetVerificationEndpointUris_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(addresses: (null as Uri[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(uris: (null as Uri[])!)); + Assert.Equal("uris", exception.ParamName); } [Fact] - public void SetVerificationEndpointUris_Strings_ThrowsExceptionWhenAddressesIsNull() + public void SetVerificationEndpointUris_Strings_ThrowsExceptionWhenUrisIsNull() { // Arrange var services = CreateServices(); var builder = CreateBuilder(services); // Act and assert - var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(addresses: (null as string[])!)); - Assert.Equal("addresses", exception.ParamName); + var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(uris: (null as string[])!)); + Assert.Equal("uris", exception.ParamName); } [Theory] @@ -1542,7 +1542,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(new Uri(uri))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.GetResourceString(SR.ID0072), exception.Message); } @@ -1556,7 +1556,7 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetVerificationEndpointUris(new Uri(uri, UriKind.RelativeOrAbsolute))); - Assert.Equal("addresses", exception.ParamName); + Assert.Equal("uris", exception.ParamName); Assert.Contains(SR.FormatID0081("~"), exception.Message); } @@ -1810,11 +1810,11 @@ public class OpenIddictServerBuilderTests // Act and assert var exception = Assert.Throws(() => builder.SetIssuer(null!)); - Assert.Equal("address", exception.ParamName); + Assert.Equal("uri", exception.ParamName); } [Fact] - public void SetIssuer_AddressIsReplaced() + public void SetIssuer_IssuerIsReplaced() { // Arrange var services = CreateServices(); diff --git a/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTestClient.cs b/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTestClient.cs index 819e1454..97a3aafd 100644 --- a/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTestClient.cs +++ b/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTestClient.cs @@ -91,7 +91,7 @@ public class OpenIddictValidationIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return GetAsync(new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -123,7 +123,7 @@ public class OpenIddictValidationIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return PostAsync(new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -161,7 +161,7 @@ public class OpenIddictValidationIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return SendAsync(new HttpMethod(method), uri, request); @@ -189,7 +189,7 @@ public class OpenIddictValidationIntegrationTestClient : IAsyncDisposable if (string.IsNullOrEmpty(uri)) { - throw new ArgumentException("The URL cannot be null or empty.", nameof(uri)); + throw new ArgumentException("The URI cannot be null or empty.", nameof(uri)); } return SendAsync(method, new Uri(uri, UriKind.RelativeOrAbsolute), request); @@ -222,7 +222,7 @@ public class OpenIddictValidationIntegrationTestClient : IAsyncDisposable if (HttpClient.BaseAddress is null && !uri.IsAbsoluteUri) { - throw new ArgumentException("The address cannot be a relative URI when no base address " + + throw new ArgumentException("The URI cannot be a relative URI when no base URI " + "is associated with the HTTP client.", nameof(uri)); }