class KnoxService {

    public String getAuthenticationFromToken(final String jwt) throws ParseException, JOSEException {
        if (!configuration.isKnoxEnabled()) {
            throw new IllegalStateException("Apache Knox SSO is not enabled.");
        }

        // attempt to parse the signed jwt
        final SignedJWT signedJwt = SignedJWT.parse(jwt);

        // validate the token
        if (validateToken(signedJwt)) {
            final JWTClaimsSet claimsSet = signedJwt.getJWTClaimsSet();
            if (claimsSet == null) {
                logger.info("Claims set is missing from Knox JWT.");
                throw new InvalidAuthenticationException("The Knox JWT token is not valid.");
            }

            // extract the user identity from the token
            return claimsSet.getSubject();
        } else {
            throw new InvalidAuthenticationException("The Knox JWT token is not valid.");
        }
    }

    public  KnoxService(final KnoxConfiguration configuration);

}