allow Jwt Bear token to be passed as url parameter

main
Paul Schneider 7 years ago
parent 7a305a3df9
commit 1aa4326187
1 changed files with 14 additions and 0 deletions

@ -20,6 +20,7 @@ using OAuth.AspNet.AuthServer;
using OAuth.AspNet.Tokens; using OAuth.AspNet.Tokens;
namespace Yavsc { namespace Yavsc {
using System.Threading.Tasks;
using Auth; using Auth;
using Extensions; using Extensions;
using Helpers.Google; using Helpers.Google;
@ -101,6 +102,19 @@ namespace Yavsc {
options.SecurityTokenValidators.Add (new TicketDataFormatTokenValidator ( options.SecurityTokenValidators.Add (new TicketDataFormatTokenValidator (
ProtectionProvider ProtectionProvider
)); ));
options.Events = new JwtBearerEvents
{
OnReceivingToken = async context =>
{
var signalRTokenHeader = context.Request.Query["signalRTokenHeader"];
if (!string.IsNullOrEmpty(signalRTokenHeader) &&
(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
{
context.Token = context.Request.Query["signalRTokenHeader"];
}
}
};
} }
); );

Loading…