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

Support AuthenticateWithClaims + local JWT auth in B2B Sessions #147

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

logan-stytch
Copy link
Contributor

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 a MemberSession parameter (which happens to be every Authenticate method).

There are a few small docs changes tagging along.

func (c *SessionsClient) AuthenticateJWT(
ctx context.Context,
maxTokenAge time.Duration,
body *sessions.AuthenticateParams,
Copy link
Contributor

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 😢

}
expires = expires.UTC()

// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

TO/DONE?

assert.Equal(t, expected, session)
})

t.Run("valid JWT (old format)", func(t *testing.T) {
Copy link
Contributor

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?

Copy link
Contributor Author

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...

@logan-stytch logan-stytch merged commit d141008 into main Oct 4, 2023
6 checks passed
@logan-stytch logan-stytch deleted the logan/go-b2b-jwt branch October 4, 2023 18:31
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.

2 participants