Browse Source

Merge pull request #24598 from abpframework/CheckTokenExpiration

Support dynamic client credentials in token introspection
pull/24615/head
Engincan VESKE 4 weeks ago
committed by GitHub
parent
commit
603fe8cef2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs

9
framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs

@ -46,11 +46,14 @@ public static class CookieAuthenticationOptionsExtensions
{
var openIdConnectOptions = await GetOpenIdConnectOptions(principalContext, oidcAuthenticationScheme);
var clientId = principalContext.Properties.GetString("client_id");
var clientSecret = principalContext.Properties.GetString("client_secret");
var response = await openIdConnectOptions.Backchannel.IntrospectTokenAsync(new TokenIntrospectionRequest
{
Address = openIdConnectOptions.Configuration?.IntrospectionEndpoint ?? openIdConnectOptions.Authority!.EnsureEndsWith('/') + "connect/introspect",
ClientId = openIdConnectOptions.ClientId!,
ClientSecret = openIdConnectOptions.ClientSecret,
ClientId = clientId ?? openIdConnectOptions.ClientId!,
ClientSecret = clientSecret ?? openIdConnectOptions.ClientSecret,
Token = accessToken
});
@ -82,7 +85,7 @@ public static class CookieAuthenticationOptionsExtensions
return options;
}
private async static Task<OpenIdConnectOptions> GetOpenIdConnectOptions(CookieValidatePrincipalContext principalContext, string oidcAuthenticationScheme)
private static async Task<OpenIdConnectOptions> GetOpenIdConnectOptions(CookieValidatePrincipalContext principalContext, string oidcAuthenticationScheme)
{
var openIdConnectOptions = principalContext.HttpContext.RequestServices.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(oidcAuthenticationScheme);
var cancellationTokenProvider = principalContext.HttpContext.RequestServices.GetRequiredService<ICancellationTokenProvider>();

Loading…
Cancel
Save