Skip to content

Commit f2befd1

Browse files
guardrexCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com>
1 parent 0c088e3 commit f2befd1

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

aspnetcore/blazor/security/blazor-web-app-with-oidc.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ At this point, Razor components can adopt [role-based and policy-based authoriza
14671467

14681468
## Opaque (reference) access token support
14691469

1470-
*The following guidance requires an authentication server that supports opaque (reference) access token support. Currently, Microsoft Entra doesn't support opaque access token validation.*
1470+
*The following guidance requires an authentication server that supports opaque (reference) access tokens. Currently, Microsoft Entra doesn't support opaque access token validation.*
14711471

14721472
<xref:Microsoft.Extensions.DependencyInjection.OpenIdConnectExtensions.AddOpenIdConnect%2A> supports opaque tokens because it doesn'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's HTTPS backchannel to the OIDC authentication service to obtain the ID token using the authorization code received when the user redirects back to the ASP.NET Core app after signing in. If the app is only required to log a user in with OIDC to get a valid authentication cookie, opaque access tokens are supported without modifying the app.
14731473

@@ -1541,7 +1541,7 @@ public class OpaqueTokenAuthenticationOptions : AuthenticationSchemeOptions
15411541
}
15421542
```
15431543

1544-
`OpaqueTokenAuthenticationHandler.cs`:
1544+
`Authentication/OpaqueTokenAuthenticationHandler.cs`:
15451545

15461546
```csharp
15471547
using System.Net.Http.Headers;
@@ -1550,10 +1550,9 @@ using System.Text.Encodings.Web;
15501550
using System.Text.Json;
15511551
using Microsoft.AspNetCore.Authentication;
15521552
using Microsoft.Extensions.Options;
1553-
using MinimalApiJwt.Authentication;
15541553
using MinimalApiJwt.Extensions;
15551554

1556-
namespace MinimalApiJwt.Services;
1555+
namespace MinimalApiJwt.Authentication;
15571556

15581557
public class OpaqueTokenAuthenticationHandler(
15591558
IOptionsMonitor<OpaqueTokenAuthenticationOptions> options,
@@ -1593,8 +1592,8 @@ public class OpaqueTokenAuthenticationHandler(
15931592
or any other configuration source.
15941593
*/
15951594

1596-
var introspectionUri = "{AUTH SERVER INTROSPECTION URI}";
1597-
var clientId = "{API CLIENT ID}";
1595+
var introspectionUri = options.IntrospectionEndpoint;
1596+
var clientId = options.ClientId;
15981597
var clientSecret = config["Authentication:Schemes:AuthServer:ClientSecret"];
15991598

16001599
using var client = new HttpClient();

0 commit comments

Comments
 (0)