use of com.sun.identity.saml2.meta.SAML2MetaManager in project OpenAM by OpenRock.
the class ImportBulkFederationData method saml2GetRoleAndEntityId.
private void saml2GetRoleAndEntityId() throws CLIException {
try {
SAML2MetaManager saml2Mgr = new SAML2MetaManager(ssoToken);
String role = saml2Mgr.getRoleByMetaAlias(metaAlias);
if (role.equals(SAML2Constants.UNKNOWN_ROLE)) {
Object[] param = { metaAlias };
throw new CLIException(MessageFormat.format(getResourceString("import-bulk-federation-data-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
isIDP = role.equals(SAML2Constants.IDP_ROLE);
localEntityId = saml2Mgr.getEntityByMetaAlias(metaAlias);
} catch (SAML2MetaException e) {
debugError("ImportBulkFederationData.idffGetRoleAndEntityId", e);
Object[] param = { metaAlias };
throw new CLIException(MessageFormat.format(getResourceString("import-bulk-federation-data-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.saml2.meta.SAML2MetaManager in project OpenAM by OpenRock.
the class ImportEntityModelImpl method createSAMLv2Entity.
private void createSAMLv2Entity() throws AMConsoleException {
try {
EntityConfigElement configElt = null;
if (extendedMetaData != null) {
configElt = getEntityConfigElement();
if (configElt != null && configElt.isHosted()) {
List config = configElt.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
if (!config.isEmpty()) {
BaseConfigType bConfig = (BaseConfigType) config.iterator().next();
// get the realm from the extended meta and use
// for import
realm = SAML2MetaUtils.getRealmByMetaAlias(bConfig.getMetaAlias());
}
}
}
SAML2MetaManager metaManager = new SAML2MetaManager();
if (standardMetaData != null) {
importSAML2MetaData(metaManager, realm);
}
if (configElt != null) {
metaManager.createEntityConfig(realm, configElt);
}
} catch (SAML2MetaException e) {
throw new AMConsoleException(e);
}
}
use of com.sun.identity.saml2.meta.SAML2MetaManager in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getPEPDescriptor.
/**
* Returns a Map of PEP descriptor data.(Standard Metadata)
*
* @param realm realm of Entity
* @param entityName entity name of Entity Descriptor.
* @return key-value pair Map of PEP descriptor data.
* @throws AMConsoleException if unable to retrieve the PEP
* standard metadata attributes
*/
public Map getPEPDescriptor(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "XACML PEP" };
logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
Map data = null;
try {
SAML2MetaManager saml2Manager = getSAML2MetaManager();
XACMLAuthzDecisionQueryDescriptorElement xacmlAuthzDescriptor = saml2Manager.getPolicyEnforcementPointDescriptor(realm, entityName);
if (xacmlAuthzDescriptor != null) {
data = new HashMap(10);
//ProtocolSupportEnum
data.put(ATTR_TXT_PROTOCOL_SUPPORT_ENUM, returnEmptySetIfValueIsNull(xacmlAuthzDescriptor.getProtocolSupportEnumeration()));
if (xacmlAuthzDescriptor.isWantAssertionsSigned()) {
data.put(ATTR_WANT_ASSERTION_SIGNED, "true");
} else {
data.put(ATTR_WANT_ASSERTION_SIGNED, "false");
}
}
logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "XACML PEP", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (data != null) ? data : Collections.EMPTY_MAP;
}
use of com.sun.identity.saml2.meta.SAML2MetaManager in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method setIDPExtAttributeValues.
/**
* Saves the extended attribute values for the Identiy Provider.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @param idpExtValues Map which contains the standard attribute values.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setIDPExtAttributeValues(String realm, String entityName, Map idpExtValues, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "IDP-Extended" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
String role = EntityModel.IDENTITY_PROVIDER;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
//entityConfig is the extended entity configuration object
EntityConfigElement entityConfig = samlManager.getEntityConfig(realm, entityName);
//for remote cases
if (entityConfig == null) {
createExtendedObject(realm, entityName, location, role);
entityConfig = samlManager.getEntityConfig(realm, entityName);
}
IDPSSOConfigElement idpssoConfig = samlManager.getIDPSSOConfig(realm, entityName);
if (idpssoConfig != null) {
updateBaseConfig(idpssoConfig, idpExtValues, role);
}
//saves the attributes by passing the new entityConfig object
samlManager.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (SAML2MetaException e) {
debug.error("SAMLv2ModelImpl.setIDPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "IDP-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
} catch (JAXBException e) {
debug.error("SAMLv2ModelImpl.setIDPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "IDP-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
} catch (AMConsoleException e) {
debug.error("SAMLv2ModelImpl.setIDPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "IDP-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
}
}
use of com.sun.identity.saml2.meta.SAML2MetaManager in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getPDPConfig.
/**
* Returns a Map of PDP Config data. (Extended Metadata)
*
* @param realm realm of Entity
* @param entityName entity name of Entity Descriptor
* @param location location of entity(hosted or remote)
* @return key-value pair Map of PPP config data.
* @throws AMConsoleException if unable to retrieve the PDP
* extended metadata attribute
*/
public Map getPDPConfig(String realm, String entityName, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "XACML PDP" };
logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
String role = EntityModel.POLICY_DECISION_POINT_DESCRIPTOR;
Map data = null;
List configList = null;
String metaAlias = null;
try {
SAML2MetaManager saml2Manager = getSAML2MetaManager();
XACMLPDPConfigElement xacmlPDPConfigElement = saml2Manager.getPolicyDecisionPointConfig(realm, entityName);
if (xacmlPDPConfigElement != null) {
data = new HashMap();
configList = xacmlPDPConfigElement.getAttribute();
metaAlias = xacmlPDPConfigElement.getMetaAlias();
int size = configList.size();
for (int i = 0; i < size; i++) {
AttributeType atype = (AttributeType) configList.get(i);
String name = atype.getName();
java.util.List value = atype.getValue();
data.put(atype.getName(), returnEmptySetIfValueIsNull(atype.getValue()));
}
data.put("metaAlias", metaAlias);
} else {
createExtendedObject(realm, entityName, location, role);
}
logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
} catch (JAXBException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "XACML PDP", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
} catch (SAML2MetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "XACML PDP", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (data != null) ? data : Collections.EMPTY_MAP;
}
Aggregations