Skip to content

Conversation

@guardrex
Copy link
Collaborator

@guardrex guardrex commented Jan 31, 2025

Fixes #34605

cc: @ngboardway ... It's a fairly simple chop-job 🔪 on the "without BFF pattern Auto" pivot. I just cut out the bits about the client project and client-server behaviors here and make a few language changes from "Auto" to "Server" rendering and two projects to one project. Everything else remains the same. I think Stephen will review this today before he takes off OOF. If so, I'll merge it and merge it LIVE ⚡ immediately for quick appearance in the article today.

The sample apps that I put up last night to go with this are at ...

WRT a BFF pivot server sample and "Server" section, we'll consider it if devs ask. Right now, I think we should go with this and see what kind of feedback we get.


Internal previews

📄 File 🔗 Preview link
aspnetcore/blazor/security/blazor-web-app-with-oidc.md aspnetcore/blazor/security/blazor-web-app-with-oidc
aspnetcore/zone-pivot-groups.yml aspnetcore/zone-pivot-groups

@guardrex guardrex requested a review from halter73 January 31, 2025 13:23
@guardrex guardrex self-assigned this Jan 31, 2025
Comment on lines 320 to 324
* <xref:Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.SaveTokens%2A>: Defines whether access and refresh tokens should be stored in the <xref:Microsoft.AspNetCore.Authentication.AuthenticationProperties> after a successful authorization. This property is set to `false` to reduce the size of the final authentication cookie.

```csharp
oidcOptions.SaveTokens = false;
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can only set SaveTokens to false if we aren't using the CookieOidcRefresher because we need the refresh token. It's set to true here in the server project, and the comment here explains more in depth why it's needed.

Suggested change
* <xref:Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.SaveTokens%2A>: Defines whether access and refresh tokens should be stored in the <xref:Microsoft.AspNetCore.Authentication.AuthenticationProperties> after a successful authorization. This property is set to `false` to reduce the size of the final authentication cookie.
```csharp
oidcOptions.SaveTokens = false;
```
* <xref:Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.SaveTokens%2A>: Defines whether access and refresh tokens should be stored in the <xref:Microsoft.AspNetCore.Authentication.AuthenticationProperties> after a successful authorization. This property is set to `true` so the refresh token gets stored for non-interactive token refresh.
```csharp
oidcOptions.SaveTokens = true;

Copy link
Collaborator Author

@guardrex guardrex Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you want it changed on the other spot (without BFF Auto) because the CookieOidcRefresher is in use in that spot as well. I changed it to true with your text.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than the SaveTokens bit.

@guardrex guardrex merged commit 7926160 into main Jan 31, 2025
3 checks passed
@guardrex guardrex deleted the guardrex/blazor-bwa-oidc-server-pivot branch January 31, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a global Server pivot with sample to the article

3 participants