[cdi-dev] [JBoss JIRA] (CDI-597) Make Principal unwrappable

Arjan t (JIRA) issues at jboss.org
Wed Apr 6 11:04:01 EDT 2016

    [ https://issues.jboss.org/browse/CDI-597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187799#comment-13187799 ] 

Arjan t commented on CDI-597:

{quote} Here CDI is blocking cause of proxies, user can't really produce the Principal cause LoginModule are often reused{quote}

Just wanted to mention that not every Java EE server makes use of {{LoginModule}}, if you mean {{javax.security.auth.spi.LoginModule}} ;)

The responsibility of providing the {{Principal}} instance should perhaps be with the Security API and not with CDI itself. Antoine already asked for Servlet to take responsibility of providing Beans for the Servlet artifacts. I do acknowledge there may be some backward compatibility issues here. 

> Make Principal unwrappable
> --------------------------
>                 Key: CDI-597
>                 URL: https://issues.jboss.org/browse/CDI-597
>             Project: CDI Specification Issues
>          Issue Type: Epic
>            Reporter: Romain Manni-Bucau
> CDI allows to get injected a Principal but often you need to access the actual Principal instance when you need more than a name. Since the injection is a proxy (otherwise it would be broken in most of  scoped wrapper instances cases) we would need a CDI solution to unwrap this instance.
> Solution I see without creating a new kind of API but just something specific to this case: CDIPrincipal extends Principal { <T> T unwrap(Class<T> t) } and allow to get it injected directly as Principal today.
> This issue can be linked to CDI-10 but here it is safe to add unwrap() where on CDI-10 it is not (too general).

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list