throws SSOException {
// Initailization
InternalUserPrincipal remotePrincipal = null;
//Get the site
SSOSite ssoSite = getSSOSiteObject(site);
if (ssoSite == null)
{
throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
}
// Get the Principal information
String fullPath = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getFullPath();
try
{
// Get remotePrincipals for Site and match them with the Remote Principal for the Principal attached to site
Collection principalsForSite = ssoSite.getPrincipals();
Collection remoteForSite = ssoSite.getRemotePrincipals();
// If any of them don't exist just return
if (principalsForSite == null || remoteForSite== null )
throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
Collection remoteForPrincipals = getRemotePrincipalsForPrincipal(principalsForSite, fullPath);
if ( remoteForPrincipals == null)
throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
// Get remote Principal that matches the site and the principal
if ((remotePrincipal = findRemoteMatch(remoteForPrincipals, remoteForSite)) == null )
{
throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
}
// Update assocation tables
ssoSite.getRemotePrincipals().remove(remotePrincipal);
if (remoteForPrincipals.remove(remotePrincipal) == true)
// Update the site
getPersistenceBrokerTemplate().store(ssoSite);