private Properties getGlobalLoginFormProps ( ) throws Exception { WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig ( ) ; String loginURL = webAppSecConfig . getLoginFormURL ( ) ; String errorURL = webAppSecConfig . getLoginErrorURL ( ) ; if ( loginURL == null || loginURL . isEmpty ( ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_NO_URL" , "loginFormURL" ) ; } if ( errorURL == null || errorURL . isEmpty ( ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_NO_URL" , "loginErrorURL" ) ; } String contextRoot = webAppSecConfig . getLoginFormContextRoot ( ) ; if ( contextRoot == null ) { // if a context root is not set, use the first path element of the login page. contextRoot = getFirstPathElement ( loginURL ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "loginFormContextRoot is not set, use the first element of loginURL : " + contextRoot ) ; } } else { if ( ! validateContextRoot ( contextRoot , loginURL ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_INVALID_CONTEXT_ROOT" , contextRoot , loginURL , "loginFormURL" ) ; } if ( ! validateContextRoot ( contextRoot , errorURL ) ) { Tr . error ( tc , "JAVAEESEC_CDI_ERROR_INVALID_CONTEXT_ROOT" , contextRoot , errorURL , "loginErrorURL" ) ; } } // adjust the login and error url which need to be relative path from the context root. loginURL = FixUpUrl ( loginURL , contextRoot ) ; errorURL = FixUpUrl ( errorURL , contextRoot ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The container provided FormAuthenticationMechanism will be used with the following attributes. login page : " + loginURL + ", error page : " + errorURL + ", context root : " + contextRoot ) ; } Properties props = new Properties ( ) ; if ( loginURL != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_LOGINPAGE , loginURL ) ; } if ( errorURL != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_ERRORPAGE , errorURL ) ; } props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_USEFORWARDTOLOGIN , true ) ; props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_USE_GLOBAL_LOGIN , true ) ; if ( contextRoot != null ) { props . put ( JavaEESecConstants . LOGIN_TO_CONTINUE_LOGIN_FORM_CONTEXT_ROOT , contextRoot ) ; } return props ; }
Returns LoginToContinue properties for container override form login