@ Override public synchronized void authenticate ( ) throws PortalSecurityException { int i ; Enumeration e = mySubContexts . elements ( ) ; while ( e . hasMoreElements ( ) ) { ISecurityContext sctx = ( ( Entry ) e . nextElement ( ) ) . getCtx ( ) ; // The principal and credential are now set for all subcontexts in Authentication try { if ( sctx instanceof IParentAwareSecurityContext ) { ( ( IParentAwareSecurityContext ) sctx ) . authenticate ( this ) ; } else { sctx . authenticate ( ) ; } } catch ( Exception ex ) { log . error ( "Exception authenticating subcontext " + sctx , ex ) ; } // Stop attempting to authenticate if authenticated and if the property flag is set if ( stopWhenAuthenticated && sctx . isAuthenticated ( ) ) { break ; } } // Zero out the actual credentials if it isn't already null if ( this . myOpaqueCredentials . credentialstring != null ) { for ( i = 0 ; i < this . myOpaqueCredentials . credentialstring . length ; i ++ ) this . myOpaqueCredentials . credentialstring [ i ] = 0 ; myOpaqueCredentials . credentialstring = null ; } return ; }
We walk the chain of subcontexts assigning principals and opaqueCredentials from the parent . Note that the contexts themselves should resist actually performing the assignment if an assignment has already been made to either the credentials or the UID .