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
*Thefollowingguidancerequiresanauthenticationserverthatsupportsopaque (reference) accesstokens. Currently, MicrosoftEntradoesn't support opaque access token validation.*
915
+
916
+
<xref:Microsoft.Extensions.DependencyInjection.OpenIdConnectExtensions.AddOpenIdConnect%2A>supportsopaquetokensbecauseitdoesn't perform access token validation when configured for Proof Key for Code Exchange (PKCE) authorization code flow. It relies on the ASP.NET Core server'sHTTPSbackchanneltotheOIDCauthenticationservicetoobtaintheIDtokenusingtheauthorizationcodereceivedwhentheuserredirectsbacktotheASP.NETCoreappaftersigningin. IftheappisonlyrequiredtologauserinwithOIDCtogetavalidauthenticationcookie, opaqueaccesstokensaresupportedwithoutmodifyingtheapp.
917
+
918
+
Afailureoccursonlywhentheopaquetokenacquiredby<xref:Microsoft.Extensions.DependencyInjection.OpenIdConnectExtensions.AddOpenIdConnect%2A>ispassedtoanotherservicethatattemptstovalidateitwith <xref:Microsoft.Extensions.DependencyInjection.JwtBearerExtensions.AddJwtBearer%2A>. Unlikeself-containedJWTs, opaquetokensrequirearequesttoanauthorizationservertovalidatetheirstatusandretrieveclaims. Toworkaroundthislimitation, eitheruseathird-partyAPI, suchasthe [DuendeIntrospectionAuthenticationHandler](https://docs.duendesoftware.com/introspection/), or create a [custom `AuthenticationHandler`](xref:security/authentication/index#authentication-handler) to validate the token.
919
+
920
+
> [!IMPORTANT]
921
+
> [DuendeSoftware](https://duendesoftware.com/) isn't owned or controlled by Microsoft and might require you to pay a license fee for production use of the Duende Introspection Authentication Handler.
922
+
923
+
Thefollowing<xref:Microsoft.AspNetCore.Authentication.AuthenticationHandler%601>andassociatedconfigurationandhelpercodeisprovidedasageneralapproach, whichmightrequirefurtherdevelopmenttosuitaspecificauthorizationserver's requirements. The following handler extracts the opaque token from the `Authorization` header for an HTTP call to an authorization server'sintrospectionendpointandcreatesan<xref:Microsoft.AspNetCore.Authentication.AuthenticationTicket>containingtheuser's claims.
924
+
925
+
Callinganauthorizationserver's introspection endpoint requires authentication. The following example relies on setting the client secret for authentication in the request'sAuthorizationheader (base64encodedcredentials) usingthe [SecretManagertool](xref:security/app-secrets) forlocaldevelopmentandtesting.
IftheBlazorserverprojecthasn't been initialized for the Secret Manager tool, use a command shell, such as the Developer PowerShell command shell in Visual Studio, to execute the following command. Before executing the command, change the directory with the `cd` command to the server project'sdirectory. Thecommandestablishesausersecretsidentifier (`<UserSecretsId>` intheserverapp's project file):
932
+
933
+
```dotnetcli
934
+
dotnetuser-secretsinit
935
+
```
936
+
937
+
Executethefollowingcommandtosettheclientsecretfortheauthorizationserver. The `{SECRET}` placeholderistheclientsecret:
0 commit comments