Class ApiKeyAuthenticationProvider
java.lang.Object
com.microsoft.kiota.authentication.ApiKeyAuthenticationProvider
- All Implemented Interfaces:
AuthenticationProvider
This authentication provider adds an API key to the request as a query parameter or header.
-
Constructor Summary
ConstructorsConstructorDescriptionApiKeyAuthenticationProvider(String apiKey, String paramName, ApiKeyLocation location, String... validHosts) Creates a new instance of ApiKeyAuthenticationProvider. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticateRequest(RequestInformation request, Map<String, Object> additionalAuthenticationContext) Authenticates the application request.
-
Constructor Details
-
ApiKeyAuthenticationProvider
public ApiKeyAuthenticationProvider(@Nonnull String apiKey, @Nonnull String paramName, @Nonnull ApiKeyLocation location, @Nonnull String... validHosts) Creates a new instance of ApiKeyAuthenticationProvider.- Parameters:
apiKey- The API key to use.paramName- The name of the query parameter or header to use.location- The location of the API key.validHosts- The list of allowed hosts for which to add the API key.
-
-
Method Details
-
authenticateRequest
public void authenticateRequest(@Nonnull RequestInformation request, @Nullable Map<String, Object> additionalAuthenticationContext) Authenticates the application request.- Specified by:
authenticateRequestin interfaceAuthenticationProvider- Parameters:
request- the request to authenticate.additionalAuthenticationContext- Additional authentication context to pass to the authentication library.
-