Files
xSaherelmWorkspace/Documents/Codes/Bkp_AddAuthentication_IDS.cs
2026-10-11 17:38:28 +03:30

49 lines
2.1 KiB
C#

//
// 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();
// //
// // If Header Contains Key ...
// if (context.Request.Headers.ContainsKey(apiKeyHeader))
// {
// return XAuthenticationScheme.XApiKey.GetStringValue();
// }
// //
// // If not ...
// return XAuthentication.IDENTITY_SERVER_LOCAL_API;
// };
// }
// );
// //
// // For Best Support we Have to Add ApiKey Authentication First ...
// if (addApiKeyAuthentication)
// {
// //
// authBuilder
// .AddScheme<AuthenticationSchemeOptions, XApiKeyAuthenticationHandler>(
// XAuthenticationScheme.XApiKey.GetStringValue(),
// options => { });
// }