diff options
Diffstat (limited to '')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java index 4c18c89353..0f73320c47 100644 --- a/branches/sca-java-1.x/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java @@ -104,8 +104,18 @@ public class Axis2BindingBasicAuthenticationConfigurator { // get the security context Subject subject = SecurityUtil.getSubject(msg); - BasicAuthenticationPrincipal principal = new BasicAuthenticationPrincipal(username, - password); + BasicAuthenticationPrincipal principal = null; + try { + principal = new BasicAuthenticationPrincipal(username, + password); + } catch (Exception ex) { + // null test will throw a suitable exceptions + } + + if (principal == null){ + throw new ServiceRuntimeException("User credentials for authentication expected"); + } + subject.getPrincipals().add(principal); } } |