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

Add new -AsJWT switch for Bearer/API key authentications #752

Closed
Badgerati opened this issue May 28, 2021 · 0 comments · Fixed by #753
Closed

Add new -AsJWT switch for Bearer/API key authentications #752

Badgerati opened this issue May 28, 2021 · 0 comments · Fixed by #753
Assignees
Milestone

Comments

@Badgerati
Copy link
Owner

Add a new -AsJWT switch to New-PodeAuthScheme for Bearer and API key authentications.

This will work in a similar fashion to the new -AsCredential, where if -AsJWT is supplied, then Pode will attempt to parse the token/key as a JWT, and then pass that object to Add-PodeAuth instead of the token/key:

Bearer:

New-PodeAuthScheme -Bearer -AsJWT | Add-PodeAuth -Name 'Example' -ScriptBlock {
    param($jwt)
}

ApiKey:

New-PodeAuthScheme -ApiKey -AsJWT | Add-PodeAuth -Name 'Example' -ScriptBlock {
    param($jwt)
}

If the token/key fails to parse as a valid JWT, a 400 should be returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant