@ Override public boolean login ( ) throws LoginException { if ( ( getShared ( ) . isUseFirstPass ( ) || getShared ( ) . isTryFirstPass ( ) ) && getShared ( ) . isHasSharedAuth ( ) ) { debug ( String . format ( "JettyCombinedLdapLoginModule: login with shared auth, " + "try? %s, use? %s" , getShared ( ) . isTryFirstPass ( ) , getShared ( ) . isUseFirstPass ( ) ) ) ; setAuthenticated ( authenticate ( getShared ( ) . getSharedUserName ( ) , getShared ( ) . getSharedUserPass ( ) ) ) ; } if ( getShared ( ) . isUseFirstPass ( ) && getShared ( ) . isHasSharedAuth ( ) ) { //finish with shared password auth attempt debug ( String . format ( "AbstractSharedLoginModule: using login result: %s" , isAuthenticated ( ) ) ) ; if ( isAuthenticated ( ) ) { wasAuthenticated ( getShared ( ) . getSharedUserName ( ) , getShared ( ) . getSharedUserPass ( ) ) ; } return isAuthenticated ( ) ; } if ( getShared ( ) . isHasSharedAuth ( ) ) { if ( isAuthenticated ( ) ) { return isAuthenticated ( ) ; } debug ( String . format ( "AbstractSharedLoginModule: shared auth failed, now trying callback auth." ) ) ; } Object [ ] userPass = new Object [ 0 ] ; try { userPass = getCallBackAuth ( ) ; } catch ( IOException e ) { if ( isDebug ( ) ) { e . printStackTrace ( ) ; } throw new LoginException ( e . toString ( ) ) ; } catch ( UnsupportedCallbackException e ) { if ( isDebug ( ) ) { e . printStackTrace ( ) ; } throw new LoginException ( e . toString ( ) ) ; } if ( null == userPass || userPass . length < 2 ) { setAuthenticated ( false ) ; } else { String name = ( String ) userPass [ 0 ] ; Object pass = userPass [ 1 ] ; setAuthenticated ( authenticate ( name , pass ) ) ; if ( isAuthenticated ( ) ) { wasAuthenticated ( name , pass ) ; } } return isAuthenticated ( ) ; }
Override default login logic to use shared login credentials if available