Author: asoldano
Date: 2013-11-05 19:15:00 -0500 (Tue, 05 Nov 2013)
New Revision: 18063
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java
Log:
[JBWS-3727] Prevent NPE when Principal is not available
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java 2013-11-05
23:20:38 UTC (rev 18062)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java 2013-11-06
00:15:00 UTC (rev 18063)
@@ -24,6 +24,7 @@
import static org.jboss.wsf.stack.cxf.Messages.MESSAGES;
import java.lang.reflect.Method;
+import java.security.Principal;
import java.util.List;
import javax.xml.ws.handler.Handler;
@@ -147,7 +148,8 @@
}
}
}
- throw MESSAGES.authorizationFailed(secCtx.getUserPrincipal().getName());
+ final Principal p = secCtx.getUserPrincipal();
+ throw MESSAGES.authorizationFailed(p != null ? p.getName() : null);
}
}
}