code: public AuthContext authenticate(Request request) {
      final boolean hasAuthHeader = request.header(HttpHeaders.AUTHORIZATION).isPresent();
  
      if (!hasAuthHeader) {
        return Optional::empty;
      }
  
      final String authHeader = request.header(HttpHeaders.AUTHORIZATION).get();
      if (!authHeader.startsWith(BEARER_PREFIX)) {
        throw new ResponseException(Response.forStatus(Status.BAD_REQUEST
            .withReasonPhrase("Authorization token must be of type Bearer")));
      }
  
      final GoogleIdToken googleIdToken;
      try {
        googleIdToken = authenticator.authenticate(authHeader.substring(BEARER_PREFIX.length()));
      } catch (IllegalArgumentException e) {
        throw new ResponseException(Response.forStatus(Status.BAD_REQUEST
            .withReasonPhrase("Failed to parse Authorization token")), e);
      }
  
      if (googleIdToken == null) {
        throw new ResponseException(Response.forStatus(Status.UNAUTHORIZED
            .withReasonPhrase("Authorization token is invalid")));
      }
  
      return () -> Optional.of(googleIdToken);
    }
docs: Authentication an incoming Styx API request.
  @param request The incoming request.
  @return A {@link AuthContext} with the authentication result.
  @throws ResponseException If the Authorization header does not have a Bearer prefix or if the token was invalid.