use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method removeFromCircleOfTrust.
private void removeFromCircleOfTrust(String realm, String entityId) {
try {
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
boolean isAffiliation = false;
if (getAffiliationDescriptor(realm, entityId) != null) {
isAffiliation = true;
}
if (debug.messageEnabled()) {
debug.message("SAML2MetaManager.removeFromCircleOfTrust is " + entityId + " in realm " + realm + " an affiliation? " + isAffiliation);
}
if (eConfig != null) {
List elist = null;
if (isAffiliation) {
AffiliationConfigElement affiliationCfgElm = getAffiliationConfig(realm, entityId);
elist = new ArrayList();
elist.add(affiliationCfgElm);
} else {
elist = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
}
// use first one to delete the entity from COT
BaseConfigType config = (BaseConfigType) elist.iterator().next();
Map attr = SAML2MetaUtils.getAttributes(config);
List cotAttr = (List) attr.get(SAML2Constants.COT_LIST);
List cotList = new ArrayList(cotAttr);
if ((cotList != null) && !cotList.isEmpty()) {
for (Iterator iter = cotList.iterator(); iter.hasNext(); ) {
String cotName = ((String) iter.next()).trim();
if ((cotName != null) && (!cotName.equals(""))) {
cotm.removeCircleOfTrustMember(realm, cotName, COTConstants.SAML2, entityId, false);
}
}
}
}
} catch (Exception e) {
debug.error("SAML2MetaManager.removeFromCircleOfTrust:" + "Error while removing entity" + entityId + "from COT.", e);
}
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getSPSSOConfig.
/**
* Returns first service provider's SSO configuration in an entity under
* the realm.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return <code>SPSSOConfigElement</code> for the entity or null if not
* found.
* @throws SAML2MetaException if unable to retrieve the first service
* provider's SSO configuration.
*/
public SPSSOConfigElement getSPSSOConfig(String realm, String entityId) throws SAML2MetaException {
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
if (eConfig == null) {
return null;
}
List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
Object obj = iter.next();
if (obj instanceof SPSSOConfigElement) {
return (SPSSOConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getPolicyEnforcementPointConfig.
/**
* Returns first policy enforcement point configuration in an entity under
* the realm.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return policy decision point configuration or null if it is not found.
* @throws SAML2MetaException if unable to retrieve the configuration.
*/
public XACMLAuthzDecisionQueryConfigElement getPolicyEnforcementPointConfig(String realm, String entityId) throws SAML2MetaException {
XACMLAuthzDecisionQueryConfigElement elm = null;
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
if (eConfig != null) {
List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator i = list.iterator(); i.hasNext() && (elm == null); ) {
Object obj = i.next();
if (obj instanceof XACMLAuthzDecisionQueryConfigElement) {
elm = (XACMLAuthzDecisionQueryConfigElement) obj;
}
}
}
return elm;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getEntityByMetaAlias.
/**
* Returns entity ID associated with the metaAlias.
* @param metaAlias The metaAlias.
* @return entity ID associated with the metaAlias or null if not found.
* @throws SAML2MetaException if unable to retrieve the entity ids.
*/
public String getEntityByMetaAlias(String metaAlias) throws SAML2MetaException {
String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds == null || entityIds.isEmpty()) {
return null;
}
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String entityId = (String) iter.next();
EntityConfigElement config = getEntityConfig(realm, entityId);
if ((config == null) || !config.isHosted()) {
continue;
}
List list = config.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator iter2 = list.iterator(); iter2.hasNext(); ) {
BaseConfigType bConfig = (BaseConfigType) iter2.next();
String cMetaAlias = bConfig.getMetaAlias();
if (cMetaAlias != null && cMetaAlias.equals(metaAlias)) {
return entityId;
}
}
}
} catch (ConfigurationException e) {
debug.error("SAML2MetaManager.getEntityByMetaAlias:", e);
throw new SAML2MetaException(e);
}
return null;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getAttributeQueryConfig.
/**
* Returns first attribute query configuration in an entity under
* the realm.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return <code>AttributeQueryConfigElement</code> for the entity or
* null if not found.
* @throws SAML2MetaException if unable to retrieve the first attribute
* query configuration.
*/
public AttributeQueryConfigElement getAttributeQueryConfig(String realm, String entityId) throws SAML2MetaException {
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
if (eConfig == null) {
return null;
}
List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
Object obj = iter.next();
if (obj instanceof AttributeQueryConfigElement) {
return (AttributeQueryConfigElement) obj;
}
}
return null;
}
Aggregations