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

Conversation

Projects
None yet
2 participants
@jiekang
Copy link
Contributor

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?

@raphael
Copy link
Member

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)

This comment has been minimized.

@raphael

raphael Jul 4, 2018

Member

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)

This comment has been minimized.

@raphael

raphael Jul 4, 2018

Member

ditto

@jiekang

This comment has been minimized.

Copy link
Contributor Author

jiekang commented Jul 4, 2018

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

@raphael

This comment has been minimized.

Copy link
Member

raphael commented Jul 5, 2018

Thank you!

@raphael raphael merged commit f2b0d3d into goadesign:v1 Jul 5, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jiekang jiekang referenced this pull request Jul 10, 2018

Closed

Add 1.x.y release tag #1807

@jiekang jiekang deleted the jiekang: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