Search in sources :

Example 1 with OneTimeUse

use of com.sun.identity.saml2.assertion.OneTimeUse in project OpenAM by OpenRock.

the class ConditionsImpl method toXMLString.

/**
    * Returns a String representation
    * @param includeNSPrefix Determines whether or not the namespace 
    *        qualifier is prepended to the Element when converted
    * @param declareNS Determines whether or not the namespace is 
    *        declared within the Element.
    * @return A String representation
    * @exception SAML2Exception if something is wrong during conversion
    */
public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception {
    StringBuffer sb = new StringBuffer(2000);
    String NS = "";
    String appendNS = "";
    if (declareNS) {
        NS = SAML2Constants.ASSERTION_DECLARE_STR;
    }
    if (includeNSPrefix) {
        appendNS = SAML2Constants.ASSERTION_PREFIX;
    }
    sb.append("<").append(appendNS).append(CONDITIONS_ELEMENT).append(NS);
    String str = null;
    if (notBefore != null) {
        str = DateUtils.toUTCDateFormat(notBefore);
        sb.append(" ").append(NOT_BEFORE_ATTR).append("=\"").append(str).append("\"");
    }
    if (notOnOrAfter != null) {
        str = DateUtils.toUTCDateFormat(notOnOrAfter);
        sb.append(" ").append(NOT_ON_OR_AFTER_ATTR).append("=\"").append(str).append("\"");
    }
    sb.append(">\n");
    int length = 0;
    if (conditions != null) {
        length = conditions.size();
        for (int i = 0; i < length; i++) {
            Condition condition = (Condition) conditions.get(i);
            sb.append(condition.toXMLString(includeNSPrefix, false));
        }
    }
    if (audienceRestrictions != null) {
        length = audienceRestrictions.size();
        for (int i = 0; i < length; i++) {
            AudienceRestriction ar = (AudienceRestriction) audienceRestrictions.get(i);
            sb.append(ar.toXMLString(includeNSPrefix, false));
        }
    }
    if (oneTimeUses != null) {
        length = oneTimeUses.size();
        for (int i = 0; i < length; i++) {
            OneTimeUse ar = (OneTimeUse) oneTimeUses.get(i);
            sb.append(ar.toXMLString(includeNSPrefix, false));
        }
    }
    if (proxyRestrictions != null) {
        length = proxyRestrictions.size();
        for (int i = 0; i < length; i++) {
            ProxyRestriction pr = (ProxyRestriction) proxyRestrictions.get(i);
            sb.append(pr.toXMLString(includeNSPrefix, false));
        }
    }
    sb.append("</").append(appendNS).append(CONDITIONS_ELEMENT).append(">\n");
    return sb.toString();
}
Also used : Condition(com.sun.identity.saml2.assertion.Condition) AudienceRestriction(com.sun.identity.saml2.assertion.AudienceRestriction) OneTimeUse(com.sun.identity.saml2.assertion.OneTimeUse) ProxyRestriction(com.sun.identity.saml2.assertion.ProxyRestriction)

Example 2 with OneTimeUse

use of com.sun.identity.saml2.assertion.OneTimeUse in project OpenAM by OpenRock.

the class ConditionsImpl method makeImmutable.

/**
    * Makes the object immutable
    */
public void makeImmutable() {
    if (isMutable) {
        if (conditions != null) {
            int length = conditions.size();
            for (int i = 0; i < length; i++) {
                Condition condition = (Condition) conditions.get(i);
                condition.makeImmutable();
            }
            conditions = Collections.unmodifiableList(conditions);
        }
        if (audienceRestrictions != null) {
            int length = audienceRestrictions.size();
            for (int i = 0; i < length; i++) {
                AudienceRestriction ar = (AudienceRestriction) audienceRestrictions.get(i);
                ar.makeImmutable();
            }
            audienceRestrictions = Collections.unmodifiableList(audienceRestrictions);
        }
        if (oneTimeUses != null) {
            int length = oneTimeUses.size();
            for (int i = 0; i < length; i++) {
                OneTimeUse oneTimeUse = (OneTimeUse) oneTimeUses.get(i);
                oneTimeUse.makeImmutable();
            }
            oneTimeUses = Collections.unmodifiableList(oneTimeUses);
        }
        if (proxyRestrictions != null) {
            int length = proxyRestrictions.size();
            for (int i = 0; i < length; i++) {
                ProxyRestriction pr = (ProxyRestriction) proxyRestrictions.get(i);
                pr.makeImmutable();
            }
            proxyRestrictions = Collections.unmodifiableList(proxyRestrictions);
        }
        isMutable = false;
    }
}
Also used : Condition(com.sun.identity.saml2.assertion.Condition) AudienceRestriction(com.sun.identity.saml2.assertion.AudienceRestriction) OneTimeUse(com.sun.identity.saml2.assertion.OneTimeUse) ProxyRestriction(com.sun.identity.saml2.assertion.ProxyRestriction)

Aggregations

AudienceRestriction (com.sun.identity.saml2.assertion.AudienceRestriction)2 Condition (com.sun.identity.saml2.assertion.Condition)2 OneTimeUse (com.sun.identity.saml2.assertion.OneTimeUse)2 ProxyRestriction (com.sun.identity.saml2.assertion.ProxyRestriction)2