You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use the OIDC handler's events for lots of advanced functionality (JWT authentication, JAR, PAR, etc). It would be good to add a sample to show how to do so for dynamic providers.
The text was updated successfully, but these errors were encountered:
publicclassConfigureDynamicProviders(IHttpContextAccessor httpContextAccessor):IPostConfigureOptions<OpenIdConnectOptions>{publicvoidPostConfigure(string?name,OpenIdConnectOptionsoptions){
ArgumentNullException.ThrowIfNull(name, nameof(name));if(httpContextAccessor.HttpContext isnull){thrownew InvalidOperationException("No Http Context (are you accidentally trying to configure providers in a background service?)");}// We have to resolve the cache this way because of scopingvarcache= httpContextAccessor.HttpContext.RequestServices.GetRequiredService<DynamicAuthenticationSchemeCache>();varprovider= cache.GetIdentityProvider<OidcProvider>(name);if(provider!=null){
provider.Properties.TryGetValue("custom",outvar custom);// Instantiate an Events object that will do the authentication work you like// options.Events = new PrivateKeyJwtOidcEvents(name, custom)}else{// The cache will miss for any statically configured OIDC providers (if you have a mix of static and dynamic)}}}
We use the OIDC handler's events for lots of advanced functionality (JWT authentication, JAR, PAR, etc). It would be good to add a sample to show how to do so for dynamic providers.
The text was updated successfully, but these errors were encountered: