diff --git a/Controllers/Account/AccountController+Test.cs b/Controllers/Account/AccountController+Test.cs index a720e5c..029283c 100644 --- a/Controllers/Account/AccountController+Test.cs +++ b/Controllers/Account/AccountController+Test.cs @@ -159,7 +159,7 @@ namespace xIds.Controllers [RequireXPowered] [HttpGet("Test/HiApiKeyAccess")] - [Authorize(LocalApi.PolicyName)] + // [Authorize(LocalApi.PolicyName)] [Authorize(Policy = XPolicies.ApiKeyAccess)] public ActionResult HiApiKeyAccess() { diff --git a/DI/XDIHelperExtension.cs b/DI/XDIHelperExtension.cs index 53162ad..7845ad2 100644 --- a/DI/XDIHelperExtension.cs +++ b/DI/XDIHelperExtension.cs @@ -407,48 +407,53 @@ namespace xIds.DI // // Adding Requirements ... services.AddXIdentityResourceConfiguration(configuration); - - // - // Create Authentication Builder ... - // var authBuilder = services.AddAuthentication(); // // Create Authentication Builder ... - var authBuilder = services.AddAuthentication(options => - { - // - // Setting Default Authentication Schema ... - // For Handling Smart Schema Forwarder ... - options.DefaultScheme = XAuthentication.SMART_SCHEME; - options.DefaultChallengeScheme = XAuthentication.SMART_SCHEME; - options.DefaultAuthenticateScheme = XAuthentication.SMART_SCHEME; - }) - .AddPolicyScheme( - authenticationScheme: XAuthentication.SMART_SCHEME, - displayName: XAuthentication.SMART_SCHEME, - configureOptions: options => - { - // - // Configure Forward Default Selector ... - options.ForwardDefaultSelector = context => - { - // - // Retrieve XApiKey Header Key ... - var apiKeyHeader = XHeader.ApiKey.GetStringValue(); + var authBuilder = services.AddAuthentication(); - // - // If Header Contains Key ... - if (context.Request.Headers.ContainsKey(apiKeyHeader)) - { - return XAuthenticationScheme.XApiKey.GetStringValue(); - } + // + // Create Authentication Builder ... + // var authBuilder = services.AddAuthentication(options => + // { + // // + // // Setting Default Authentication Schema ... + // // For Handling Smart Schema Forwarder ... + // options.DefaultScheme = XAuthentication.SMART_SCHEME; + // options.DefaultChallengeScheme = XAuthentication.SMART_SCHEME; + // options.DefaultAuthenticateScheme = XAuthentication.SMART_SCHEME; + // }) + // .AddPolicyScheme( + // displayName: XAuthentication.SMART_SCHEME, + // authenticationScheme: XAuthentication.SMART_SCHEME, + // configureOptions: options => + // { + // // + // // Configure Forward Default Selector ... + // options.ForwardDefaultSelector = context => + // { + // // + // // Retrieve XApiKey Header Key ... + // var apiKeyHeader = XHeader.ApiKey.GetStringValue(); - // - // If not ... - return XAuthentication.IDENTITY_SERVER_LOCAL_API; - }; - } - ); + // // + // // If Header Contains Key ... + // if (context.Request.Headers.ContainsKey(apiKeyHeader)) + // { + // return XAuthenticationScheme.XApiKey.GetStringValue(); + // } + + // // + // // If not ... + // return XAuthentication.IDENTITY_SERVER_LOCAL_API; + // }; + // } + // ); + + // + // authBuilder.AddScheme( + // XAuthenticationScheme.XApiKey.GetStringValue(), + // options => { }); // // Add JwtBearer by Smart Schema ForwardDefaultSelector ... @@ -513,7 +518,7 @@ namespace xIds.DI // policy.AddAuthenticationSchemes( [ - XAuthenticationScheme.XApiKey.GetStringValue(), + // XAuthenticationScheme.XApiKey.GetStringValue(), IdentityServerConstants.LocalApi.AuthenticationScheme ]);