From 383b1e0f9c7adef35fb0f3988c1dc52d02114dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sun, 14 Aug 2016 13:13:42 +0200 Subject: [PATCH] Introduce parameterless OpenIddictBuilder.EnableEndpoint() extensions --- src/OpenIddict.Core/OpenIddictBuilder.cs | 60 ++++++++++++++++++++--- src/OpenIddict.Core/OpenIddictDefaults.cs | 44 +++++++++++++++++ 2 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 src/OpenIddict.Core/OpenIddictDefaults.cs diff --git a/src/OpenIddict.Core/OpenIddictBuilder.cs b/src/OpenIddict.Core/OpenIddictBuilder.cs index 30272dc3..93c9beeb 100644 --- a/src/OpenIddict.Core/OpenIddictBuilder.cs +++ b/src/OpenIddict.Core/OpenIddictBuilder.cs @@ -490,7 +490,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the authorization endpoint. + /// Enables the authorization endpoint using the default endpoint path (/connect/authorize). + /// + /// The . + public virtual OpenIddictBuilder EnableAuthorizationEndpoint() { + return EnableAuthorizationEndpoint(OpenIddictDefaults.AuthorizationEndpointPath); + } + + /// + /// Enables the authorization endpoint using the specified path. /// /// The relative path of the authorization endpoint. /// The . @@ -499,7 +507,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the introspection endpoint. + /// Enables the introspection endpoint using the default endpoint path (/connect/introspect). + /// + /// The . + public virtual OpenIddictBuilder EnableIntrospectionEndpoint() { + return EnableIntrospectionEndpoint(OpenIddictDefaults.IntrospectionEndpointPath); + } + + /// + /// Enables the introspection endpoint using the specified path. /// /// The relative path of the logout endpoint. /// The . @@ -508,7 +524,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the logout endpoint. + /// Enables the logout endpoint using the default endpoint path (/connect/logout). + /// + /// The . + public virtual OpenIddictBuilder EnableLogoutEndpoint() { + return EnableLogoutEndpoint(OpenIddictDefaults.LogoutEndpointPath); + } + + /// + /// Enables the logout endpoint using the specified path. /// /// The relative path of the logout endpoint. /// The . @@ -517,7 +541,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the revocation endpoint. + /// Enables the revocation endpoint using the default endpoint path (/connect/revoke). + /// + /// The . + public virtual OpenIddictBuilder EnableRevocationEndpoint() { + return EnableRevocationEndpoint(OpenIddictDefaults.RevocationEndpointPath); + } + + /// + /// Enables the revocation endpoint using the specified path. /// /// The relative path of the revocation endpoint. /// The . @@ -526,7 +558,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the token endpoint. + /// Enables the token endpoint using the default endpoint path (/connect/token). + /// + /// The . + public virtual OpenIddictBuilder EnableTokenEndpoint() { + return EnableTokenEndpoint(OpenIddictDefaults.TokenEndpointPath); + } + + /// + /// Enables the token endpoint using the specified path. /// /// The relative path of the token endpoint. /// The . @@ -535,7 +575,15 @@ namespace Microsoft.AspNetCore.Builder { } /// - /// Enables the userinfo endpoint. + /// Enables the userinfo endpoint using the default endpoint path (/connect/userinfo). + /// + /// The . + public virtual OpenIddictBuilder EnableUserinfoEndpoint() { + return EnableUserinfoEndpoint(OpenIddictDefaults.UserinfoEndpointPath); + } + + /// + /// Enables the userinfo endpoint using the specified path. /// /// The relative path of the userinfo endpoint. /// The . diff --git a/src/OpenIddict.Core/OpenIddictDefaults.cs b/src/OpenIddict.Core/OpenIddictDefaults.cs new file mode 100644 index 00000000..62cd235b --- /dev/null +++ b/src/OpenIddict.Core/OpenIddictDefaults.cs @@ -0,0 +1,44 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/openiddict/openiddict-core for more information concerning + * the license and the contributors participating to this project. + */ + +using AspNet.Security.OpenIdConnect.Server; + +namespace OpenIddict { + /// + /// Exposes the default values used by OpenIddict. + /// + public static class OpenIddictDefaults { + /// + /// Default value for . + /// + public const string AuthorizationEndpointPath = "/connect/authorize"; + + /// + /// Default value for . + /// + public const string IntrospectionEndpointPath = "/connect/introspect"; + + /// + /// Default value for . + /// + public const string LogoutEndpointPath = "/connect/logout"; + + /// + /// Default value for . + /// + public const string RevocationEndpointPath = "/connect/revoke"; + + /// + /// Default value for . + /// + public const string TokenEndpointPath = "/connect/token"; + + /// + /// Default value for . + /// + public const string UserinfoEndpointPath = "/connect/userinfo"; + } +}