protected void doExecuteCommand ( ) { if ( ! ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . applicationSecurityManager ( ) . isSecuritySupported ( ) ) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage ( "loginForm" ) ; final LoginForm loginForm = createLoginForm ( ) ; tabbedPage . addForm ( loginForm ) ; if ( getDefaultUserName ( ) != null ) { loginForm . setUserName ( getDefaultUserName ( ) ) ; } dialog = new TitledPageApplicationDialog ( tabbedPage ) { protected boolean onFinish ( ) { loginForm . commit ( ) ; Authentication authentication = loginForm . getAuthentication ( ) ; // Hand this token to the security manager to actually attempt the login ApplicationSecurityManager sm = getApplicationConfig ( ) . applicationSecurityManager ( ) ; try { sm . doLogin ( authentication ) ; postLogin ( ) ; return true ; } finally { if ( isClearPasswordOnFailure ( ) ) { loginForm . setPassword ( "" ) ; } loginForm . requestFocusInWindow ( ) ; } } protected void onCancel ( ) { super . onCancel ( ) ; // Close the dialog // Now exit if configured if ( isCloseOnCancel ( ) ) { ApplicationSecurityManager sm = getApplicationConfig ( ) . applicationSecurityManager ( ) ; Authentication authentication = sm . getAuthentication ( ) ; if ( authentication == null ) { LoginCommand . this . logger . info ( "User canceled login; close the application." ) ; getApplicationConfig ( ) . application ( ) . close ( ) ; } } } protected ActionCommand getCallingCommand ( ) { return LoginCommand . this ; } protected void onAboutToShow ( ) { loginForm . requestFocusInWindow ( ) ; } } ; dialog . setDisplayFinishSuccessMessage ( displaySuccessMessage ) ; dialog . showDialog ( ) ; }
Execute the login command . Display the dialog and attempt authentication .