use of io.trino.server.security.InternalPrincipal in project trino by trinodb.
the class InternalAuthenticationManager method handleInternalRequest.
public void handleInternalRequest(ContainerRequestContext request) {
String subject;
try {
subject = parseJwt(request.getHeaders().getFirst(TRINO_INTERNAL_BEARER));
} catch (JwtException e) {
log.error(e, "Internal authentication failed");
request.abortWith(Response.status(UNAUTHORIZED).type(TEXT_PLAIN_TYPE.toString()).build());
return;
} catch (RuntimeException e) {
throw new RuntimeException("Authentication error", e);
}
Identity identity = Identity.forUser("<internal>").withPrincipal(new InternalPrincipal(subject)).build();
setAuthenticatedIdentity(request, identity);
}
Aggregations