Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public UserTokenValueProvider(string userToken, string issuerToken, IReadTokenService readTokenService)
{
_userToken = userToken;
_issuerToken = issuerToken;
_readTokenService = readTokenService;
}
public async Task<object> GetValueAsync()
{
try
{
var readResult = _readTokenService.ReadToken(_userToken);
return new UserTokenResult { Username = readResult.Username, TokenState = TokenState.Valid };
}
catch (ArgumentNullException)
{
// token not provided
return new UserTokenResult { TokenState = TokenState.Empty };
}
catch
{
// token was bad
return new UserTokenResult { TokenState = TokenState.Invalid };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.