use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class ConfigFedMonitoring method getAllRealms.
private void getAllRealms(String startRealm) {
String classMethod = "ConfigFedMonitoring.getAllRealms: ";
// until IDPs/SPs per realm instrum
boolean skipSAML2Entities = true;
StringBuffer sb = new StringBuffer(classMethod);
sb.append("orgnames starting from ").append(startRealm).append(":\n");
sb.append(" ").append(startRealm).append("\n");
List rList = getRealmsList(startRealm);
try {
CircleOfTrustManager cotmgr = new CircleOfTrustManager();
SAML2MetaManager saml2Mgr = new SAML2MetaManager();
IDFFMetaManager idffmgr = new IDFFMetaManager(ssoToken);
for (Iterator it = rList.iterator(); it.hasNext(); ) {
String thisRealm = (String) it.next();
Set cots = getCOTs(thisRealm, cotmgr);
Map s2Ents = null;
if (!skipSAML2Entities) {
s2Ents = getSAML2Entities(thisRealm, saml2Mgr);
}
Map wsEnts = getWSFedEntities(thisRealm);
Map idffentMap = getIDFFEntities(thisRealm, idffmgr);
/*
* getCOTMembers(thisRealm, cot, cotmgr, cotsb)
* can get the members of the COT, but there isn't
* a (MIB) entry that right now.
*/
Map membMap = getCOTMembers(thisRealm, cots, cotmgr);
SSOServerRealmFedInfo srfi = new SSOServerRealmFedInfo.SSOServerRealmFedInfoBuilder(thisRealm).cots(cots).samlv2Entities(s2Ents).wsEntities(wsEnts).idffEntities(idffentMap).membEntities(membMap).build();
Agent.federationConfig(srfi);
}
} catch (SAML2MetaException e) {
debug.error(classMethod + "SAML2 ex: " + e.getMessage());
} catch (COTException e) {
debug.error(classMethod + "COT ex: " + e.getMessage());
} catch (IDFFMetaException e) {
debug.error(classMethod + "IDFF ex: " + e.getMessage());
}
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class ConfigFedMonitoring method getCOTMembers.
private Map getCOTMembers(String realm, Set cotNames, CircleOfTrustManager cotmgr) {
String classMethod = "ConfigFedMonitoring.getCOTMembers: ";
StringBuffer sb = new StringBuffer(classMethod);
Map cotMap = new HashMap();
for (Iterator it1 = cotNames.iterator(); it1.hasNext(); ) {
String cotName = (String) it1.next();
if (debug.messageEnabled()) {
sb.append(" cotName = ").append(cotName).append("\n");
}
Map memMap = new HashMap();
try {
Set cotSAML = cotmgr.listCircleOfTrustMember(realm, cotName, COTConstants.SAML2);
Set cotIDFF = cotmgr.listCircleOfTrustMember(realm, cotName, COTConstants.IDFF);
Set cotWSFed = cotmgr.listCircleOfTrustMember(realm, cotName, COTConstants.WS_FED);
memMap.put("SAML", cotSAML);
memMap.put("IDFF", cotIDFF);
memMap.put("WSFed", cotWSFed);
cotMap.put(cotName, memMap);
if (debug.messageEnabled()) {
sb.append(" SAMLv2 members: ");
if ((cotSAML != null) && (cotSAML.size() > 0)) {
for (Iterator it = cotSAML.iterator(); it.hasNext(); ) {
sb.append(" ").append((String) it.next()).append("\n");
}
} else {
sb.append("none\n");
}
sb.append(" IDFF members: ");
if ((cotIDFF != null) && (cotIDFF.size() > 0)) {
for (Iterator it = cotIDFF.iterator(); it.hasNext(); ) {
sb.append(" ").append((String) it.next()).append("\n");
}
} else {
sb.append("none\n");
}
sb.append(" WSFed members: ");
if ((cotWSFed != null) && (cotWSFed.size() > 0)) {
for (Iterator it = cotWSFed.iterator(); it.hasNext(); ) {
sb.append(" ").append((String) it.next()).append("\n");
}
} else {
sb.append("none\n");
}
}
} catch (COTException cx) {
debug.error(classMethod + "COTException: " + cx.getMessage());
}
}
if (debug.messageEnabled()) {
debug.error(sb.toString());
}
return cotMap;
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class FSLoginHelper method getTLDURL.
private String getTLDURL() {
String tldURL = null;
FSUtils.debug.message("FSLoginHelper.getTLDURL() :: called");
try {
if ((cotList == null) || (cotList.isEmpty())) {
FSUtils.debug.error("FSLoginHelper::getTLDURL():" + "Received COT Set is Invalid");
} else {
if (cotList.size() > 1) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("FSLoginHelper::getTLDURL() " + "Multiple COTs found will do polling ");
}
} else {
FSUtils.debug.message("FSLoginHelper::getTLDURL() Single COT found");
}
Iterator iter = cotList.iterator();
CircleOfTrustManager cotManager = new CircleOfTrustManager();
while (iter.hasNext()) {
CircleOfTrustDescriptor cotDesc = cotManager.getCircleOfTrust(realm, (String) iter.next());
if (cotDesc != null && (cotDesc.getCircleOfTrustStatus()).equalsIgnoreCase(IFSConstants.ACTIVE)) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("FSLoginHelper::getTLDURL " + "found a active cot with cotid : " + cotDesc.getCircleOfTrustName());
}
tldURL = cotDesc.getIDFFReaderServiceURL();
break;
}
}
}
} catch (COTException ame) {
FSUtils.debug.error("FSLoginHelper.getTLDURL():" + "COTException:", ame);
} catch (Exception exp) {
FSUtils.debug.error("FSLoginHelper.getTLDURL():General Exception:", exp);
}
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("FSLoginHelper::getTLDURL().tldURL " + tldURL);
}
return tldURL;
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class SAML2Utils method getReaderURL.
public static String getReaderURL(String spMetaAlias) {
// get spExtended
String classMethod = "SAML2Utils:getReaderURL:";
String readerURL = null;
try {
String realm = SAML2MetaUtils.getRealmByMetaAlias(spMetaAlias);
String spEntityID = saml2MetaManager.getEntityByMetaAlias(spMetaAlias);
if (debug.messageEnabled()) {
debug.message(classMethod + "metaAlias is :" + spMetaAlias);
debug.message(classMethod + "Realm is :" + realm);
debug.message(classMethod + "spEntityID is :" + spEntityID);
}
SPSSOConfigElement spEntityCfg = saml2MetaManager.getSPSSOConfig(realm, spEntityID);
Map spConfigAttrsMap = null;
if (spEntityCfg != null) {
spConfigAttrsMap = SAML2MetaUtils.getAttributes(spEntityCfg);
List cotList = (List) spConfigAttrsMap.get("cotlist");
String cotListStr = (String) cotList.iterator().next();
CircleOfTrustDescriptor cotDesc = cotManager.getCircleOfTrust(realm, cotListStr);
readerURL = cotDesc.getSAML2ReaderServiceURL();
}
} catch (COTException ce) {
if (debug.messageEnabled()) {
debug.message(classMethod + "Error retreiving circle of trust", ce);
}
} catch (SAML2Exception s2e) {
if (debug.messageEnabled()) {
debug.message(classMethod + "Error getting reader URL : ", s2e);
}
} catch (Exception e) {
if (debug.messageEnabled()) {
debug.message(classMethod + "Error getting reader URL : ", e);
}
}
return readerURL;
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class IDFFMetaManager method addToCircleOfTrust.
/**
* Adds entity identifier to circle of trust.
*
* @param realm The realm under which the entity resides.
* @param config the entity config.
* @param entityId the entity identifier.
*/
private void addToCircleOfTrust(BaseConfigType config, String realm, String entityId) {
String classMethod = "COTManager:addToCircleOfTrust :";
try {
if (config != null) {
Map attr = IDFFMetaUtils.getAttributes(config);
List cotAttr = (List) attr.get(COTConstants.COT_LIST);
List cotList = new ArrayList(cotAttr);
if ((cotList != null) && !cotList.isEmpty()) {
for (Iterator iter = cotList.iterator(); iter.hasNext(); ) {
String cotName = (String) iter.next();
try {
cotManager.addCircleOfTrustMember(realm, cotName, COTConstants.IDFF, entityId);
} catch (COTException ce) {
debug.error(classMethod + cotName + " cotName");
}
}
}
}
} catch (Exception e) {
debug.error(classMethod + "Error while adding entity " + entityId + " to COT.", e);
}
}
Aggregations