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 support for JWT Token authorization via query parameter #1800

Merged
merged 2 commits into from Jul 5, 2018
Merged

Add support for JWT Token authorization via query parameter #1800

merged 2 commits into from Jul 5, 2018

Conversation

@jiekang
Copy link

@jiekang jiekang commented Jul 4, 2018

This is a backport of #1792 against v1

The cherry-pick via git was not clean so I chose to manually backport it myself. How does it look?

Copy link
Member

@raphael raphael left a comment

Looks great, I left a couple of minor comments

if !strings.HasPrefix(strings.ToLower(val), "bearer ") {
return ErrJWTError(fmt.Sprintf("invalid or malformed %q header, expected 'Authorization: Bearer JWT-token...'", val))
if scheme.In == goa.LocHeader {
incomingToken, err = extractTokenFromHeader(scheme.Name, req)
Copy link
Member

@raphael raphael Jul 4, 2018

This could be written as:

if incomingToken, err = extractTokenFromHeader(scheme.Name, req); err != nil {
    return err
}

return err
}
} else if scheme.In == goa.LocQuery {
incomingToken, err = extractTokenFromQueryParam(scheme.Name, req)
Copy link
Member

@raphael raphael Jul 4, 2018

ditto

@jiekang
Copy link
Author

@jiekang jiekang commented Jul 4, 2018

I've addressed the comments as suggested. Thanks for the review!

@raphael
Copy link
Member

@raphael raphael commented Jul 5, 2018

Thank you!

@raphael raphael merged commit f2b0d3d into goadesign:v1 Jul 5, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jiekang jiekang mentioned this pull request Jul 10, 2018
@jiekang jiekang deleted the v1-jwt-query-param branch Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants