public class KnoxService extends Object
| Modifier and Type | Field and Description |
|---|---|
private Set<String> |
audiences |
private KnoxConfiguration |
configuration |
private String |
knoxUrl |
private static org.slf4j.Logger |
logger |
private com.nimbusds.jose.JWSVerifier |
verifier |
| Constructor and Description |
|---|
KnoxService(KnoxConfiguration configuration)
Creates a new KnoxService.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAuthenticationFromToken(String jwt)
Extracts the authentication from the token and verify it.
|
String |
getKnoxUrl()
Returns the Knox Url.
|
boolean |
isKnoxEnabled()
Returns whether Knox support is enabled.
|
private boolean |
validateAudience(com.nimbusds.jwt.SignedJWT jwtToken)
Validate the jwt audience.
|
private boolean |
validateExpiration(com.nimbusds.jwt.SignedJWT jwtToken)
Validate the jwt expiration.
|
private boolean |
validateSignature(com.nimbusds.jwt.SignedJWT jwtToken)
Validate the jwt signature.
|
private boolean |
validateToken(com.nimbusds.jwt.SignedJWT jwtToken)
Validate the specified jwt.
|
private static final org.slf4j.Logger logger
private KnoxConfiguration configuration
private com.nimbusds.jose.JWSVerifier verifier
private String knoxUrl
public KnoxService(KnoxConfiguration configuration)
configuration - knox configurationpublic boolean isKnoxEnabled()
public String getKnoxUrl()
public String getAuthenticationFromToken(String jwt) throws ParseException, com.nimbusds.jose.JOSEException
jwt - signed jwt stringParseException - if the payload of the jwt doesn't represent a valid json object and a jwt claims setcom.nimbusds.jose.JOSEException - if the JWS object couldn't be verifiedprivate boolean validateToken(com.nimbusds.jwt.SignedJWT jwtToken)
throws com.nimbusds.jose.JOSEException,
ParseException
jwtToken - knox jwtcom.nimbusds.jose.JOSEException - if the jws object couldn't be verifiedParseException - if the payload of the jwt doesn't represent a valid json object and a jwt claims setprivate boolean validateSignature(com.nimbusds.jwt.SignedJWT jwtToken)
throws com.nimbusds.jose.JOSEException
jwtToken - knox jwtcom.nimbusds.jose.JOSEException - if the jws object couldn't be verifiedprivate boolean validateAudience(com.nimbusds.jwt.SignedJWT jwtToken)
throws ParseException
jwtToken - knox jwtParseException - if the payload of the jwt doesn't represent a valid json object and a jwt claims setprivate boolean validateExpiration(com.nimbusds.jwt.SignedJWT jwtToken)
throws ParseException
jwtToken - knox jwtParseException - if the payload of the jwt doesn't represent a valid json object and a jwt claims setCopyright © 2023 Apache NiFi Project. All rights reserved.