Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extend for validating token format or something else #2

Open
enif-lee opened this issue Jul 29, 2020 · 0 comments
Open

Allow extend for validating token format or something else #2

enif-lee opened this issue Jul 29, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@enif-lee
Copy link
Contributor

var scheme = Options.Scheme;
if (authPair.Count != 2)
return Fail("invalid_format", $"Authorization must be formatted as '{scheme} <token>'");
if (authPair[0] != Scheme.Name)
return Fail("invalid_scheme", $"Scheme must be {scheme}");
if (authPair[1].Length != Options.TokenLength)
return Fail("invalid_token_length", $"Access Token`s length must be {Options.TokenLength}");
var accessToken = authPair[1];
try
{
if (!await _authService.IsValidateAsync(accessToken))
return Fail("invalid_token", $"{scheme} Token({accessToken}) is invalid");
}
catch (AuthenticationFailException e)
{
return AuthenticateResult.Fail(e);
}

  • How to validating string complexity for access token?
@enif-lee enif-lee added the enhancement New feature or request label Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant