question: private void linkAccount ( final String principalId , final NameID nameId ) throws SAML2MetaException , AuthenticationException { final String spEntityId = metaManager . getEntityByMetaAlias ( metaAlias ) ; try { NameIDInfo info = new NameIDInfo ( spEntityId , entityName , nameId , SAML2Constants . SP_ROLE , false ) ; DEBUG . message ( "SAML2 :: Local User {} Linked to Federation Account - {}" , principalId , nameId . getValue ( ) ) ; if ( shouldPersistNameID ( spEntityId ) ) { AccountUtils . setAccountFederation ( info , principalId ) ; } principal = new SAML2Principal ( principalId ) ; } catch ( SAML2Exception e ) { throw new AuthenticationException ( BUNDLE_NAME , "localLinkError" , new Object [ 0 ] ) ; } }
target:  Links SAML2 accounts once all local auth steps have completed and we have a local principalId, sets the local principal to a new SAML2Pricipal with that ID.