Skip to content

Commit 3e1f6d0

Browse files
Add Username and preferred_username (#24952)
1 parent ae6cce1 commit 3e1f6d0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

openmetadata-service/src/main/java/org/openmetadata/service/security/jwt/JWTTokenGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public class JWTTokenGenerator {
5252
private static final String EMAIL_CLAIM = "email";
5353
private static final String IS_BOT_CLAIM = "isBot";
5454
public static final String TOKEN_TYPE = "tokenType";
55+
public static final String PREFERRED_USERNAME = "preferred_username";
56+
public static final String USERNAME = "username";
5557
public static final String IMPERSONATED_USER_CLAIM = "impersonatedUser";
5658
private static final JWTTokenGenerator INSTANCE = new JWTTokenGenerator();
5759
private RSAPrivateKey privateKey;
@@ -157,6 +159,8 @@ public JWTAuthMechanism getJwtAuthMechanism(
157159
.withClaim(EMAIL_CLAIM, email)
158160
.withClaim(IS_BOT_CLAIM, isBot)
159161
.withClaim(TOKEN_TYPE, tokenType.value())
162+
.withClaim(USERNAME, userName)
163+
.withClaim(PREFERRED_USERNAME, userName)
160164
.withIssuedAt(new Date(System.currentTimeMillis()))
161165
.withExpiresAt(expires)
162166
.sign(algorithm);

0 commit comments

Comments
 (0)