mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 08:50:18 +00:00
Minor: Revert JWT Filter changes to extract username (#14607)
This commit is contained in:
parent
d513dc4d4d
commit
a41a341aca
@ -14,7 +14,6 @@
|
||||
package org.openmetadata.service.security;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
import static org.openmetadata.service.security.jwt.JWTTokenGenerator.SUBJECT_CLAIM;
|
||||
import static org.openmetadata.service.security.jwt.JWTTokenGenerator.TOKEN_TYPE;
|
||||
|
||||
import com.auth0.jwk.Jwk;
|
||||
@ -184,12 +183,6 @@ public class JwtFilter implements ContainerRequestFilter {
|
||||
|
||||
@SneakyThrows
|
||||
public String validateAndReturnUsername(Map<String, Claim> claims) {
|
||||
// Get username from JWT token
|
||||
String claimUserName = "";
|
||||
if (!Objects.isNull(claims.get(SUBJECT_CLAIM))) {
|
||||
claimUserName = claims.get(SUBJECT_CLAIM).as(TextNode.class).asText();
|
||||
}
|
||||
|
||||
// Get email from JWT token
|
||||
String jwtClaim =
|
||||
jwtPrincipalClaims.stream()
|
||||
@ -213,11 +206,6 @@ public class JwtFilter implements ContainerRequestFilter {
|
||||
domain = StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
// Prefer userName over email
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(claimUserName)) {
|
||||
userName = claimUserName;
|
||||
}
|
||||
|
||||
// validate principal domain
|
||||
if (enforcePrincipalDomain && !domain.equals(principalDomain)) {
|
||||
throw new AuthenticationException(
|
||||
|
Loading…
x
Reference in New Issue
Block a user