Closed pablopioli closed 4 years ago
In special I would like to know where this redirection comes from
About the redirections, for both the redirect and popup interaction modes, they're automatically configured calling this method: https://github.com/sotsera/sotsera.blazor.oidc/blob/085d8276447f30118928440b958690c625450485/src/Sotsera.Blazor.Oidc/OidcSettings.cs#L103-L118 It uses the default redirect assets which are:
You can copy those assets in your application and then configure the client to use them like in the UseDefaultCallbackUris.
For the hosting I'm currently using Github pages so the the javascript code you saw in the sample application is used for tricking their web server redirecting any route not found in the application to the index file. Using asp.net core I would probably use the same endpoint configuration used by the Hosted project type:
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
endpoints.MapFallbackToClientSideBlazor<WebUi.Startup>("index.html");
});
And using an asp.net core project I would also add the dll compression which currently Github pages are not supporting (at least for their content type): this was the reason I tried to use docker with Nginx but then my azure trial expired so I went back to Github pages and forgot to remove those configuration files :smile:
The nginx rule I used is try_files $uri $uri/ /index.html =404;
. It looks for a route as an existing resource, then it looks at it as a folder then it redirects to the index file in the root of the site otherwise it returns a 404. Basically this is what it's done in asp.net by the snippet I posted above.
I see the Github pages trick is documented in https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/webassembly?view=aspnetcore-3.1#github-pages
Will try to make it work in Net core.
I have built a sample app on how to include the blazor app in a ASP.Net core app acting as an static host.
https://github.com/pablopioli/Samples-BlazorOpenIdConnect
Hope it can be useful as an starting point. I see it as an interest option to distribute blazor apps outside a regular web host.
I missed this comment.. Thanks for this sample!
You're welcome. Your library is very useful, it's the minimum I can contribute.
I'm trying hosting options for a Blazor Wasm app.
You are using a Dockerfile that uses Nginx, so I tried to serve the sample app from a static ASP.Net core app. https://github.com/pablopioli/Samples-BlazorOpenIdConnect
Popup login works without problems, but redirection login doesn't works. I studied the redirections you do in the demo site and tried to emulate them with a middleware. No luck at all.
Official guidance on how to host the app would be useful.