I have a Middleware
which performs an authentification and should then reroute to a Blazor
web application.
The problem is that I get the token
put in the request query and I want it in the body of the request.
Middleware:
public async Task Invoke(HttpContext context) {
string token = context.Request.Query["token"];
if (!context.User.Identity.IsAuthenticated) {
//do some logic to authenticate
}
else
await this.next(context);
}
Configure:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseResponseCompression();
app.UseAuthentication();
app.UseMiddleware<MultiAuthWare>();
app.UseMvc(routes => {
routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
});
app.UseBlazor<Client.Startup>();
}
Blazor entry point:
The server redirects to : http://localhost:[portno]/?token=[a string]
and I do not know why.Any who i have tried setting both routes for the entry page of Blazor
and it does not load it.
@page "/"
@page "/?token={token}"
@inherits HomeBase
@functions()
{
}
PS: I do not understand why does the server put the token
in the query string ?