a05c3aeb85
Added signalR auth
39 lines
1010 B
C#
39 lines
1010 B
C#
using Microsoft.Owin.Security.OAuth;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
|
|
namespace Step.Provider
|
|
{
|
|
public class SignalROAuthBearerProvider : OAuthBearerAuthenticationProvider
|
|
{
|
|
|
|
public override Task RequestToken(OAuthRequestTokenContext context)
|
|
{
|
|
|
|
var token = context.OwinContext.Request.Query["connectionToken"];
|
|
|
|
if (!string.IsNullOrWhiteSpace(token))
|
|
{
|
|
if (context != null)
|
|
{
|
|
context.Token = token;
|
|
base.RequestToken(context);
|
|
}
|
|
}
|
|
return Task.FromResult<object>(null);
|
|
}
|
|
public override Task ValidateIdentity(OAuthValidateIdentityContext context)
|
|
{
|
|
return base.ValidateIdentity(context);
|
|
}
|
|
}
|
|
|
|
class TokenValue
|
|
{
|
|
public string token { get; set; }
|
|
}
|
|
} |