Skip to content

Problem parsing WCF WS-trust SAML2 ticket #160

@matejsp

Description

@matejsp

WSTRequestSecurityTokenParser.java is missing parsing of the following elements:
EncryptWith
SignWith
CanonicalizationAlgorithm
EncryptionAlgorithm
KeyWrapAlgorithm

patch (with values ignored on processing):

            } else if (tag.equals("EncryptWith")) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (!StaxParserUtil.hasTextAhead(xmlEventReader))
                    throw new ParsingException(ErrorCodes.EXPECTED_TEXT_VALUE + "encrypt with");

                String encryptWith = StaxParserUtil.getElementText(xmlEventReader);
                try {
                    URI encryptWithURI = new URI(encryptWith);
                    requestToken.setEncryptWith(encryptWithURI);
                } catch (URISyntaxException e) {
                    throw new ParsingException(e);
                }
            } else if (tag.equals("SignWith")) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (!StaxParserUtil.hasTextAhead(xmlEventReader))
                    throw new ParsingException(ErrorCodes.EXPECTED_TEXT_VALUE + "sign with");

                String signWith = StaxParserUtil.getElementText(xmlEventReader);
                try {
                    URI signWithURI = new URI(signWith);
                    requestToken.setSignWith(signWithURI);
                } catch (URISyntaxException e) {
                    throw new ParsingException(e);
                }
            } else if (tag.equals("CanonicalizationAlgorithm")) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (!StaxParserUtil.hasTextAhead(xmlEventReader))
                    throw new ParsingException(ErrorCodes.EXPECTED_TEXT_VALUE + "canonicalization algorithm");

                String canonicalizationAlgorithm = StaxParserUtil.getElementText(xmlEventReader);
                try {
                    URI canonicalizationAlgorithmURI = new URI(canonicalizationAlgorithm);
                    requestToken.setCanonicalizationAlgorithm(canonicalizationAlgorithmURI);
                } catch (URISyntaxException e) {
                    throw new ParsingException(e);
                }
            } else if (tag.equals("EncryptionAlgorithm")) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (!StaxParserUtil.hasTextAhead(xmlEventReader))
                    throw new ParsingException(ErrorCodes.EXPECTED_TEXT_VALUE + "encrypt algortihm");

                String canonicalizationAlgorithm = StaxParserUtil.getElementText(xmlEventReader);
                try {
                    URI encryptionAlgorithmURI = new URI(canonicalizationAlgorithm);
                    requestToken.setEncryptionAlgorithm(encryptionAlgorithmURI);
                } catch (URISyntaxException e) {
                    throw new ParsingException(e);
                }
            } else if (tag.equals("KeyWrapAlgorithm")) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (!StaxParserUtil.hasTextAhead(xmlEventReader))
                    throw new ParsingException(ErrorCodes.EXPECTED_TEXT_VALUE + "key wrap algorithm");

                String keyWrapAlgorithm = StaxParserUtil.getElementText(xmlEventReader);
                try {
                    URI keyWrapAlgorithmURI = new URI(keyWrapAlgorithm);
                    requestToken.setKeyWrapAlgorithm(keyWrapAlgorithmURI);
                } catch (URISyntaxException e) {
                    throw new ParsingException(e);
                }
            } else {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions