Skip to content

Allow extend for validating token format or something else #2

@enif-lee

Description

@enif-lee

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions