Package org.opensaml.xacml.profile.saml

Examples of org.opensaml.xacml.profile.saml.XACMLPolicyQueryType


/** Unmarshaller for {@link XACMLPolicyQueryType}. */
public class XACMLPolicyQueryTypeUnmarshaller extends RequestAbstractTypeUnmarshaller {

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
        XACMLPolicyQueryType xacmlpolicyquery = (XACMLPolicyQueryType) parentObject;

        if (childObject instanceof RequestType) {
            xacmlpolicyquery.getRequests().add((RequestType) childObject);
        } else if (childObject.getElementQName().equals(IdReferenceType.POLICY_ID_REFERENCE_ELEMENT_NAME)) {
            xacmlpolicyquery.getPolicyIdReferences().add((IdReferenceType) childObject);
        } else if (childObject.getElementQName().equals(IdReferenceType.POLICY_SET_ID_REFERENCE_ELEMENT_NAME)) {
            xacmlpolicyquery.getPolicySetIdReferences().add((IdReferenceType) childObject);
        } else {
            super.processChildElement(parentObject, childObject);
        }
    }
View Full Code Here


     */
    private static XACMLPolicyQueryType makeStandardPAPQuery() {

        XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

        XACMLPolicyQueryType xacmlPolicyQuery = (XACMLPolicyQueryType) builderFactory.getBuilder(XACMLPolicyQueryType.TYPE_NAME_XACML20)
                                                                                     .buildObject(XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getNamespaceURI(),
                                                                                                  XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getLocalPart(),
                                                                                                  XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getPrefix());

        IssuerBuilder issuerBuilder = (IssuerBuilder) builderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);

        Issuer issuer = issuerBuilder.buildObject();

        issuer.setValue("ISSUER_STRING");
        issuer.setFormat(NameID.ENTITY);

        xacmlPolicyQuery.setIssuer(issuer);
        xacmlPolicyQuery.setIssueInstant(new DateTime());

        xacmlPolicyQuery.setVersion(SAMLVersion.VERSION_20);
        xacmlPolicyQuery.setID("_12345");
        xacmlPolicyQuery.setIssueInstant(new DateTime());

        // Set: this is a PAP query
        ExtensionsBuilder eBuilder = (ExtensionsBuilder) builderFactory.getBuilder(new QName(SAMLConstants.SAML20MD_NS,
                                                                                             Extensions.LOCAL_NAME,
                                                                                             SAMLConstants.SAML20MD_PREFIX));
        Extensions extensions = eBuilder.buildObject();

        xacmlPolicyQuery.setExtensions(extensions);

        return xacmlPolicyQuery;
    }
View Full Code Here

            isPAPQuery = false;
        }
       
        XACMLPolicyCLIUtils.initOpenSAMLAndAttributeWizard();
       
        XACMLPolicyQueryType query = buildSamlXacmlQuery("IssuerString", isPAPQuery);
     
      Response response = samlClient.XACMLPolicyQuery(query);

      if (verboseMode) {
          System.out.println(XMLObjectHelper.toString(response));
View Full Code Here

        XMLObjectBuilderFactory bf = Configuration.getBuilderFactory();

        XACMLPolicyQueryTypeImplBuilder builder = (XACMLPolicyQueryTypeImplBuilder) bf.getBuilder(XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20);

        // TODO: submit bug to opensaml ?
        XACMLPolicyQueryType policyQuery = builder.buildObject(XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getNamespaceURI(),
                                                               XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getLocalPart(),
                                                               XACMLPolicyQueryType.DEFAULT_ELEMENT_NAME_XACML20.getPrefix());

        IssuerBuilder issuerBuilder = (IssuerBuilder) bf.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);

        Issuer issuer = issuerBuilder.buildObject();

        issuer.setValue(issuerString);
        issuer.setFormat(NameID.ENTITY);

        policyQuery.setIssuer(issuer);
        policyQuery.setIssueInstant(new DateTime());

        if (isPAPQuery) {

            // TODO: submit bug to opensaml?
            ExtensionsBuilder eBuilder = (ExtensionsBuilder) bf.getBuilder(new QName(SAMLConstants.SAML20MD_NS,
                Extensions.LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
            Extensions extensions = eBuilder.buildObject();

            policyQuery.setExtensions(extensions);

        }
        return policyQuery;
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xacml.profile.saml.XACMLPolicyQueryType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.