//<summary>
//验证Token
//</summary>
//<param name="context">上下文</param>
//<returns></returns>
public override async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
{
var request = new OAuthRequestTokenContext(context.OwinContext, context.Token);
var ticket = new AuthenticationTicket(new ClaimsIdentity(), new AuthenticationProperties
{
IssuedUtc = DateTime.UtcNow.AddYears(-1),
ExpiresUtc = DateTime.UtcNow.AddYears(-1)
});
if (request.Token.IsNullOrEmpty())
{
context.SetTicket(ticket);
}
//验证Token是否过期
var vaild = await _clientAuthorizationService.VaildOAuthClientSecretAsync(context.Token);
if (vaild)
{
context.SetTicket(ticket);
}
}
重写此方法发现带着token 请求api的时候并不进此方法,难道要从api层从header里取吗?
楼主实现了 如何自定义验证access_token吗?
我也有这个疑问,不知道楼主有没有找到答案,可否分享下?