Search in sources :

Example 1 with BaseIDAbstractType

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

the class BaseWriter method write.

/**
 * write an {@code SubjectType} to stream
 *
 * @param subject
 * @param out
 *
 * @throws ProcessingException
 */
public void write(SubjectType subject) throws ProcessingException {
    StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.SUBJECT.get(), ASSERTION_NSURI.get());
    SubjectType.STSubType subType = subject.getSubType();
    if (subType != null) {
        BaseIDAbstractType baseID = subType.getBaseID();
        if (baseID instanceof NameIDType) {
            NameIDType nameIDType = (NameIDType) baseID;
            write(nameIDType, new QName(ASSERTION_NSURI.get(), JBossSAMLConstants.NAMEID.get(), ASSERTION_PREFIX));
        }
        EncryptedElementType enc = subType.getEncryptedID();
        if (enc != null)
            throw new RuntimeException("NYI");
        List<SubjectConfirmationType> confirmations = subType.getConfirmation();
        if (confirmations != null) {
            for (SubjectConfirmationType confirmation : confirmations) {
                write(confirmation);
            }
        }
    }
    List<SubjectConfirmationType> subjectConfirmations = subject.getConfirmation();
    if (subjectConfirmations != null) {
        for (SubjectConfirmationType subjectConfirmationType : subjectConfirmations) {
            write(subjectConfirmationType);
        }
    }
    StaxUtil.writeEndElement(writer);
    StaxUtil.flush(writer);
}
Also used : SubjectType(org.keycloak.dom.saml.v2.assertion.SubjectType) SubjectConfirmationType(org.keycloak.dom.saml.v2.assertion.SubjectConfirmationType) QName(javax.xml.namespace.QName) BaseIDAbstractType(org.keycloak.dom.saml.v2.assertion.BaseIDAbstractType) NameIDType(org.keycloak.dom.saml.v2.assertion.NameIDType) EncryptedElementType(org.keycloak.dom.saml.v2.assertion.EncryptedElementType)

Example 2 with BaseIDAbstractType

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

the class BaseWriter method write.

private void write(SubjectConfirmationType subjectConfirmationType) throws ProcessingException {
    StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.SUBJECT_CONFIRMATION.get(), ASSERTION_NSURI.get());
    StaxUtil.writeAttribute(writer, JBossSAMLConstants.METHOD.get(), subjectConfirmationType.getMethod());
    BaseIDAbstractType baseID = subjectConfirmationType.getBaseID();
    if (baseID != null) {
        write(baseID);
    }
    NameIDType nameIDType = subjectConfirmationType.getNameID();
    if (nameIDType != null) {
        write(nameIDType, new QName(ASSERTION_NSURI.get(), JBossSAMLConstants.NAMEID.get(), ASSERTION_PREFIX));
    }
    SubjectConfirmationDataType subjectConfirmationData = subjectConfirmationType.getSubjectConfirmationData();
    if (subjectConfirmationData != null) {
        write(subjectConfirmationData);
    }
    StaxUtil.writeEndElement(writer);
}
Also used : SubjectConfirmationDataType(org.keycloak.dom.saml.v2.assertion.SubjectConfirmationDataType) QName(javax.xml.namespace.QName) BaseIDAbstractType(org.keycloak.dom.saml.v2.assertion.BaseIDAbstractType) NameIDType(org.keycloak.dom.saml.v2.assertion.NameIDType)

Aggregations

QName (javax.xml.namespace.QName)2 BaseIDAbstractType (org.keycloak.dom.saml.v2.assertion.BaseIDAbstractType)2 NameIDType (org.keycloak.dom.saml.v2.assertion.NameIDType)2 EncryptedElementType (org.keycloak.dom.saml.v2.assertion.EncryptedElementType)1 SubjectConfirmationDataType (org.keycloak.dom.saml.v2.assertion.SubjectConfirmationDataType)1 SubjectConfirmationType (org.keycloak.dom.saml.v2.assertion.SubjectConfirmationType)1 SubjectType (org.keycloak.dom.saml.v2.assertion.SubjectType)1