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

feat: enhance session response #2003

Merged
merged 2 commits into from
Jan 16, 2025
Merged

feat: enhance session response #2003

merged 2 commits into from
Jan 16, 2025

Conversation

bjoern-m
Copy link
Contributor

@bjoern-m bjoern-m commented Dec 12, 2024

Description

This PR introduces improvements to the session validation process, focusing on extracting claims from JWT tokens.

Implementation

  • dto/session.go:

    • Added a new Claims struct to represent JWT claims, providing a standardized structure for parsing token data.
    • Implemented GetClaimsFromToken function for parsing and validating JWT token claims.
    • Updated ValidateSessionResponse to include the Claims field while keeping deprecated fields (ExpirationTime, UserID) for backward compatibility.
  • handler/session.go:

    • Replaced manual token parsing with GetClaimsFromToken for extracting claims.
    • Simplified logic in ValidateSession and ValidateSessionFromBody handlers:
      • Validated session IDs and claims directly.
      • Updated response payload to use the new Claims structure.

Todos

  • Deprecate usage of ExpirationTime and UserID in the SDK and migrate to the new structure.

Additional Context

This PR relates the the changes made in the docs: teamhanko/docs#110

@bjoern-m bjoern-m force-pushed the feat-enhance-session-response branch from 9ec7c54 to b9c6d27 Compare December 30, 2024 11:05
@bjoern-m bjoern-m marked this pull request as ready for review December 30, 2024 11:28
@bjoern-m bjoern-m merged commit b8c4771 into main Jan 16, 2025
8 checks passed
@bjoern-m bjoern-m deleted the feat-enhance-session-response branch January 16, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants