我希望这里很简单 :) 我有一个 API 的 OAuth 令牌端点,并且一切正常,但是,我想将令牌存储在数据库中。
在.....
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
我有以下代码......
var identity = new ClaimsIdentity(context.Options.AuthenticationType);
identity.AddClaim(new Claim("Username", context.UserName));
identity.AddClaim(new Claim("IpAddress", context.OwinContext.Request.RemoteIpAddress));
identity.AddClaim(new Claim("TokenReceivedDate", DateTime.Now.ToString()));
// Now store the token in the database.
context.Validated(identity);
我可以得到此时要发行的不记名令牌吗?理想情况下,我想将其存储在数据库中以供遗留应用程序获取。挖掘所有对象,任何类似于(可能)持有令牌的对象似乎都是 NULL