use of org.eclipse.microprofile.jwt.Claims in project tomee by apache.
the class JWTCallerPrincipal method getClaim.
@Override
public Object getClaim(final String claimName) {
Claims claimType = Claims.UNKNOWN;
Object claim = null;
try {
claimType = Claims.valueOf(claimName);
} catch (IllegalArgumentException e) {
}
// Handle the jose4j NumericDate types and
switch(claimType) {
case auth_time:
case updated_at:
try {
claim = claimsSet.getClaimValue(claimType.name(), Long.class);
if (claim == null) {
claim = 0L;
}
} catch (final MalformedClaimException e) {
logger.log(Level.FINEST, "Can't retrieve 'updated_at' a malformed claim.", e);
}
break;
case groups:
claim = getGroups();
break;
case aud:
claim = getAudience();
break;
case UNKNOWN:
claim = claimsSet.getClaimValue(claimName);
break;
default:
claim = claimsSet.getClaimValue(claimType.name());
}
return claim;
}
use of org.eclipse.microprofile.jwt.Claims in project wildfly-swarm by wildfly-swarm.
the class DefaultJWTCallerPrincipal method getClaim.
@Override
public Object getClaim(String claimName) {
Claims claimType = Claims.UNKNOWN;
Object claim = null;
try {
claimType = Claims.valueOf(claimName);
} catch (IllegalArgumentException e) {
}
// Handle the jose4j NumericDate types and
switch(claimType) {
case exp:
case iat:
case auth_time:
case nbf:
case updated_at:
try {
claim = claimsSet.getClaimValue(claimType.name(), Long.class);
if (claim == null) {
claim = new Long(0);
}
} catch (MalformedClaimException e) {
}
break;
case groups:
claim = getGroups();
break;
case aud:
claim = getAudience();
break;
case UNKNOWN:
claim = claimsSet.getClaimValue(claimName);
break;
default:
claim = claimsSet.getClaimValue(claimType.name());
}
return claim;
}
use of org.eclipse.microprofile.jwt.Claims in project smallrye-jwt by smallrye.
the class DefaultJWTCallerPrincipal method getClaimValue.
@Override
protected Object getClaimValue(String claimName) {
Claims claimType = getClaimType(claimName);
Object claim = null;
// Handle the jose4j NumericDate types and
switch(claimType) {
case exp:
case iat:
case auth_time:
case nbf:
case updated_at:
try {
claim = claimsSet.getClaimValue(claimType.name(), Long.class);
if (claim == null) {
claim = 0L;
}
} catch (MalformedClaimException e) {
PrincipalLogging.log.getGroupsFailure(claimName, e);
}
break;
case groups:
claim = getGroups();
break;
case aud:
claim = getAudience();
break;
case UNKNOWN:
claim = claimsSet.getClaimValue(claimName);
break;
default:
claim = claimsSet.getClaimValue(claimType.name());
}
return claim;
}
Aggregations