mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
Things to get around CORS pre-flight request. Allow Jwt token to be passed via "access_token" query stirng param. Allow JSON body content to be parsed as "text/plain" content type.
This commit is contained in:
@ -49,7 +49,8 @@ namespace Bit.Core.Identity
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
OnTokenValidated = JwtBearerEventImplementations.ValidatedTokenAsync,
|
||||
OnAuthenticationFailed = JwtBearerEventImplementations.AuthenticationFailedAsync
|
||||
OnAuthenticationFailed = JwtBearerEventImplementations.AuthenticationFailedAsync,
|
||||
OnMessageReceived = JwtBearerEventImplementations.MessageReceivedAsync
|
||||
};
|
||||
|
||||
app.UseJwtBearerAuthentication(options);
|
||||
|
@ -49,5 +49,15 @@ namespace Bit.Core.Identity
|
||||
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public static Task MessageReceivedAsync(MessageReceivedContext context)
|
||||
{
|
||||
if(!context.Request.Headers.ContainsKey("Authorization"))
|
||||
{
|
||||
context.Token = context.Request.Query["access_token"];
|
||||
}
|
||||
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user