private UserLogin tryBasicAuthLogin ( UserLogin login , UserAuthenticationService authService , HttpServletRequest request ) { final String header = request . getHeader ( HttpHeaderNames . AUTHORIZATION ) ; if ( header != null ) { final String [ ] credentials = BasicAuthHelper . parseHeader ( header ) ; if ( credentials != null ) { final String username = credentials [ 0 ] ; final String password = credentials [ 1 ] ; final Future < UserEntity > future = asynchService . get ( ) . submit ( ( ) -> tryLogin ( authService , username , password , true ) ) ; try { UserEntity user = LOGIN_TIMEOUT . start ( ) . resolveFuture ( future , true ) ; login . reload ( user ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error attempting asynchronous BASIC auth login: " + e . getMessage ( ) , e ) ; } } } // No authorisation (or unsupported authorisation type) return null ; }
Support proactive HTTP BASIC authentication