Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem parsing WCF WS-trust SAML2 ticket #160

Open
matejsp opened this issue Apr 12, 2013 · 0 comments
Open

Problem parsing WCF WS-trust SAML2 ticket #160

matejsp opened this issue Apr 12, 2013 · 0 comments

Comments

@matejsp
Copy link

matejsp commented Apr 12, 2013

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 {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant