Interface ModelAuthProvider


public interface ModelAuthProvider
Model authentication providers can be used to supply credentials such as access tokens, API keys, and other type of credentials.

Providers which support a specific named model only must be annotated with a ModelName annotation.

  • Method Details

    • getAuthorization

      String getAuthorization(ModelAuthProvider.Input input)
      Provide authorization data which will be set as an HTTP Authorization header value.
      Parameters:
      input - representation of an HTTP request to the model provider.
      Returns:
      authorization data which must include an HTTP Authorization scheme value, for example: "Bearer the_access_token". Returning null will result in no Authorization header being set.
    • resolve

      static Optional<ModelAuthProvider> resolve(String modelName)
      Resolve ModelAuthProvider.
      Parameters:
      modelName - the model name. If the model name is not null then a ModelAuthProvider with a matching ModelName annotation are preferred to a global ModelAuthProvider.
      Returns:
      Resolved ModelAuthProvider as an Optional value which will be empty if no ModelAuthProvider is available.