@ Override public synchronized void authenticate ( ) throws PortalSecurityException { this . isauth = false ; if ( this . myPrincipal . UID != null && this . myOpaqueCredentials . credentialstring != null ) { try { ILocalAccountDao accountStore = LocalAccountDaoLocator . getLocalAccountDao ( ) ; IPortalPasswordService passwordService = PortalPasswordServiceLocator . getPortalPasswordService ( ) ; // retrieve the account from the local user store ILocalAccountPerson account = accountStore . getPerson ( this . myPrincipal . UID ) ; if ( account != null ) { // get the account password as an ASCII string String loginPassword = new String ( this . myOpaqueCredentials . credentialstring , UTF_8 ) ; // if the password provided at login matches the hashed // account password, authenticate the user if ( passwordService . validatePassword ( loginPassword , account . getPassword ( ) ) ) { // set the full name for this user String fullName = ( String ) account . getAttributeValue ( "displayName" ) ; this . myPrincipal . FullName = fullName ; if ( log . isInfoEnabled ( ) ) log . info ( "User " + this . myPrincipal . UID + " is authenticated" ) ; this . isauth = true ; } else { log . info ( "Password Invalid" ) ; } } else { if ( log . isInfoEnabled ( ) ) log . info ( "No such user: " + this . myPrincipal . UID ) ; } } catch ( Exception e ) { log . error ( "Error authenticating user" , e ) ; throw new RuntimeException ( "Error authenticating user" , e ) ; } } // If the principal and/or credential are missing, the context authentication // simply fails. It should not be construed that this is an error. It happens for guest // access. else { log . info ( "Principal or OpaqueCredentials not initialized prior to authenticate" ) ; } // Ok...we are now ready to authenticate all of our subcontexts. super . authenticate ( ) ; return ; }
Authenticate user .