/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 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: COTUtils.java,v 1.5 2008/08/06 17:26:14 exu Exp $
*
*/
/**
* This class contains circle of trust utilities.
*/
public class COTUtils {
/**
* Default Constructor.
*/
public COTUtils() {
}
/**
* Get the first value of set by given key searching in the given map.
* return null if <code>attrMap</code> is null or <code>key</code>
* is null.
*
* @param attrMap Map of attributes name and their values
* in the circle of trust service. The key
* is the attribute name and the value is
* a Set.
* @param key the attribute name to be retrieved.
* @return the first value of the attribute in the value set.
*/
}
}
return retValue;
}
/**
* Adds a set of a given value to a map. Set will not be added if
* <code>attrMap</code> is null or <code>value</code> is null or
* <code>key</code> is null.
*
* @param attrMap Map of which set is to be added.
* @param key Key of the entry to be added.
* @param value Value to be added to the Set.
*/
}
}
/**
* Checks if the federation protocol type is valid. The valid values
* are IDFF or SAML2.
*
* @param protocolType the federation protocol type.
* @return true if value is idff or saml2.
*/
if (!isValid) {
}
return isValid;
}
/**
* Converts set of COT trusted providers to map.
* Key of the map is the entity id name, value is a set of protocols the
* entity supports.
*
* @param providerSet A set of trusted providers, each entry value could
* contain both entity id and protocol in "|" separated format.
* @param realm The realm the providers resides.
* @return A map with entity id as key, protocols as value.
*/
return Collections.EMPTY_MAP;
}
if (debug.messageEnabled()) {
}
set);
set);
set);
} else {
// find out protocol for this provider
}
}
}
if (debug.messageEnabled()) {
}
return map;
}
/**
* Converts set of COT trusted providers to map.
* Key of the map is protocol name, value is a set of entity IDs which
* speaks the protocol. Protocl name is one of COTConstants.WS_FED,
* COTConstants.SAML2 or COTConstants.IDFF.
*
* @param providerSet A set of trusted providers, each entry value could
* contain both entity id and protocol in "|" separated format.
* @param realm The realm the providers resides.
* @return A map with protocol name as key, set of entity IDs as value.
*/
return Collections.EMPTY_MAP;
}
if (debug.messageEnabled()) {
}
} else {
// find out protocol for this provider
}
}
}
}
}
if (debug.messageEnabled()) {
}
return map;
}
/**
* Returns set of protocol the entity supports.
* @param entityId The ID of the entity to be checked.
* @param realm the realm in which the entity resides.
* @return Set of protocol the entity supports, values could be
* <code>COTConstants.SAML2</code>,
* <code>COTConstants.IDFF</code> or
* <code>COTConstants.WS_FED</code>.
*/
try {
}
}
// TODO : hanlde WS-FED
return retSet;
} catch (COTException e) {
return null;
}
}
/**
* This method returns a Set with value in per entity and per protocol
* format ("|" separated).
*
* @return A map with protocol name as key, set of entity IDs as value.
* @return A set of trusted providers with each entry value containing
* both entity id and protocol in "|" separated format.
*/
return Collections.EMPTY_SET;
}
suffix = IDFF_DELIM;
} else {
if (debug.warningEnabled()) {
"invalid protocol " + key);
}
continue;
}
}
}
if (debug.messageEnabled()) {
}
return retSet;
}
}