-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support AuthenticateWithClaims + local JWT auth in B2B Sessions #147
Conversation
b40f54f
to
5306d17
Compare
stytch/b2b/sessions.go
Outdated
func (c *SessionsClient) AuthenticateJWT( | ||
ctx context.Context, | ||
maxTokenAge time.Duration, | ||
body *sessions.AuthenticateParams, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's define a new AuthenticateJWTParams that includes the maxTokenAge
in it. Otherwise we break parity with the codegen'd endpoint format, and it makes it harder to add new params in the future. For example, RBAC will be adding a new param to AuthenticateJWT
and then we'll be at 4 positional arguments 😢
stytch/b2b/sessions.go
Outdated
} | ||
expires = expires.UTC() | ||
|
||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TO/DONE?
stytch/b2b/sessions_test.go
Outdated
assert.Equal(t, expected, session) | ||
}) | ||
|
||
t.Run("valid JWT (old format)", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to support the old format for B2B?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not! Consequence of copy-pasting tests...
This PR primarily aims to support local JWT auth in B2B Sessions. Along the way, I had to add support for AuthenticateWithClaims.
The
AuthenticateWithClaims
method is autogenerated, which is why you see it popping up nearly everywhere. It gets generated for any function that has aMemberSession
parameter (which happens to be everyAuthenticate
method).There are a few small docs changes tagging along.