Skip to content

Comments

Add *WithClaims methods to jwt middleware for more advanced usage.#488

Merged
peterbourgon merged 4 commits intogo-kit:masterfrom
cam-stitt:jwt-claims
Mar 16, 2017
Merged

Add *WithClaims methods to jwt middleware for more advanced usage.#488
peterbourgon merged 4 commits intogo-kit:masterfrom
cam-stitt:jwt-claims

Conversation

@cam-stitt
Copy link
Contributor

I started migrating our existing JWT layer to go-kit's version however I was not able to complete the process. We implement a custom jwt.Claims object and need to be able to add middleware layers that use this.

This PR adds some new exported middlewares that allow for advanced claim types.

@cam-stitt
Copy link
Contributor Author

I'm happy with the state of this PR. Would appreciate a review 👍

@peterbourgon
Copy link
Member

I don't have enough context or knowledge of JWT to properly review the semantics here, but the code looks good. Unless @briankassouf wants to object, I'll merge in 48h.

t.Fatal("Claims were not passed into context correctly")
}
if !stdCl.VerifyAudience("go-kit", true) {
t.Fatal("JWT jwt.StandardClaims.Audience did not match: expecting %s got %s", standardClaims.Audience, stdCl.Audience)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Fatalf

@basvanbeek
Copy link
Member

basvanbeek commented Mar 15, 2017

Only one little t.Fatalf but for the rest LGTM.

I do have one potential addition for the middleware_test in highlighting the typical practice of embedding a jwt.StandardClaims struct to create a custom claims type.

I've taken the liberty to add onto this PR and code can be seen here:

master...basvanbeek:jwt-claims

@briankassouf
Copy link
Contributor

This change looks good to me!

@peterbourgon peterbourgon merged commit c9c7219 into go-kit:master Mar 16, 2017
@peterbourgon
Copy link
Member

Thanks @cam-stitt and everyone!

jamesgist pushed a commit to jamesgist/kit that referenced this pull request Nov 1, 2024
Add *WithClaims methods to jwt middleware for more advanced usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants