Moxy doesn't set the "type" properly, do an instanceof
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/589cfb13 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/589cfb13 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/589cfb13 Branch: refs/heads/master Commit: 589cfb1388d22ca9df1a6f48e37aa20ca5bb50e3 Parents: 4348078 Author: Daniel Kulp <[email protected]> Authored: Thu Mar 27 01:13:07 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Thu Mar 27 09:07:49 2014 -0400 ---------------------------------------------------------------------- .../main/java/org/apache/cxf/sts/request/RequestParser.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/589cfb13/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java index 0ed2e51..c716d80 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java @@ -331,7 +331,8 @@ public class RequestParser { byte[] x509 = null; if (useKey.getAny() instanceof JAXBElement<?>) { JAXBElement<?> useKeyJaxb = (JAXBElement<?>)useKey.getAny(); - if (KeyInfoType.class == useKeyJaxb.getDeclaredType()) { + Object obj = useKeyJaxb.getValue(); + if (KeyInfoType.class == useKeyJaxb.getDeclaredType() || obj instanceof KeyInfoType) { KeyInfoType keyInfoType = KeyInfoType.class.cast(useKeyJaxb.getValue()); LOG.fine("Found KeyInfo UseKey type"); for (Object keyInfoContent : keyInfoType.getContent()) { @@ -348,7 +349,8 @@ public class RequestParser { } } } - } else if (SecurityTokenReferenceType.class == useKeyJaxb.getDeclaredType()) { + } else if (SecurityTokenReferenceType.class == useKeyJaxb.getDeclaredType() + || obj instanceof SecurityTokenReferenceType) { SecurityTokenReferenceType strType = SecurityTokenReferenceType.class.cast(useKeyJaxb.getValue()); Element token = fetchTokenElementFromReference(strType, wsContext);
