use of com.sun.identity.saml2.jaxb.metadata.XACMLAuthzServiceElement in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method updatePDPDescriptor.
/**
* Save standard metadata for PDP descriptor.
*
* @param realm realm of Entity.
* @param entityName entity name of Entity Descriptor.
* @param attrValues key-value pair Map of PDP standed data.
* @throws AMConsoleException if fails to modify/save the PDP
* standard metadata attribute
*/
public void updatePDPDescriptor(String realm, String entityName, Map attrValues) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "XACML PDP" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
try {
SAML2MetaManager saml2Manager = getSAML2MetaManager();
EntityDescriptorElement entityDescriptor = saml2Manager.getEntityDescriptor(realm, entityName);
XACMLPDPDescriptorElement pdpDescriptor = saml2Manager.getPolicyDecisionPointDescriptor(realm, entityName);
if (pdpDescriptor != null) {
List authzServiceList = pdpDescriptor.getXACMLAuthzService();
if (authzServiceList.size() != 0) {
XACMLAuthzServiceElement authzService = (XACMLAuthzServiceElement) authzServiceList.get(0);
authzService.setLocation((String) AMAdminUtils.getValue((Set) attrValues.get(ATTR_XACML_AUTHZ_SERVICE_LOCATION)));
}
}
saml2Manager.setEntityDescriptor(realm, entityDescriptor);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (SAML2MetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "XACML PDP", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.saml2.jaxb.metadata.XACMLAuthzServiceElement in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getPDPDescriptor.
/**
* Returns a Map of PDP descriptor data.(Standard Metadata)
*
* @param realm realm of Entity
* @param entityName entity name of Entity Descriptor.
* @return key-value pair Map of PDP descriptor data.
* @throws AMConsoleException if unable to retrieve the PDP
* standard metadata attribute
*/
public Map getPDPDescriptor(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "XACML PDP" };
logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
Map data = null;
try {
SAML2MetaManager saml2Manager = getSAML2MetaManager();
XACMLPDPDescriptorElement xacmlPDPDescriptor = saml2Manager.getPolicyDecisionPointDescriptor(realm, entityName);
if (xacmlPDPDescriptor != null) {
data = new HashMap(10);
//ProtocolSupportEnum
data.put(ATTR_TXT_PROTOCOL_SUPPORT_ENUM, returnEmptySetIfValueIsNull(xacmlPDPDescriptor.getProtocolSupportEnumeration()));
List authzServiceList = xacmlPDPDescriptor.getXACMLAuthzService();
if (authzServiceList.size() != 0) {
XACMLAuthzServiceElement authzService = (XACMLAuthzServiceElement) authzServiceList.get(0);
data.put(ATTR_XACML_AUTHZ_SERVICE_BINDING, returnEmptySetIfValueIsNull(authzService.getBinding()));
data.put(ATTR_XACML_AUTHZ_SERVICE_LOCATION, returnEmptySetIfValueIsNull(authzService.getLocation()));
}
}
logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
} 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;
}
use of com.sun.identity.saml2.jaxb.metadata.XACMLAuthzServiceElement in project OpenAM by OpenRock.
the class QueryClient method getPDPEndPoint.
/**
* Returns the Policy Decision Point End Point (PDP) URL.
*
* @param pdpEntityID entity Identifier of the PDP.
* @return the PDP endpoint URL.
* @exception if there is an error retreiving the endpoint from the
* configuration.
*/
private static String getPDPEndPoint(String pdpEntityID) throws SAML2Exception {
String endPoint = null;
String classMethod = "QueryClient:getPDPEndPoint";
if (saml2MetaManager != null) {
try {
XACMLPDPDescriptorElement pdpDescriptor = saml2MetaManager.getPolicyDecisionPointDescriptor(null, pdpEntityID);
if (pdpDescriptor != null) {
List xacmlPDP = pdpDescriptor.getXACMLAuthzService();
if (xacmlPDP != null) {
Iterator i = xacmlPDP.iterator();
while (i.hasNext()) {
Object o = (Object) i.next();
if (o instanceof XACMLAuthzServiceElement) {
XACMLAuthzServiceElement xType = (XACMLAuthzServiceElement) o;
endPoint = xType.getLocation();
if (debug.messageEnabled()) {
debug.message(classMethod + "EndPoint :" + endPoint);
}
}
break;
}
}
}
} catch (SAML2MetaException sme) {
if (debug.messageEnabled()) {
debug.message(classMethod + "Error retreiving PDP Meta", sme);
}
String[] args = { pdpEntityID };
LogUtil.error(Level.INFO, LogUtil.PDP_METADATA_ERROR, args);
throw new SAML2Exception(SAML2SDKUtils.BUNDLE_NAME, "pdpMetaRetreivalError", args);
}
}
return endPoint;
}
Aggregations