protected Optional < ProviderLoginPageConfiguration > buildProviderConfiguration ( final IndirectClient client , final WebContext webContext , final WebApplicationService service ) { val name = client . getName ( ) ; val matcher = PAC4J_CLIENT_SUFFIX_PATTERN . matcher ( client . getClass ( ) . getSimpleName ( ) ) ; val type = matcher . replaceAll ( StringUtils . EMPTY ) . toLowerCase ( ) ; val uriBuilder = UriComponentsBuilder . fromUriString ( DelegatedClientNavigationController . ENDPOINT_REDIRECT ) . queryParam ( Pac4jConstants . DEFAULT_CLIENT_NAME_PARAMETER , name ) ; if ( service != null ) { val sourceParam = service . getSource ( ) ; val serviceParam = service . getOriginalUrl ( ) ; if ( StringUtils . isNotBlank ( sourceParam ) && StringUtils . isNotBlank ( serviceParam ) ) { uriBuilder . queryParam ( sourceParam , serviceParam ) ; } } val methodParam = webContext . getRequestParameter ( CasProtocolConstants . PARAMETER_METHOD ) ; if ( StringUtils . isNotBlank ( methodParam ) ) { uriBuilder . queryParam ( CasProtocolConstants . PARAMETER_METHOD , methodParam ) ; } val localeParam = webContext . getRequestParameter ( this . localeParamName ) ; if ( StringUtils . isNotBlank ( localeParam ) ) { uriBuilder . queryParam ( this . localeParamName , localeParam ) ; } val themeParam = webContext . getRequestParameter ( this . themeParamName ) ; if ( StringUtils . isNotBlank ( themeParam ) ) { uriBuilder . queryParam ( this . themeParamName , themeParam ) ; } val redirectUrl = uriBuilder . toUriString ( ) ; val autoRedirect = ( Boolean ) client . getCustomProperties ( ) . getOrDefault ( ClientCustomPropertyConstants . CLIENT_CUSTOM_PROPERTY_AUTO_REDIRECT , Boolean . FALSE ) ; val p = new ProviderLoginPageConfiguration ( name , redirectUrl , type , getCssClass ( name ) , autoRedirect ) ; return Optional . of ( p ) ; }
Build provider configuration optional .