Blazor WASM cookie security for web APIs#32028
Conversation
JeremyLikness
left a comment
There was a problem hiding this comment.
LGTM. To answer your questions:
- I don't believe we need to say more, and the cross-linking should be fine
- No concerns with showing it for all versions
- That's a great question I'll need to defer to @halter73 to answer
Regards, Jeremy
|
Thanks @JeremyLikness. @halter73 ... The API comment for the delegate provided to In the app ... builder.Services.AddHttpClient(
"Auth",
opt => opt.BaseAddress = new Uri(builder.Configuration["BackendUrl"] ?? "https://localhost:5001"))
.AddHttpMessageHandler<CookieHandler>();builder.Services.AddScoped<CookieHandler>();
I've warmed up the change on ... https://github.com/dotnet/blazor-samples/pull/249/files ... in case it should be transient. |
|
According to the pattern in a couple of Javier sample apps (in his repo), the service reg should be transient. I'm going to go ahead with that choice, which matches the API remarks for |
Fixes #32008
Jeremy ... Three things on this one ...
Do you want to say more than this in the Call web API article? I figure that this along with the Standalone with Identity article (+sample), which is cross-linked here, should be enough. Are there any 😈 gotchas to call out or anything else?
AFAIK, the only versioning that this needs is for the Standalone with Identity article (>=8.0). I think the rest of this always worked. AFAIK, we just didn't have it because we were pushing token auth for just about everything. We have a bit of this in the next section, which is generalized for Fetch API options. We just didn't have it in a dedicated cookie auth section. Anyway, any concerns about showing this for all versions?
The API engineering comment for the handler for
AddHttpMessageHandlerstates emphatically ...... but it's registered scoped ...
What's the story on that? I feel like we need to explain this exception to the rule in the article where I show the service registration.
... and just an FYI that I added a second seeded test user to the sample app and a second roles-authorized endpoint with a page where Leela can call both endpoints and Harry can only call one. dotnet/blazor-samples#241
Internal previews