Browse Source

fix(iam/ldap): populate standard TokenClaims fields in ValidateToken

- Set Subject, Issuer, Audience, IssuedAt, and ExpiresAt to satisfy the interface
- Use time.Time for timestamps as required by TokenClaims struct
- Default to 1 hour TTL for LDAP tokens
pull/8003/head
Chris Lu 23 hours ago
parent
commit
113ccbfe4a
  1. 10
      weed/iam/ldap/ldap_provider.go

10
weed/iam/ldap/ldap_provider.go

@ -554,8 +554,16 @@ func (p *LDAPProvider) ValidateToken(ctx context.Context, token string) (*provid
return nil, err
}
// Populate standard TokenClaims fields for interface compliance
now := time.Now()
ttl := 1 * time.Hour // Default TTL for LDAP tokens
return &providers.TokenClaims{
Subject: identity.UserID,
Subject: identity.UserID,
Issuer: p.name,
Audience: p.name,
IssuedAt: now,
ExpiresAt: now.Add(ttl),
Claims: map[string]interface{}{
"email": identity.Email,
"name": identity.DisplayName,

Loading…
Cancel
Save