use of com.sun.identity.cot.CircleOfTrustDescriptor in project OpenAM by OpenRock.
the class IDPSSOUtil method getWriterURL.
private static String getWriterURL(String realm, String idpEntityID, String spEntityID) {
String classMethod = "IDPSSOUtil.getWriterURL: ";
String writerURL = null;
try {
// get cot list of the idp
IDPSSOConfigElement idpEntityCfg = metaManager.getIDPSSOConfig(realm, idpEntityID);
Map idpConfigAttrsMap = null;
if (idpEntityCfg != null) {
idpConfigAttrsMap = SAML2MetaUtils.getAttributes(idpEntityCfg);
}
if ((idpConfigAttrsMap == null) || (idpConfigAttrsMap.size() == 0)) {
return null;
}
List idpCOTList = (List) idpConfigAttrsMap.get(SAML2Constants.COT_LIST);
if ((idpCOTList == null) || (idpCOTList.size() == 0)) {
return null;
}
// get cot list of the sp
SPSSOConfigElement spEntityCfg = metaManager.getSPSSOConfig(realm, spEntityID);
Map spConfigAttrsMap = null;
if (spEntityCfg != null) {
spConfigAttrsMap = SAML2MetaUtils.getAttributes(spEntityCfg);
}
if ((spConfigAttrsMap == null) || (spConfigAttrsMap.size() == 0)) {
return null;
}
List spCOTList = (List) spConfigAttrsMap.get(SAML2Constants.COT_LIST);
if ((spCOTList == null) || (spCOTList.size() == 0)) {
return null;
}
// retain in the idpCOTList the intersection of two lists
idpCOTList.retainAll(spCOTList);
for (int i = 0; i < idpCOTList.size(); i++) {
String cotName = (String) idpCOTList.get(i);
CircleOfTrustDescriptor cotDescriptor = cotManager.getCircleOfTrust(realm, cotName);
writerURL = cotDescriptor.getSAML2WriterServiceURL();
if ((writerURL != null) && (writerURL.trim().length() != 0)) {
break;
}
}
} catch (COTException ce) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message(classMethod + "Error retreiving of " + "circle of trust", ce);
}
} catch (SAML2Exception se) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message(classMethod + "Not able to getting writer URL : ", se);
}
} catch (Exception e) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message(classMethod + "Not able to getting writer URL : ", e);
}
}
return writerURL;
}
use of com.sun.identity.cot.CircleOfTrustDescriptor 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.CircleOfTrustDescriptor 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.CircleOfTrustDescriptor in project OpenAM by OpenRock.
the class SAML2Test method deleteCircleOfTrust.
@Test(groups = { "samlv2" }, dependsOnMethods = { "removeProviderFromCircleOfTrust" }, expectedExceptions = { COTException.class })
public void deleteCircleOfTrust() throws CLIException, COTException, SAML2MetaException {
entering("deleteCircleOfTrust", null);
String[] args = { "delete-cot", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_COT, NAME_COT };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
try {
cmdManager.serviceRequestQueue();
CircleOfTrustManager cotManager = new CircleOfTrustManager();
CircleOfTrustDescriptor objCircleOfTrust = cotManager.getCircleOfTrust("/", NAME_COT);
} finally {
exiting("deleteCircleOfTrust");
}
}
use of com.sun.identity.cot.CircleOfTrustDescriptor in project OpenAM by OpenRock.
the class SAML2Test method createCircleOfTrust.
@Test(groups = { "samlv2" })
public void createCircleOfTrust() throws CLIException, COTException, SAML2MetaException {
entering("createCircleOfTrust", null);
String[] args = { "create-cot", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_COT, NAME_COT };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
CircleOfTrustManager cotManager = new CircleOfTrustManager();
CircleOfTrustDescriptor objCircleOfTrust = cotManager.getCircleOfTrust("/", NAME_COT);
assert (objCircleOfTrust != null);
} finally {
exiting("createCircleOfTrust");
}
}
Aggregations