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]);
  }
}

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 ] ) ; } }
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 .
