Package io.smallrye.jwt.auth.principal
Class JWTCallerPrincipal
java.lang.Object
io.smallrye.jwt.auth.principal.JWTCallerPrincipal
- All Implemented Interfaces:
Principal,org.eclipse.microprofile.jwt.JsonWebToken
- Direct Known Subclasses:
DefaultJWTCallerPrincipal
public abstract class JWTCallerPrincipal
extends Object
implements org.eclipse.microprofile.jwt.JsonWebToken
An abstract CallerPrincipal implementation that provides access to the JWT claims that are required by
the microprofile token.
-
Constructor Summary
ConstructorsConstructorDescriptionJWTCallerPrincipal(String rawToken, String tokenType) Create a JWTCallerPrincipal with the caller's name -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Collection<String> <T> Tprotected org.eclipse.microprofile.jwt.ClaimsgetClaimType(String claimName) protected abstract ObjectgetClaimValue(String claimName) getName()Note that this method is not guaranteed to return the unique principal name as documented in theJsonWebToken.getName()if the "upn" claim is not available but the next fallback claim, the "preferred_username" claim is.booleantoString()toString(boolean showAll) TODO: showAll is ignored and currently assumed trueprotected jakarta.json.JsonValuewrapClaimValue(Object value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.microprofile.jwt.JsonWebToken
claim, claim, containsClaim, getAudience, getClaim, getExpirationTime, getGroups, getIssuedAtTime, getIssuer, getRawToken, getSubject, getTokenID
-
Constructor Details
-
JWTCallerPrincipal
Create a JWTCallerPrincipal with the caller's name- Parameters:
rawToken- - raw token valuetokenType- - token type
-
-
Method Details
-
getName
Note that this method is not guaranteed to return the unique principal name as documented in theJsonWebToken.getName()if the "upn" claim is not available but the next fallback claim, the "preferred_username" claim is. This is due to the fact that a standard OpenId Connect "preferred_username" claim value is not guaranteed to be unique. UseJsonWebToken.getSubject()to get a unique subject value orJsonWebToken.getClaim(String)to get a 'upn' claim whose value is a unique identifier. -
getClaimNames
- Specified by:
getClaimNamesin interfaceorg.eclipse.microprofile.jwt.JsonWebToken
-
doGetClaimNames
-
getClaim
- Specified by:
getClaimin interfaceorg.eclipse.microprofile.jwt.JsonWebToken
-
getClaimValue
-
implies
-
toString
-
toString
TODO: showAll is ignored and currently assumed true- Parameters:
showAll- - should all claims associated with the JWT be displayed or should only those defined in the JsonWebToken interface be displayed.- Returns:
- JWTCallerPrincipal string view
-
wrapClaimValue
-
getClaimType
-