46c34f46e8
* WIP signalauth * Fist commit server config
31 lines
788 B
C#
31 lines
788 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 Groupadoo.Web.Providers
|
|
{
|
|
public class SignalROAuthBearerProvider : OAuthBearerAuthenticationProvider
|
|
{
|
|
|
|
public override Task RequestToken(OAuthRequestTokenContext context)
|
|
{
|
|
var token = context.OwinContext.Request.Query["connectionToken"];
|
|
if (!string.IsNullOrWhiteSpace(token))
|
|
{
|
|
var result = JsonConvert.DeserializeObject<TokenValue>(token);
|
|
if (context != null && result != null)
|
|
context.Token = result.token;
|
|
}
|
|
return Task.FromResult<object>(null);
|
|
}
|
|
}
|
|
|
|
class TokenValue
|
|
{
|
|
public string token { get; set; }
|
|
}
|
|
} |