refactor: move Claims type from auth to new identity package
Extract Claims struct from auth/types.go into dedicated identity package for better separation of concerns. Update all imports and usages across auth service, token handling, and request context utilities.
This commit is contained in:
@@ -5,19 +5,19 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/nexavpn/nexavpn/backend/internal/auth"
|
||||
"github.com/nexavpn/nexavpn/backend/internal/identity"
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
||||
const claimsKey contextKey = "claims"
|
||||
|
||||
func WithClaims(ctx context.Context, claims auth.Claims) context.Context {
|
||||
func WithClaims(ctx context.Context, claims identity.Claims) context.Context {
|
||||
return context.WithValue(ctx, claimsKey, claims)
|
||||
}
|
||||
|
||||
func ClaimsFromContext(ctx context.Context) (auth.Claims, bool) {
|
||||
claims, ok := ctx.Value(claimsKey).(auth.Claims)
|
||||
func ClaimsFromContext(ctx context.Context) (identity.Claims, bool) {
|
||||
claims, ok := ctx.Value(claimsKey).(identity.Claims)
|
||||
return claims, ok
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user