本文整理匯總了C#中AuthRepository.FindRefreshToken方法的典型用法代碼示例。如果您正苦於以下問題:C# AuthRepository.FindRefreshToken方法的具體用法?C# AuthRepository.FindRefreshToken怎麽用?C# AuthRepository.FindRefreshToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AuthRepository
的用法示例。
在下文中一共展示了AuthRepository.FindRefreshToken方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReceiveAsync
public async Task ReceiveAsync(AuthenticationTokenReceiveContext context) {
var allowedOrigin = context.OwinContext.Get<string>("as:clientAllowedOrigin");
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { allowedOrigin });
string hashedTokenId = Helper.GetHash(context.Token);
using (AuthRepository repo = new AuthRepository()) {
var refreshToken = await repo.FindRefreshToken(hashedTokenId);
if (refreshToken != null) {
//Get protectedTicket from refreshToken class
context.DeserializeTicket(refreshToken.ProtectedTicket);
var result = await repo.RemoveRefreshToken(hashedTokenId);
}
}
}
示例2: ReceiveAsync
public async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
{
try
{
string hashedTokenId = Hash.Get(context.Token);
using (AuthRepository _repo = new AuthRepository())
{
var refreshToken = _repo.FindRefreshToken(hashedTokenId);
if (refreshToken != null)
{
context.DeserializeTicket(refreshToken.ProtectedTicket);
var result = await _repo.RemoveRefreshToken(hashedTokenId);
}
}
}
catch (Exception ex)
{
Helper.ErroLogging.LogError(ex);
}
}