use of io.trino.server.security.AuthenticationException in project trino by trinodb.
the class FormWebUiAuthenticationFilter method handleProtocolLoginRequest.
private static void handleProtocolLoginRequest(Authenticator authenticator, ContainerRequestContext request) {
Identity authenticatedIdentity;
try {
authenticatedIdentity = authenticator.authenticate(request);
} catch (AuthenticationException e) {
// authentication failed
sendWwwAuthenticate(request, firstNonNull(e.getMessage(), "Unauthorized"), e.getAuthenticateHeader().map(ImmutableSet::of).orElse(ImmutableSet.of()));
return;
}
if (redirectFormLoginToUi(request)) {
return;
}
setAuthenticatedIdentity(request, authenticatedIdentity);
}
use of io.trino.server.security.AuthenticationException in project trino by trinodb.
the class OAuth2Authenticator method needAuthentication.
@Override
protected AuthenticationException needAuthentication(ContainerRequestContext request, String message) {
UUID authId = UUID.randomUUID();
URI initiateUri = request.getUriInfo().getBaseUri().resolve(getInitiateUri(authId));
URI tokenUri = request.getUriInfo().getBaseUri().resolve(getTokenUri(authId));
return new AuthenticationException(message, format("Bearer x_redirect_server=\"%s\", x_token_server=\"%s\"", initiateUri, tokenUri));
}
Aggregations