Details
-
Bug
-
Resolution: Done
-
Major
-
7.0.0.Final, 7.1.0.Alpha1
-
None
Description
In JBoss AS 7, Weld claims to be able to inject instances of java.security.Principal. CDI archives that try to inject it do not fail at deployment time with unsatisfied dependencies. Instead, they fail later, at runtime, when injection is attempted. At this point a runtime exception indicating that principal injection isn't supported is thrown.
This prevents user code, or external frameworks like Seam 3 Security, from providing their own producers for javax.security.Principal without requiring a qualifier to be used.
If JBoss AS 7's weld integration doesn't support container managed security yet (perhaps because container managed security is not supported in JBoss AS 7 at all yet?) then it should not offer an injection point for the security principal.
Backtrace when calling toString() on an injected proxy for a Principal:
Caused by: java.lang.RuntimeException: not implemented
at org.jboss.as.weld.services.bootstrap.WeldSecurityServices.getPrincipal(WeldSecurityServices.java:53)
at org.jboss.weld.bean.builtin.ee.PrincipalBean$PrincipalCallable.call(PrincipalBean.java:48)
at org.jboss.weld.bean.builtin.ee.PrincipalBean$PrincipalCallable.call(PrincipalBean.java:34)
at org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:50)
at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:62)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
at org.jboss.weld.security.Principal$1263393769$Proxy$$$_Weld$Proxy$.toString(Principal$1263393769$Proxy$$$_Weld$Proxy$.java)