Search in sources :

Example 1 with ProxyRestrictionType

use of org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType in project keycloak by keycloak.

the class SAMLConditionsParser method processSubElement.

@Override
protected void processSubElement(XMLEventReader xmlEventReader, ConditionsType target, SAMLAssertionQNames element, StartElement elementDetail) throws ParsingException {
    switch(element) {
        case AUDIENCE_RESTRICTION:
            AudienceRestrictionType audienceRestriction = SAMLAudienceRestrictionParser.getInstance().parse(xmlEventReader);
            target.addCondition(audienceRestriction);
            break;
        case ONE_TIME_USE:
            OneTimeUseType oneTimeUseCondition = new OneTimeUseType();
            target.addCondition(oneTimeUseCondition);
            break;
        case PROXY_RESTRICTION:
            ProxyRestrictionType proxyRestriction = SAMLProxyRestrictionParser.getInstance().parse(xmlEventReader);
            target.addCondition(proxyRestriction);
            break;
        default:
            throw LOGGER.parserUnknownTag(StaxParserUtil.getElementName(elementDetail), elementDetail.getLocation());
    }
}
Also used : OneTimeUseType(org.keycloak.dom.saml.v2.assertion.OneTimeUseType) ProxyRestrictionType(org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType) AudienceRestrictionType(org.keycloak.dom.saml.v2.assertion.AudienceRestrictionType)

Example 2 with ProxyRestrictionType

use of org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType in project keycloak by keycloak.

the class SAMLProxyRestrictionParser method instantiateElement.

@Override
protected ProxyRestrictionType instantiateElement(XMLEventReader xmlEventReader, StartElement element) throws ParsingException {
    ProxyRestrictionType proxyRestriction = new ProxyRestrictionType();
    Integer count = StaxParserUtil.getIntegerAttributeValue(element, SAMLAssertionQNames.ATTR_COUNT);
    if (count != null) {
        proxyRestriction.setCount(BigInteger.valueOf(count));
    }
    return proxyRestriction;
}
Also used : BigInteger(java.math.BigInteger) ProxyRestrictionType(org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType)

Example 3 with ProxyRestrictionType

use of org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType in project keycloak by keycloak.

the class ConditionsValidator method validateConditions.

private Result validateConditions(ConditionsType ct, Result res) {
    Iterator<ConditionAbstractType> it = ct.getConditions() == null ? Collections.<ConditionAbstractType>emptySet().iterator() : ct.getConditions().iterator();
    while (it.hasNext() && res == Result.VALID) {
        ConditionAbstractType cond = it.next();
        Result r;
        if (cond instanceof OneTimeUseType) {
            r = validateOneTimeUse((OneTimeUseType) cond);
        } else if (cond instanceof AudienceRestrictionType) {
            r = validateAudienceRestriction((AudienceRestrictionType) cond);
        } else if (cond instanceof ProxyRestrictionType) {
            r = validateProxyRestriction((ProxyRestrictionType) cond);
        } else {
            r = Result.INDETERMINATE;
            LOG.infof("Unknown condition in assertion %s: %s", assertionId, cond == null ? "<null>" : cond.getClass());
        }
        res = r.joinResult(res);
    }
    return res;
}
Also used : OneTimeUseType(org.keycloak.dom.saml.v2.assertion.OneTimeUseType) ConditionAbstractType(org.keycloak.dom.saml.v2.assertion.ConditionAbstractType) ProxyRestrictionType(org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType) AudienceRestrictionType(org.keycloak.dom.saml.v2.assertion.AudienceRestrictionType)

Aggregations

ProxyRestrictionType (org.keycloak.dom.saml.v2.assertion.ProxyRestrictionType)3 AudienceRestrictionType (org.keycloak.dom.saml.v2.assertion.AudienceRestrictionType)2 OneTimeUseType (org.keycloak.dom.saml.v2.assertion.OneTimeUseType)2 BigInteger (java.math.BigInteger)1 ConditionAbstractType (org.keycloak.dom.saml.v2.assertion.ConditionAbstractType)1