/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: AccountUtils.java,v 1.2 2008/06/25 05:48:04 qcheng Exp $
*
*/
/**
* <code>AccountUtils</code> is a utility class for setting and retrieving
* the <code>WS-Federation<code> account federation information.
*/
public class AccountUtils {
"com.sun.identity.wsfederation.nameidinfo.attribute";
"com.sun.identity.wsfederation.nameidinfokey.attribute";
/**
* Returns the account federation information of a user for the given
* identity provider and a service provider.
* @param userID user id for which account federation needs to be returned.
* @param hostEntityID <code>EntityID</code> of the hosted entity.
* @param remoteEntityID <code>EntityID</code> of the remote entity.
* @return the account federation info object.
* null if the account federation does not exist.
* @exception WSFederationException if account federation retrieval failed.
*/
if (debug.messageEnabled()){
}
"nullUserID"));
}
if(hostEntityID == null) {
"nullHostEntityID"));
}
if(remoteEntityID == null) {
"nullRemoteEntityID"));
}
try {
"user does not have any account federations.");
}
return null;
}
}
break;
}
}
"user does not have account federation " +
" corresponding to =" + filter);
}
return null;
}
} catch (DataStoreProviderException dse) {
"Info: DataStoreProviderException", dse);
throw new WSFederationException(dse);
} catch (SAML2Exception se) {
"Info: SAML2Exception", se);
throw new WSFederationException(se);
}
}
/**
* Sets the account federation information in the datastore for a user.
* @param info <code>NameIDInfo</code> object to be set.
* @param userID user identifier for which the account federation to be set.
* @exception WSFederationException if any failure.
*/
public static void setAccountFederation(
"nullNameIDInfo"));
}
"nullUserID"));
}
try {
}
} else {
}
}
} else {
}
}
}
} else {
}
}
}
} catch (DataStoreProviderException dse) {
"DataStoreProviderException", dse);
throw new WSFederationException(dse);
} catch (SAML2Exception se) {
"SAML2Exception", se);
throw new WSFederationException(se);
}
}
/**
* Removes the account federation of a user.
* @param info <code>NameIDInfo</code> object.
* @param userID user identifier for which the account federation is to
* be removed.
* @return true if the account federation is removed successfully.
* @exception WSFederationException if any failure.
*/
public static boolean removeAccountFederation(
"nullNameIDInfo"));
}
"nullUserID"));
}
try {
"user does not have account federation infos.");
}
return false;
}
}
if(existingInfoKey != null &&
}
return true;
}
"account federation info not found.");
}
return false;
} catch (DataStoreProviderException dse) {
"DataStoreProviderException", dse);
throw new WSFederationException(dse);
} catch (SAML2Exception se) {
"SAML2Exception", se);
throw new WSFederationException(se);
}
}
/**
* Returns the WS-Federation Name Identifier Info attribute name.
* @return the WS-Federation Name Identifier Info attribute name.
*/
}
/**
* Returns the WS-Federation Name Identifier InfoKey attribute name.
* @return the WS-Federation Name Identifier InfoKey attribute name.
*/
}
}