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

added RawAttributes interface #162

Merged
merged 3 commits into from
Dec 8, 2020
Merged

added RawAttributes interface #162

merged 3 commits into from
Dec 8, 2020

Conversation

j-mai
Copy link
Contributor

@j-mai j-mai commented Dec 3, 2020

This PR allows for talaria to get all of a JWT's claims from an Attribute.

Fixes #161

@guardrails
Copy link

guardrails bot commented Dec 3, 2020

⚠️ We detected security issues in this pull request:

Vulnerable Libraries (2)

More info on how to fix Vulnerable Libraries in Go.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

Copy link
Member

@kcajmagic kcajmagic left a comment

Choose a reason for hiding this comment

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

looks good, just a couple of minor changes.

middleware.go Outdated Show resolved Hide resolved
mocks_test.go Outdated Show resolved Hide resolved
tokenFactory_test.go Outdated Show resolved Hide resolved
tokenFactory_test.go Outdated Show resolved Hide resolved
tokenFactory_test.go Outdated Show resolved Hide resolved
@j-mai j-mai requested a review from kcajmagic December 7, 2020 21:15
Copy link
Member

@kcajmagic kcajmagic left a comment

Choose a reason for hiding this comment

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

Awesome, looks good.

Copy link
Contributor

@kristinapathak kristinapathak left a comment

Choose a reason for hiding this comment

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

Just one question - not sure about the desired middleware functionality.

middleware.go Outdated
@@ -23,7 +23,9 @@ func DeviceMetadataMiddleware(delegate http.Handler) http.Handler {
metadata.SetSessionID(ksuid.New().String())

if auth, ok := bascule.FromContext(ctx); ok {
metadata.SetClaims(auth.Token.Attributes().FullView())
if tokenAttributes, ok := auth.Token.Attributes().(rawAttributes); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to be casting to the interface or the struct? Currently this is the struct, not the interface.

Also - what should happen if it isn't ok? It's fine to continue after we find a bascule token that wasn't a RawAttributes like we expected?

Copy link
Contributor

@kristinapathak kristinapathak left a comment

Choose a reason for hiding this comment

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

looks good 💯

@kcajmagic kcajmagic changed the title Raw Attributes added RawAttributes interface Dec 8, 2020
@kcajmagic kcajmagic merged commit 1473168 into xmidt-org:main Dec 8, 2020
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.

Custom Token Factory and AllClaims Interface
3 participants