last ...
This commit is contained in:
@@ -159,7 +159,7 @@ namespace xIds.Controllers
|
|||||||
|
|
||||||
[RequireXPowered]
|
[RequireXPowered]
|
||||||
[HttpGet("Test/HiApiKeyAccess")]
|
[HttpGet("Test/HiApiKeyAccess")]
|
||||||
[Authorize(LocalApi.PolicyName)]
|
// [Authorize(LocalApi.PolicyName)]
|
||||||
[Authorize(Policy = XPolicies.ApiKeyAccess)]
|
[Authorize(Policy = XPolicies.ApiKeyAccess)]
|
||||||
public ActionResult<string> HiApiKeyAccess()
|
public ActionResult<string> HiApiKeyAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
+43
-38
@@ -407,48 +407,53 @@ namespace xIds.DI
|
|||||||
//
|
//
|
||||||
// Adding Requirements ...
|
// Adding Requirements ...
|
||||||
services.AddXIdentityResourceConfiguration(configuration);
|
services.AddXIdentityResourceConfiguration(configuration);
|
||||||
|
|
||||||
//
|
|
||||||
// Create Authentication Builder ...
|
|
||||||
// var authBuilder = services.AddAuthentication();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Authentication Builder ...
|
// Create Authentication Builder ...
|
||||||
var authBuilder = services.AddAuthentication(options =>
|
var authBuilder = services.AddAuthentication();
|
||||||
{
|
|
||||||
//
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If Header Contains Key ...
|
// Create Authentication Builder ...
|
||||||
if (context.Request.Headers.ContainsKey(apiKeyHeader))
|
// var authBuilder = services.AddAuthentication(options =>
|
||||||
{
|
// {
|
||||||
return XAuthenticationScheme.XApiKey.GetStringValue();
|
// //
|
||||||
}
|
// // 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 ...
|
// // If Header Contains Key ...
|
||||||
return XAuthentication.IDENTITY_SERVER_LOCAL_API;
|
// if (context.Request.Headers.ContainsKey(apiKeyHeader))
|
||||||
};
|
// {
|
||||||
}
|
// return XAuthenticationScheme.XApiKey.GetStringValue();
|
||||||
);
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // If not ...
|
||||||
|
// return XAuthentication.IDENTITY_SERVER_LOCAL_API;
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
// authBuilder.AddScheme<AuthenticationSchemeOptions, XApiKeyAuthenticationHandler>(
|
||||||
|
// XAuthenticationScheme.XApiKey.GetStringValue(),
|
||||||
|
// options => { });
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add JwtBearer by Smart Schema ForwardDefaultSelector ...
|
// Add JwtBearer by Smart Schema ForwardDefaultSelector ...
|
||||||
@@ -513,7 +518,7 @@ namespace xIds.DI
|
|||||||
//
|
//
|
||||||
policy.AddAuthenticationSchemes(
|
policy.AddAuthenticationSchemes(
|
||||||
[
|
[
|
||||||
XAuthenticationScheme.XApiKey.GetStringValue(),
|
// XAuthenticationScheme.XApiKey.GetStringValue(),
|
||||||
IdentityServerConstants.LocalApi.AuthenticationScheme
|
IdentityServerConstants.LocalApi.AuthenticationScheme
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user