Sort Ordering Usings ...

Using ApiKey Validations and Claims Parsing from Extensions ...
This commit is contained in:
2026-10-30 00:20:01 +03:30
parent bac5d99c66
commit b99b182a1a
3 changed files with 67 additions and 35 deletions
+2 -33
View File
@@ -1,7 +1,5 @@
using System;
using IdentityModel;
using System.Threading;
using xCommons.Constants;
using xCommons.Extensions;
using xExceptions.Constants;
using xIdentityModels.Models;
@@ -9,7 +7,7 @@ using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using xIdentityModels.Constants;
using System.Collections.Generic;
using xIdentityModels.Extensions;
using xIdentityService.Constants;
using xIdentityService.Interfaces;
using Microsoft.AspNetCore.Mvc.Filters;
@@ -156,38 +154,9 @@ namespace xIdentityService.Attributes
return;
}
//
var device = identityService.GetDevice();
var userInfo = await identityService.GetUserInfo(
device: device,
userSelectByParam: validationResponse.OwnerId
);
//
// Creating Claims ...
var claims = new List<Claim> {
//
// Owner Identifier of API Key ...
new(ClaimTypes.Name, validationResponse.OwnerId),
new(JwtClaimTypes.Subject, validationResponse.OwnerId),
//
// Application Id ...
new(XCustomClaims.ApplicationId, validationResponse.ApplicationId.ToString()),
//
// Authentication Type ...
new(XCustomClaims.AuthType, apiKeyAuthentication),
};
//
// Add Scopes ...
if (validationResponse.Scopes != null)
{
//
foreach (var scope in validationResponse.Scopes)
{
claims.Add(new Claim(JwtClaimTypes.Scope, scope));
}
}
var claims = validationResponse.ToXClaims();
//
// Create Principal and Ticket ...