This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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