Interface ModelAuthProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ModelAuthProvider
Provides the credentials of each request that a model sends with the Micronaut HTTP client, for example a token of the current user or a short-lived token in place of the API key of the model configuration.

The ModelAuthProvider beans are asked in order: the first value that is not null replaces the Authorization header of the request. A provider is called on the thread that sends the request, so it can read the context of the current HTTP request.

Since:
2.4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    Returns the value of the Authorization header of a request, for example Bearer <token>.
  • Method Details

    • authorization

      @Nullable String authorization(ModelAuthRequest request)
      Returns the value of the Authorization header of a request, for example Bearer <token>.
      Parameters:
      request - The request of the model
      Returns:
      The value of the Authorization header, or null to keep the credentials of the model