@Requires(property="micronaut.security.basic-auth.enabled", notEquals="false") @Singleton public class BasicAuthAuthenticationFetcher extends java.lang.Object implements AuthenticationFetcher
AuthenticationFetcher
that decodes a username
and password from the Authorization header and authenticates the credentials
against any AuthenticationProvider
s available.Constructor and Description |
---|
BasicAuthAuthenticationFetcher(Authenticator authenticator,
TokenConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<Authentication> |
fetchAuthentication(io.micronaut.http.HttpRequest<?> request)
Attempts to read an
Authentication from a HttpRequest being executed. |
java.util.Optional<UsernamePasswordCredentials> |
parseCredentials(java.lang.String authorization) |
public BasicAuthAuthenticationFetcher(Authenticator authenticator, TokenConfiguration configuration)
authenticator
- The authenticator to authenticate the credentialsconfiguration
- The basic authentication configurationpublic org.reactivestreams.Publisher<Authentication> fetchAuthentication(io.micronaut.http.HttpRequest<?> request)
AuthenticationFetcher
Authentication
from a HttpRequest
being executed.fetchAuthentication
in interface AuthenticationFetcher
request
- HttpRequest
being executed.Authentication
if found@NonNull public java.util.Optional<UsernamePasswordCredentials> parseCredentials(@NonNull java.lang.String authorization)
authorization
- Authorization HTTP Header valueUsernamePasswordCredentials
or an empty optional if not possible.