List of usage examples for org.springframework.http.server.reactive SslInfo getPeerCertificates
@Nullable X509Certificate[] getPeerCertificates();
From source file:org.springframework.security.web.server.authentication.ServerX509AuthenticationConverter.java
@Override public Mono<Authentication> convert(ServerWebExchange exchange) { SslInfo sslInfo = exchange.getRequest().getSslInfo(); if (sslInfo == null) { if (logger.isDebugEnabled()) { logger.debug("No SslInfo provided with a request, skipping x509 authentication"); }/*from www .j a va2 s . co m*/ return Mono.empty(); } if (sslInfo.getPeerCertificates() == null || sslInfo.getPeerCertificates().length == 0) { if (logger.isDebugEnabled()) { logger.debug("No peer certificates found in SslInfo, skipping x509 authentication"); } return Mono.empty(); } X509Certificate clientCertificate = sslInfo.getPeerCertificates()[0]; Object principal = this.principalExtractor.extractPrincipal(clientCertificate); PreAuthenticatedAuthenticationToken authRequest = new PreAuthenticatedAuthenticationToken(principal, clientCertificate); return Mono.just(authRequest); }