Package io.micronaut.security.x509
Class X509AuthenticationFetcher
java.lang.Object
io.micronaut.security.x509.X509AuthenticationFetcher
- All Implemented Interfaces:
 io.micronaut.core.order.Ordered,AuthenticationFetcher<io.micronaut.http.HttpRequest<?>>
@Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
public class X509AuthenticationFetcher
extends Object
implements AuthenticationFetcher<io.micronaut.http.HttpRequest<?>>
Creates an Authentication if an X.509 client certificate is present and a
 name (CN) can be extracted.
- Since:
 - 3.3
 - Author:
 - Burt Beckwith
 
- 
Field Summary
FieldsFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull Optional<Authentication>createAuthentication(io.micronaut.http.HttpRequest<?> request) Creates anX509Authenticationfrom information in anX509Certificateif one is present in the request.protected @NonNull Optional<Authentication>createX509Authentication(@NonNull X509Certificate certificate) Creates anX509Authenticationfrom information in anX509Certificate.extractName(@NonNull X509Certificate certificate) Extracts the name from the certificate using the subject DN regex.org.reactivestreams.Publisher<Authentication>fetchAuthentication(io.micronaut.http.HttpRequest<?> request) Attempts to read anAuthenticationfrom an HTTP Request being executed.intgetOrder() 
- 
Field Details
- 
ORDER
public static final int ORDERThe order of the fetcher. 
 - 
 - 
Constructor Details
- 
X509AuthenticationFetcher
- Parameters:
 x509Configuration- x509 configuration
 
 - 
 - 
Method Details
- 
getOrder
public int getOrder()- Specified by:
 getOrderin interfaceio.micronaut.core.order.Ordered
 - 
fetchAuthentication
public org.reactivestreams.Publisher<Authentication> fetchAuthentication(io.micronaut.http.HttpRequest<?> request) Description copied from interface:AuthenticationFetcherAttempts to read anAuthenticationfrom an HTTP Request being executed.- Specified by:
 fetchAuthenticationin interfaceAuthenticationFetcher<io.micronaut.http.HttpRequest<?>>- Parameters:
 request- an HTTP Request being executed.- Returns:
 Authenticationif found
 - 
createAuthentication
@NonNull protected @NonNull Optional<Authentication> createAuthentication(io.micronaut.http.HttpRequest<?> request) Creates anX509Authenticationfrom information in anX509Certificateif one is present in the request.- Parameters:
 request- the request- Returns:
 - the authentication if the certificate exists and contains a valid name
 
 - 
createX509Authentication
@NonNull protected @NonNull Optional<Authentication> createX509Authentication(@NonNull @NonNull X509Certificate certificate) Creates anX509Authenticationfrom information in anX509Certificate.- Parameters:
 certificate- the certificate- Returns:
 - the authentication if the certificate contains a valid name
 
 - 
extractName
@NonNull protected @NonNull Optional<String> extractName(@NonNull @NonNull X509Certificate certificate) Extracts the name from the certificate using the subject DN regex.- Parameters:
 certificate- the client certificate- Returns:
 - the name if found
 
 
 -