use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method createEntityConfig.
/**
* Creates the extended entity configuration under the realm.
*
* @param realm The realm under which the entity configuration will be
* created.
* @param config The extended entity configuration object to be created.
* @throws WSFederationMetaException if unable to create the entity
* configuration.
*/
public void createEntityConfig(String realm, FederationConfigElement config) throws WSFederationMetaException {
String federationId = config.getFederationID();
if (federationId == null) {
debug.error("WSFederationMetaManager.createEntityConfig: " + "entity ID is null");
String[] data = { realm };
LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_ID_CREATE_ENTITY_CONFIG, data, null);
throw new WSFederationMetaException("empty_entityid", null);
}
if (realm == null) {
realm = "/";
}
String[] objs = { federationId, realm };
try {
Map attrs = WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_ENTITY_CONFIG, config);
Map oldAttrs = configInst.getConfiguration(realm, federationId);
if (oldAttrs == null) {
LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_DESCRIPTOR_CREATE_ENTITY_CONFIG, objs, null);
throw new WSFederationMetaException("entity_descriptor_not_exist", objs);
}
Set oldValues = (Set) oldAttrs.get(ATTR_ENTITY_CONFIG);
if (oldValues != null && !oldValues.isEmpty()) {
LogUtil.error(Level.INFO, LogUtil.ENTITY_CONFIG_EXISTS, objs, null);
throw new WSFederationMetaException("entity_config_exists", objs);
}
configInst.setConfiguration(realm, federationId, attrs);
LogUtil.access(Level.INFO, LogUtil.ENTITY_CONFIG_CREATED, objs, null);
// Add the entity to cot
SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
if (spconfig != null) {
addToCircleOfTrust(spconfig, realm, federationId);
}
IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
if (idpconfig != null) {
addToCircleOfTrust(idpconfig, realm, federationId);
}
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.createEntityConfig:", e);
String[] data = { e.getMessage(), federationId, realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_CREATE_ENTITY_CONFIG, data, null);
throw new WSFederationMetaException(e);
} catch (JAXBException jaxbe) {
debug.error("WSFederationMetaManager.createEntityConfig:", jaxbe);
LogUtil.error(Level.INFO, LogUtil.CREATE_INVALID_ENTITY_CONFIG, objs, null);
throw new WSFederationMetaException("invalid_config", objs);
}
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method getAllHostedIdentityProviderMetaAliases.
/**
* Returns metaAliases of all hosted identity providers under the realm.
*
* @param realm The realm under which the identity provider metaAliases
* reside.
* @return a <code>List</code> of metaAliases <code>String</code>.
* @throws WSFederationMetaException if unable to retrieve meta aliases.
*/
public List<String> getAllHostedIdentityProviderMetaAliases(String realm) throws WSFederationMetaException {
List<String> metaAliases = new ArrayList<String>();
IDPSSOConfigElement idpConfig = null;
List<String> hostedEntityIds = getAllHostedIdentityProviderEntities(realm);
for (String federationId : hostedEntityIds) {
if ((idpConfig = getIDPSSOConfig(realm, federationId)) != null) {
metaAliases.add(idpConfig.getMetaAlias());
}
}
return metaAliases;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method isTrustedProvider.
/**
* Determines whether two entities are in the same circle of trust
* under the realm.
*
* @param realm The realm under which the entity resides.
* @param federationId The ID of the entity
* @param trustedEntityId The ID of the entity
* @throws WSFederationMetaException if unable to determine the trusted
* relationship.
*/
public boolean isTrustedProvider(String realm, String federationId, String trustedEntityId) throws WSFederationMetaException {
boolean result = false;
SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
if (spconfig != null) {
result = isSameCircleOfTrust(spconfig, realm, trustedEntityId);
}
if (result) {
return true;
}
IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
if (idpconfig != null) {
return (isSameCircleOfTrust(idpconfig, realm, trustedEntityId));
}
return false;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method getIDPSSOConfig.
/**
* Returns first identity provider's SSO configuration in an entity under
* the realm.
*
* @param realm The realm under which the entity resides.
* @param federationId ID of the entity to be retrieved.
* @return <code>IDPSSOConfigElement</code> for the entity or null if not
* found.
* @throws WSFederationMetaException if unable to retrieve the first
* identity provider's SSO configuration.
*/
public IDPSSOConfigElement getIDPSSOConfig(String realm, String federationId) throws WSFederationMetaException {
FederationConfigElement eConfig = getEntityConfig(realm, federationId);
if (eConfig == null) {
return null;
}
List list = eConfig.getIDPSSOConfigOrSPSSOConfig();
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
Object obj = iter.next();
if (obj instanceof IDPSSOConfigElement) {
return (IDPSSOConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method getIdentityProviderAttributes.
/**
* Returns a <code>Map</code> with identity provider attributes and values.
*
* @param realm to which the entity belongs.
* @param fedId is the Federation Id otherwise known as the entity id.
* @return attribute values of IDP based on realm and fedId passed.
* @throws AMConsoleException if unable to retreive the Identity Provider
* attrubutes based on the realm and fedId passed.
*/
public Map getIdentityProviderAttributes(String realm, String fedId) throws AMConsoleException {
Map IDPAttributes = null;
try {
WSFederationMetaManager metaManager = getWSFederationMetaManager();
IDPSSOConfigElement idpconfig = metaManager.getIDPSSOConfig(realm, fedId);
if (idpconfig != null) {
IDPAttributes = WSFederationMetaUtils.getAttributes(idpconfig);
}
} catch (WSFederationMetaException e) {
debug.warning("WSFedPropertiesModelImpl.getIdentityProviderAttributes", e);
throw new AMConsoleException(e.getMessage());
}
return (IDPAttributes != null) ? IDPAttributes : Collections.EMPTY_MAP;
}
Aggregations