use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaCache method getEntityConfig.
/**
* Returns extended entity configuration under the realm from cache.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return <code>EntityConfigElement</code> object for the entity or null
* if not found.
*/
static EntityConfigElement getEntityConfig(String realm, String entityId) {
String cacheKey = buildCacheKey(realm, entityId);
EntityConfigElement config = (EntityConfigElement) configCache.get(cacheKey);
if (debug.messageEnabled()) {
debug.message("SAML2MetaCache.getEntityConfig: cacheKey = " + cacheKey + ", found = " + (config != null));
}
return config;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getAuthnAuthorityConfig.
/**
* Returns first authentication authority 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>AuthnAuthorityConfigElement</code> for the entity or
* null if not found.
* @throws SAML2MetaException if unable to retrieve the first authentication
* authority configuration.
*/
public AuthnAuthorityConfigElement getAuthnAuthorityConfig(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 AuthnAuthorityConfigElement) {
return (AuthnAuthorityConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getAllRemoteEntities.
/**
* Returns all remote entities under the realm.
* @param realm The realm under which the hosted entities reside.
* @return a <code>List</code> of entity ID <code>String</code>.
* @throws SAML2MetaException if unable to retrieve the entity ids.
*/
public List getAllRemoteEntities(String realm) throws SAML2MetaException {
List remoteEntityIds = new ArrayList();
String[] objs = { realm };
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds != null && !entityIds.isEmpty()) {
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String entityId = (String) iter.next();
EntityConfigElement config = getEntityConfig(realm, entityId);
if (config == null || !config.isHosted()) {
remoteEntityIds.add(entityId);
}
}
}
} catch (ConfigurationException e) {
debug.error("SAML2MetaManager.getAllRemoteEntities:", e);
String[] data = { e.getMessage(), realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_GET_ALL_REMOTE_ENTITIES, data, null);
throw new SAML2MetaException(e);
}
LogUtil.access(Level.FINE, LogUtil.GOT_ALL_REMOTE_ENTITIES, objs, null);
return remoteEntityIds;
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method addToCircleOfTrust.
private void addToCircleOfTrust(String realm, String entityId, EntityConfigElement eConfig) {
try {
if (eConfig != null) {
List elist = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
// use first one to add the entity to 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.addCircleOfTrustMember(realm, cotName, COTConstants.SAML2, entityId, false);
}
}
}
}
} catch (Exception e) {
debug.error("SAML2MetaManager.addToCircleOfTrust:" + "Error while adding entity" + entityId + "to COT.", e);
}
}
use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getAttributeAuthorityConfig.
/**
* Returns first attribute authority 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>AttributeAuthorityConfigElement</code> for the entity or
* null if not found.
* @throws SAML2MetaException if unable to retrieve the first attribute
* authority configuration.
*/
public AttributeAuthorityConfigElement getAttributeAuthorityConfig(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 AttributeAuthorityConfigElement) {
return (AttributeAuthorityConfigElement) obj;
}
}
return null;
}
Aggregations