Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Apr 14, 2024
1 parent 8fe4823 commit cbba35a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,39 @@ https://github.com/dotnet/blazor-samples/tree/main/8.0/BlazorWebAppOidc

## Step 2 Switch the OIDC server

Set this as the used client recommends. If using the default, something like this:

´´´csharp
builder.Services.AddAuthentication(OIDC_SCHEME)
.AddOpenIdConnect(OIDC_SCHEME, options =>
{
// From appsettings.json, keyvault, user-secrets
builder.Configuration.GetSection("OpenIDConnectSettings").Bind(options);
})
.AddCookie();
´´´
> Note
> Each identity provider uses different OIDC configurations and events.
## Step 3 Disable WASM mode

Blazor Web WASM does not support CSP nonces. If you require this, then you need to disable security features.

## Step 4 Add CSP nonce middleware

Blazor Web WASM does not support CSP nonces. If you require this, then you need to disable security features.

## Step 5 Add security headers

Security headers can reduce the attack surface in the application. This is applied as best possible for the tech stack requirements.

´´´csharp
app.UseSecurityHeaders(
SecurityHeadersDefinitions.GetHeaderPolicyCollection(
app.Environment.IsDevelopment(),
app.Configuration["OpenIDConnectSettings:Authority"]));
´´´

## Links

https://github.com/dotnet/blazor-samples/tree/main/8.0/BlazorWebAppOidc
Expand Down

0 comments on commit cbba35a

Please sign in to comment.