public class AuthnJwtService extends Object implements AuthenticationService
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CLAIMS_FIELD |
protected static String |
ROLE_FIELD |
protected static String |
STARGATE_PREFIX |
| Constructor and Description |
|---|
AuthnJwtService(com.nimbusds.jwt.proc.ConfigurableJWTProcessor<? extends com.nimbusds.jose.proc.SecurityContext> jwtProcessor) |
| Modifier and Type | Method and Description |
|---|---|
String |
createToken(String key,
Map<String,String> headers) |
String |
createToken(String key,
String secret,
Map<String,String> headers) |
Authenticator.SaslNegotiator |
getSaslNegotiator(Authenticator.SaslNegotiator wrapped,
ClientInfo clientInfo) |
AuthenticationSubject |
validateToken(String token)
Validates a token in the form of a JWT to ensure that 1) it's not expired, 2) it's correctly
signed by the provider, and 3) contains the proper role for the given DB.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateToken, validateTokenprotected static final String STARGATE_PREFIX
protected static final String ROLE_FIELD
protected static final String CLAIMS_FIELD
public AuthnJwtService(com.nimbusds.jwt.proc.ConfigurableJWTProcessor<? extends com.nimbusds.jose.proc.SecurityContext> jwtProcessor)
public String createToken(String key, String secret, Map<String,String> headers)
createToken in interface AuthenticationServicepublic String createToken(String key, Map<String,String> headers)
createToken in interface AuthenticationServicepublic AuthenticationSubject validateToken(String token) throws UnauthorizedException
validateToken in interface AuthenticationServicetoken - A JWT created by an auth provider.AuthenticationSubject containing the role name the request is authenticated
to use.UnauthorizedException - An UnauthorizedException if the JWT is expired, malformed, or not
properly signed.public Authenticator.SaslNegotiator getSaslNegotiator(Authenticator.SaslNegotiator wrapped, ClientInfo clientInfo)
getSaslNegotiator in interface AuthenticationServiceCopyright © 2021. All rights reserved.