Search in sources :

Example 1 with AdministrationException

use of org.apache.nifi.registry.exception.AdministrationException in project nifi-registry by apache.

the class AccessResource method createAccessToken.

private String createAccessToken(IdentityProvider identityProvider, AuthenticationRequest authenticationRequest) throws InvalidCredentialsException, AdministrationException {
    final AuthenticationResponse authenticationResponse;
    try {
        authenticationResponse = identityProvider.authenticate(authenticationRequest);
        final String token = jwtService.generateSignedToken(authenticationResponse);
        return token;
    } catch (final IdentityAccessException | JwtException e) {
        throw new AdministrationException(e.getMessage());
    }
}
Also used : JwtException(io.jsonwebtoken.JwtException) IdentityAccessException(org.apache.nifi.registry.security.authentication.exception.IdentityAccessException) AdministrationException(org.apache.nifi.registry.exception.AdministrationException) AuthenticationResponse(org.apache.nifi.registry.security.authentication.AuthenticationResponse)

Aggregations

JwtException (io.jsonwebtoken.JwtException)1 AdministrationException (org.apache.nifi.registry.exception.AdministrationException)1 AuthenticationResponse (org.apache.nifi.registry.security.authentication.AuthenticationResponse)1 IdentityAccessException (org.apache.nifi.registry.security.authentication.exception.IdentityAccessException)1