Package org.opensaml.xml.schema

Examples of org.opensaml.xml.schema.XSString


        Attribute attribute = attributeV1Builder.buildObject();
        attribute.setAttributeName(attributeName);
        attribute.setAttributeNamespace(attributeUrn);
       
        for (String value : values) {
            XSString attribute1 =
                stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
            attribute1.setValue(value);
            attribute.getAttributeValues().add(attribute1);
        }

        return attribute;
    }
View Full Code Here


        if (stringBuilder == null) {
            stringBuilder = (XSStringBuilder)builderFactory.getBuilder(XSString.TYPE_NAME);
        }
        Attribute attribute = createAttribute(friendlyName, name);
        for (String value : values) {
            XSString attributeValue =
                stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
            attributeValue.setValue(value);
            attribute.getAttributeValues().add(attributeValue);
        }

        return attribute;
    }
View Full Code Here

        Attribute attribute = attributeV1Builder.buildObject();
        attribute.setAttributeName(attributeName);
        attribute.setAttributeNamespace(attributeUrn);
       
        for (String value : values) {
            XSString attribute1 =
                stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
            attribute1.setValue(value);
            attribute.getAttributeValues().add(attribute1);
        }

        return attribute;
    }
View Full Code Here

     *
     * @param value the value
     * @return the xS string
     */
    private XSString newAttributeValue(final Object value) {
        final XSString stringValue = this.attrValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
        if (value instanceof String) {
            stringValue.setValue((String) value);
        } else {
            stringValue.setValue(value.toString());
        }
        return stringValue;
    }
View Full Code Here

    @Override
    protected AttributeStatement buildAttributeStatement() throws IllegalStateException {

        logger.debug("Building Attribute Value");
        XSString attributeValue = ((XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME)).buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
        if (getUserId() != null) {
            logger.debug("Building XSStringBuilder for AttributeValue");
            attributeValue.setValue(getUserId());
            logger.debug("attributeValue set to: " + getUserId());
        } else {
            throw new IllegalStateException("User Id must not be null in Attribute Value");
        }
View Full Code Here

    @Override
    protected AttributeStatement buildAttributeStatement() throws IllegalStateException {

        logger.debug("Building Attribute Value");
        XSString attributeValue = ((XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME)).buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
        if (getUserId() != null) {
            logger.debug("Building XSStringBuilder for AttributeValue");
            attributeValue.setValue(getUserId());
            logger.debug("attributeValue set to: " + getUserId());
        } else {
            throw new IllegalStateException("User Id must not be null in Attribute Value");
        }
View Full Code Here

        AttributeStatement attributeStatement = ((SAMLObjectBuilder<AttributeStatement>) builderFactory
                .getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME))
                .buildObject();

        if (ssoStartPage != null) {
            XSString ssoStartPageAttributeValue = ((XSStringBuilder) Configuration
                    .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                    .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                            XSString.TYPE_NAME);
            ssoStartPageAttributeValue.setValue(ssoStartPage);

            Attribute ssoStartPageAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                    .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
            ssoStartPageAttribute.setName("ssoStartPage");
            ssoStartPageAttribute
                    .setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
            ssoStartPageAttribute.getAttributeValues().add(
                    ssoStartPageAttributeValue);

            attributeStatement.getAttributes().add(ssoStartPageAttribute);
        }

        if (logoutURL != null) {
            XSString logoutUrlAttributeValue = ((XSStringBuilder) Configuration
                    .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                    .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                            XSString.TYPE_NAME);
            logoutUrlAttributeValue.setValue(logoutURL);

            Attribute logoutUrlAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                    .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
            logoutUrlAttribute.setName("logoutURL");
            logoutUrlAttribute
                    .setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
            logoutUrlAttribute.getAttributeValues()
                    .add(logoutUrlAttributeValue);

            attributeStatement.getAttributes().add(logoutUrlAttribute);
        }

        if (EnumSet.of(UserType.PORTAL, UserType.SITE).contains(userType)) {
            XSString orgIdAttributeValue = ((XSStringBuilder) Configuration
                    .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                    .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                            XSString.TYPE_NAME);
            orgIdAttributeValue.setValue(orgId);

            Attribute orgIdAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                    .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
            orgIdAttribute.setName("organization_id");
            orgIdAttribute
                    .setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
            orgIdAttribute.getAttributeValues().add(orgIdAttributeValue);

            attributeStatement.getAttributes().add(orgIdAttribute);

            XSString portalIdAttributeValue = ((XSStringBuilder) Configuration
                    .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                    .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                            XSString.TYPE_NAME);
            portalIdAttributeValue.setValue(portalId);

            Attribute portalIdAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                    .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
            portalIdAttribute.setName("portal_id");
            portalIdAttribute
                    .setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
            portalIdAttribute.getAttributeValues().add(portalIdAttributeValue);

            attributeStatement.getAttributes().add(portalIdAttribute);
        }

        if (userType == UserType.SITE) {

            XSString siteURLAttributeValue = ((XSStringBuilder) Configuration
                    .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                    .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                            XSString.TYPE_NAME);
            siteURLAttributeValue.setValue(siteURL);

            Attribute siteURLAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                    .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
            siteURLAttribute.setName("siteurl");
            siteURLAttribute
                    .setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
            siteURLAttribute.getAttributeValues().add(siteURLAttributeValue);

            attributeStatement.getAttributes().add(siteURLAttribute);

        }

        if (basicAttributes != null) {
            attributeStatement.getAttributes().addAll(basicAttributes);
        }

        if (additionalAttributes != null) {

            String attribs = additionalAttributes.trim();
            String key = "";
            String val = "";

            StringTokenizer st = new StringTokenizer(attribs, "=;");
            while( st.hasMoreTokens() ) {
                   key = st.nextToken();
                   val = st.nextToken();
                   logger.debug("Key/value pair:" + "key" + "/" + val);
                   XSString additionalAttributeValue = ((XSStringBuilder) Configuration
                           .getBuilderFactory().getBuilder(XSString.TYPE_NAME))
                           .buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                                   XSString.TYPE_NAME);
                   additionalAttributeValue.setValue(val);

                   Attribute additionalAttribute = ((SAMLObjectBuilder<Attribute>) builderFactory
                           .getBuilder(Attribute.DEFAULT_ELEMENT_NAME)).buildObject();
                   additionalAttribute.setName(key);
                   additionalAttribute.setNameFormat("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
View Full Code Here

    private Attribute getSAML2Attribute(String name, String value, String namespace) {
        XMLObjectBuilderFactory builderFactory = null;
        SAMLObjectBuilder<Attribute> attrBuilder = null;
        Attribute attribute = null;
        XSStringBuilder attributeValueBuilder = null;
        XSString stringValue = null;

        builderFactory = Configuration.getBuilderFactory();
        attrBuilder = (SAMLObjectBuilder<Attribute>) builderFactory
                .getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
        attribute = attrBuilder.buildObject();
        attribute.setName(name);
        attribute.setNameFormat(namespace);

        attributeValueBuilder = (XSStringBuilder) builderFactory.getBuilder(XSString.TYPE_NAME);
        stringValue = attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                XSString.TYPE_NAME);
        stringValue.setValue(value);
        attribute.getAttributeValues().add(stringValue);
        return attribute;
    }
View Full Code Here

        }
        Attribute attribute = createAttribute(friendlyName, name, nameFormat);
       
        for (Object value : values) {
            if (value instanceof String) {
                XSString attributeValue =
                    stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
                attributeValue.setValue((String)value);
                attribute.getAttributeValues().add(attributeValue);
            } else if (value instanceof XMLObject) {
                attribute.getAttributeValues().add((XMLObject)value);
            }
        }
View Full Code Here

        attribute.setAttributeName(attributeName);
        attribute.setAttributeNamespace(attributeUrn);
       
        for (Object value : values) {
            if (value instanceof String) {
                XSString attribute1 =
                    stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
                attribute1.setValue((String)value);
                attribute.getAttributeValues().add(attribute1);
            } else if (value instanceof XMLObject) {
                attribute.getAttributeValues().add((XMLObject)value);
            }
        }
View Full Code Here

TOP

Related Classes of org.opensaml.xml.schema.XSString

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.