use of com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class SAML2IDPProxyFRImpl method getAttributeListValueFromIDPSSOConfig.
public List getAttributeListValueFromIDPSSOConfig(String realm, String hostEntityId, String attrName) {
String classMethod = "IDPSSOUtil.getAttributeValueFromIDPSSOConfig: ";
List result = null;
try {
IDPSSOConfigElement config = SAML2Utils.getSAML2MetaManager().getIDPSSOConfig(realm, hostEntityId);
Map attrs = SAML2MetaUtils.getAttributes(config);
List value = (List) attrs.get(attrName);
if (value != null && value.size() != 0) {
result = value;
}
} catch (SAML2MetaException sme) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message(classMethod + "get IDPSSOConfig failed:", sme);
}
result = null;
}
return result;
}
use of com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class NameIDMapping method getNameID.
private static NameID getNameID(NameIDMappingRequest nimRequest, String realm, String idpEntityID) {
NameID nameID = nimRequest.getNameID();
if (nameID == null) {
EncryptedID encryptedID = nimRequest.getEncryptedID();
try {
final IDPSSOConfigElement idpSsoConfig = metaManager.getIDPSSOConfig(realm, idpEntityID);
nameID = encryptedID.decrypt(KeyUtil.getDecryptionKeys(idpSsoConfig));
} catch (SAML2Exception ex) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("NameIDMapping.getNameID:", ex);
}
return null;
}
}
if (!SAML2Utils.isPersistentNameID(nameID)) {
return null;
}
return nameID;
}
use of com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement 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.saml2.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class IDPSSOUtil method getAttributeValueFromIDPSSOConfig.
public static String getAttributeValueFromIDPSSOConfig(String realm, String hostEntityId, String attrName) {
String classMethod = "IDPSSOUtil.getAttributeValueFromIDPSSOConfig: ";
String result = null;
try {
IDPSSOConfigElement config = metaManager.getIDPSSOConfig(realm, hostEntityId);
Map attrs = SAML2MetaUtils.getAttributes(config);
List value = (List) attrs.get(attrName);
if (value != null && value.size() != 0) {
result = (String) value.get(0);
}
} catch (SAML2MetaException sme) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message(classMethod + "get IDPSSOConfig failed:", sme);
}
result = null;
}
return result;
}
use of com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class GetIDPSPPairingInCOT method getHostedIDPMetaAlias.
private List getHostedIDPMetaAlias(String realm, List hostedIDP) throws WorkflowException {
try {
List list = new ArrayList();
SAML2MetaManager mgr = new SAML2MetaManager();
for (Iterator i = hostedIDP.iterator(); i.hasNext(); ) {
String e = (String) i.next();
IDPSSOConfigElement cfg = mgr.getIDPSSOConfig(realm, e);
list.add(e + "(" + cfg.getMetaAlias() + ")");
}
return list;
} catch (SAML2MetaException ex) {
throw new WorkflowException(ex.getMessage());
}
}
Aggregations