last ...
This commit is contained in:
@@ -13,6 +13,7 @@ using xIdentityService.Constants;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using System.Threading;
|
||||
|
||||
namespace xIds.Providers
|
||||
{
|
||||
@@ -56,7 +57,10 @@ namespace xIds.Providers
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
private async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||
private async Task OnAuthorizationAsync(
|
||||
AuthorizationFilterContext context,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Access HttpContext ...
|
||||
@@ -109,13 +113,20 @@ namespace xIds.Providers
|
||||
//
|
||||
// Extract Client IP ...
|
||||
var clientIP = http.Request.HttpContext.Connection.RemoteIpAddress?.ToString();
|
||||
var scopes =
|
||||
!Scopes.HasChild()
|
||||
? string.Empty
|
||||
: Scopes.ToListString();
|
||||
|
||||
//
|
||||
// Validating ApiKey ...
|
||||
var validationResult = await applicationProvider
|
||||
.ValidateApiKey(
|
||||
apiKey: apiKey,
|
||||
clientIP: clientIP
|
||||
userInfo: null,
|
||||
clientIP: clientIP,
|
||||
requiredScope: scopes,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (validationResult.Errors.HasChild())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user