use of com.sun.identity.saml2.assertion.Subject in project OpenAM by OpenRock.
the class SubjectQueryAbstractImpl method parseDOMChileElements.
/**
* Parses child elements of the Docuemnt Element for this object.
*
* @param iter the child elements iterator.
* @throws SAML2Exception if error parsing the Document Element.
*/
protected void parseDOMChileElements(ListIterator iter) throws SAML2Exception {
super.parseDOMChileElements(iter);
if (iter.hasNext()) {
Element childElement = (Element) iter.next();
String localName = childElement.getLocalName();
if (SAML2Constants.SUBJECT.equals(localName)) {
subject = AssertionFactory.getInstance().createSubject(childElement);
return;
}
}
if (SAML2SDKUtils.debug.messageEnabled()) {
SAML2SDKUtils.debug.message("SubjectQueryAbstractImpl." + "parseDOMChileElements: Subject is expected");
}
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("schemaViolation"));
}
use of com.sun.identity.saml2.assertion.Subject in project OpenAM by OpenRock.
the class XACMLRequestProcessor method processRequest.
/**
* Processes an XACML context Request and returns an XACML context
* Response.
*
* @param xacmlRequest XACML context Request. This describes the
* Resource(s), Subject(s), Action, Environment of the request
* and corresponds to XACML context schema element Request.
* One would contruct this Request object using XACML client SDK.
*
* @param pdpEntityId EntityID of PDP
* @param pepEntityId EntityID of PEP
* @return XACML context Response. This corresponds to
* XACML context schema element Response
* @exception XACMLException if request could not be processed
*/
public Response processRequest(Request xacmlRequest, String pdpEntityId, String pepEntityId) throws XACMLException, SAML2Exception {
if (XACMLSDKUtils.debug.messageEnabled()) {
XACMLSDKUtils.debug.message("XACMLRequestProcessor.processRequest(), entering" + ":pdpEntityId=" + pdpEntityId + ":pepEntityId=" + pepEntityId + ":xacmlRequest=\n" + xacmlRequest.toXMLString(true, true));
}
XACMLAuthzDecisionQuery samlpQuery = createXACMLAuthzDecisionQuery(xacmlRequest);
//set InputContextOnly
samlpQuery.setInputContextOnly(true);
//set ReturnContext
samlpQuery.setReturnContext(true);
if (XACMLSDKUtils.debug.messageEnabled()) {
XACMLSDKUtils.debug.message("XACMLRequestProcessor.processRequest()," + "samlpQuery=\n" + samlpQuery.toXMLString(true, true));
}
com.sun.identity.saml2.protocol.Response samlpResponse = QueryClient.processXACMLQuery(samlpQuery, pepEntityId, pdpEntityId);
if (XACMLSDKUtils.debug.messageEnabled()) {
XACMLSDKUtils.debug.message("XACMLRequestProcessor.processRequest()," + ":samlpResponse=\n" + samlpResponse.toXMLString(true, true));
}
Response xacmlResponse = null;
List assertions = samlpResponse.getAssertion();
if (assertions != null) {
Assertion assertion = (Assertion) (assertions.get(0));
if (assertion != null) {
List statements = assertion.getStatements();
if (statements.size() > 0) {
String statementString = (String) (statements.get(0));
if (statementString != null) {
XACMLAuthzDecisionStatement statement = ContextFactory.getInstance().createXACMLAuthzDecisionStatement(statementString);
if (XACMLSDKUtils.debug.messageEnabled()) {
XACMLSDKUtils.debug.message("XACMLRequestProcessor.processRequest()," + ":xacmlAuthzDecisionStatement=\n" + statement.toXMLString(true, true));
}
if (statement != null) {
xacmlResponse = statement.getResponse();
if (xacmlResponse != null) {
if (XACMLSDKUtils.debug.messageEnabled()) {
XACMLSDKUtils.debug.message("XACMLRequestProcessor.processRequest()" + ",returning :xacmlResponse=\n" + xacmlResponse.toXMLString(true, true));
}
return xacmlResponse;
}
}
}
}
}
}
return null;
}
Aggregations