Don't use getContextualProperty to get the REQUEST_URL. Fallback to REQUEST_URI if it's not set
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0c0b31f2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0c0b31f2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0c0b31f2 Branch: refs/heads/master Commit: 0c0b31f2e59d8e3bba4035ab2250436d7252b209 Parents: fcd965e Author: Colm O hEigeartaigh <[email protected]> Authored: Mon Nov 2 17:15:58 2015 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Mon Nov 2 17:50:01 2015 +0000 ---------------------------------------------------------------------- .../org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/0c0b31f2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java index 0f672dc..d78a069 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java @@ -342,9 +342,12 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { SecurityUtils.getSecurityPropertyBoolean(SecurityConstants.AUDIENCE_RESTRICTION_VALIDATION, msg, true); if (enableAudienceRestriction) { List<String> audiences = new ArrayList<>(); - if (msg.getContextualProperty(org.apache.cxf.message.Message.REQUEST_URL) != null) { - audiences.add((String)msg.getContextualProperty(org.apache.cxf.message.Message.REQUEST_URL)); + if (msg.get(org.apache.cxf.message.Message.REQUEST_URL) != null) { + audiences.add((String)msg.get(org.apache.cxf.message.Message.REQUEST_URL)); + } else if (msg.get(org.apache.cxf.message.Message.REQUEST_URI) != null) { + audiences.add((String)msg.get(org.apache.cxf.message.Message.REQUEST_URL)); } + if (msg.getContextualProperty("javax.xml.ws.wsdl.service") != null) { audiences.add(msg.getContextualProperty("javax.xml.ws.wsdl.service").toString()); }
