<div dir="ltr">Not sure, if I follow you on that?<div><br></div><div>java.security.Principal is not part of the CDI spec at all and only used by a special subclass of</div><div><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">AbstractEEBean</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"><T></span><br><div class="gmail_extra"><br></div><div class="gmail_extra">The problem seems the generic T which Java at this point is unable to know about at runtime.</div><div class="gmail_extra"><br></div><div class="gmail_extra">It makes no difference, if you had</div><div class="gmail_extra"><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">PrincipalBean</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">extends</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-e" style="box-sizing:border-box;color:rgb(121,93,163);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">AbstractEEBean<<span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">Principal</span>></span><br></div><div class="gmail_extra">or a<br></div><div class="gmail_extra"><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">StringBean</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">extends</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-e" style="box-sizing:border-box;color:rgb(121,93,163);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">AbstractBuiltInBean<<span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">String</span>></span></div><div class="gmail_extra"><font color="#795da3" face="sfmono-regular, consolas, liberation mono, menlo, courier, monospace"><span style="font-size:12px;white-space:pre"><br></span></font></div><div class="gmail_extra">Even created a JUnit test in<div><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin:0px;border-collapse:collapse"><font face="arial, helvetica, sans-serif" size="1"><span lang="EN-US"><a href="https://github.com/unitsofmeasurement/uom-se/blob/master/src/test/java/tec/uom/se/AbsUnitTest.java">https://github.com/unitsofmeasurement/uom-se/blob/master/src/test/java/tec/uom/se/AbsUnitTest.java</a><br></span></font></p><p style="margin:0px;border-collapse:collapse">Which under Java 8 returns<br></p><p style="margin:0px;border-collapse:collapse"><span class="gmail-pl-pds" style="box-sizing:border-box;color:rgb(24,54,145);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">"</span><span style="color:rgb(24,54,145);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">java.lang.reflect.TypeVariable<D></span><span class="gmail-pl-pds" style="box-sizing:border-box;color:rgb(24,54,145);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">"</span><br></p><p style="margin:0px;border-collapse:collapse">No sign of "Length" which is what you'd hoped for (maybe we did not dig deep enough, maybe it won't work until a future Java version?)</p><p style="margin:0px;border-collapse:collapse"><font face="arial, helvetica, sans-serif" size="1"><span lang="EN-US"><br></span></font></p><p style="margin:0px;border-collapse:collapse"><font face="arial, helvetica, sans-serif" size="1"><span lang="EN-US">Werner </span></font></p><span lang="EN-GB"><div style="font-family:arial,helvetica,sans-serif"><br></div></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Apr 26, 2017 at 5:46 PM, <span dir="ltr"><<a href="mailto:cdi-dev-request@lists.jboss.org" target="_blank">cdi-dev-request@lists.jboss.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send cdi-dev mailing list submissions to<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:cdi-dev-request@lists.jboss.org">cdi-dev-request@lists.jboss.<wbr>org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:cdi-dev-owner@lists.jboss.org">cdi-dev-owner@lists.jboss.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of cdi-dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Types of Principal object (Romain Manni-Bucau)<br>
2. Re: Types of Principal object (Werner Keil)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Wed, 26 Apr 2017 17:41:08 +0200<br>
From: Romain Manni-Bucau <<a href="mailto:rmannibucau@gmail.com">rmannibucau@gmail.com</a>><br>
Subject: Re: [cdi-dev] Types of Principal object<br>
To: arjan tijms <<a href="mailto:arjan.tijms@gmail.com">arjan.tijms@gmail.com</a>><br>
Cc: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
Message-ID:<br>
<CACLE=7OK-<wbr>JWXptMQxM8BUAvE2ab5gOwNiNBHCDb<wbr>jy=<a href="mailto:UNkuEGQg@mail.gmail.com">UNkuEGQg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
that's why security API needs a more typed API acting as an handler and not<br>
as a contextual instance, it would allow to unwrap the actual instance<br>
(like most specs do) but at CDI level it should also be possible. If not we<br>
have this built-in bean never working until you add another not mandatory<br>
spec - for CDI level. In other words either Principal is removed from CDI<br>
spec or it stays but it should be extended to be made usable IMHO.<br>
<br>
<br>
Romain Manni-Bucau<br>
@rmannibucau <<a href="https://twitter.com/rmannibucau" rel="noreferrer" target="_blank">https://twitter.com/<wbr>rmannibucau</a>> | Blog<br>
<<a href="https://blog-rmannibucau.rhcloud.com" rel="noreferrer" target="_blank">https://blog-rmannibucau.<wbr>rhcloud.com</a>> | Old Blog<br>
<<a href="http://rmannibucau.wordpress.com" rel="noreferrer" target="_blank">http://rmannibucau.wordpress.<wbr>com</a>> | Github <<a href="https://github.com/rmannibucau" rel="noreferrer" target="_blank">https://github.com/<wbr>rmannibucau</a>> |<br>
LinkedIn <<a href="https://www.linkedin.com/in/rmannibucau" rel="noreferrer" target="_blank">https://www.linkedin.com/in/<wbr>rmannibucau</a>> | JavaEE Factory<br>
<<a href="https://javaeefactory-rmannibucau.rhcloud.com" rel="noreferrer" target="_blank">https://javaeefactory-<wbr>rmannibucau.rhcloud.com</a>><br>
<br>
2017-04-26 17:11 GMT+02:00 arjan tijms <<a href="mailto:arjan.tijms@gmail.com">arjan.tijms@gmail.com</a>>:<br>
<br>
> Hi,<br>
><br>
> We discussed this very issue in the Security API EG as well. In the<br>
> Security API the actual type *MUST* be retained as per the spec definition.<br>
><br>
> The problem in CDI, at least in Weld, is that a proxy is injected. This<br>
> happens via the build-in bean "PrincipalBean extends AbstractEEBean", where<br>
> AbstractEEBean does:<br>
><br>
> public abstract class AbstractEEBean<T> extends<br>
> AbstractStaticallyDecorableBui<wbr>ltInBean<T> {<br>
><br>
> private final T proxy;<br>
><br>
> protected AbstractEEBean(Class<T> type, Callable<T> callable,<br>
> BeanManagerImpl beanManager) {<br>
> super(beanManager, type);<br>
> this.proxy = new ProxyFactory<T>(beanManager.<wbr>getContextId(),<br>
> type, getTypes(), this).create(new EnterpriseTargetBeanInstance(<wbr>type, new<br>
> CallableMethodHandler(<wbr>callable)));<br>
> }<br>
> // ...<br>
> }<br>
><br>
> I'm not even sure if it's possible to downcast the proxy to the required<br>
> runtime type.<br>
><br>
> Also note that the Principal can change during the request. The simplest<br>
> case is when during an http request HttpServletRequest#logout is called.<br>
><br>
> Kind regards,<br>
> Arjan Tijms<br>
><br>
><br>
><br>
><br>
> On Wed, Apr 26, 2017 at 3:54 PM, John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
> wrote:<br>
><br>
>> Hey guys<br>
>><br>
>><br>
>> I raised a bug against the Weld guys, but think its worth an EG<br>
>> discussion. When a Principal object is injected, the only type it has is<br>
>> Principal. It does not retain the actual type used at runtime. This threw<br>
>> me off on some Keycloak integration I'm working on (in $dayjob). So I was<br>
>> wondering, is this expected from our POV or should it retain the types of<br>
>> the actual runtime instance?<br>
>><br>
>><br>
>> John<br>
>><br>
>> ------------------------------<br>
>> NOTICE: This e-mail message and any attachments may contain confidential,<br>
>> proprietary, and/or privileged information which should be treated<br>
>> accordingly. If you are not the intended recipient, please notify the<br>
>> sender immediately by return e-mail, delete this message, and destroy all<br>
>> physical and electronic copies. Thank you.<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> cdi-dev mailing list<br>
>> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>><br>
>> Note that for all code provided on this list, the provider licenses the<br>
>> code under the Apache License, Version 2 (<a href="http://www.apache.org/license" rel="noreferrer" target="_blank">http://www.apache.org/license</a><br>
>> s/LICENSE-2.0.html). For all other ideas provided on this list, the<br>
>> provider waives all patent and other intellectual property rights inherent<br>
>> in such information.<br>
>><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> cdi-dev mailing list<br>
> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
><br>
> Note that for all code provided on this list, the provider licenses the<br>
> code under the Apache License, Version 2 (<a href="http://www.apache.org/" rel="noreferrer" target="_blank">http://www.apache.org/</a><br>
> licenses/LICENSE-2.0.html). For all other ideas provided on this list,<br>
> the provider waives all patent and other intellectual property rights<br>
> inherent in such information.<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/20170426/ad930662/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.jboss.org/<wbr>pipermail/cdi-dev/attachments/<wbr>20170426/ad930662/attachment-<wbr>0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 26 Apr 2017 17:44:04 +0200<br>
From: Werner Keil <<a href="mailto:werner.keil@gmail.com">werner.keil@gmail.com</a>><br>
Subject: Re: [cdi-dev] Types of Principal object<br>
To: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
Message-ID:<br>
<CAAGawe1dmVUmgnrnmtV_oS0==<wbr>fttYOe44ZhG4YfO+yme2=<a href="mailto:oT_A@mail.gmail.com">oT_A@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Seems the title of the thread was also not "reified" in this case.<br>
Sometimes reply just works, but if it was lost, sorry for that.<br>
<br>
Werner<br>
<br>
<br>
On Wed, Apr 26, 2017 at 5:41 PM, Werner Keil <<a href="mailto:werner.keil@gmail.com">werner.keil@gmail.com</a>> wrote:<br>
<br>
> We had similar challenges and discussions even before JSR 363 about<br>
> knowing what type of quantity you're dealing with types like<br>
><br>
> Unit<Q extends Quantity <<a href="http://unitsofmeasurement.github.io/unit-api/site/apidocs/javax/measure/Quantity.html" rel="noreferrer" target="_blank">http://unitsofmeasurement.<wbr>github.io/unit-api/site/<wbr>apidocs/javax/measure/<wbr>Quantity.html</a>><Q>><br>
><br>
> I can only confirm Arjan's impression. And I had numerous conversations<br>
> with Andrew Kennedy, the Chief Architect behind the F# Units of Measurement<br>
> support and other .NET libraries about it. Where he mentioned shortcomings<br>
> of the Java language especially the lack of Reified Generics (<br>
> <a href="http://stackoverflow.com/questions/31876372/what-is-reification" rel="noreferrer" target="_blank">http://stackoverflow.com/<wbr>questions/31876372/what-is-<wbr>reification</a>), which<br>
> C#, F# or other .NET languages got, but Java won't at least not until Java<br>
> 10, 11 or even later.<br>
><br>
> I tried a lot between 2010 and now but so far none of these Reflection<br>
> tricks and approaches were stable enough, so not sure, if it'll work any<br>
> better in this case (unless you implement CDI in C#;-)<br>
><br>
> Werner<br>
><br>
><br>
> On Wed, Apr 26, 2017 at 5:29 PM, <<a href="mailto:cdi-dev-request@lists.jboss.org">cdi-dev-request@lists.jboss.<wbr>org</a>> wrote:<br>
><br>
>> Send cdi-dev mailing list submissions to<br>
>> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>><br>
>> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>> or, via email, send a message with subject or body 'help' to<br>
>> <a href="mailto:cdi-dev-request@lists.jboss.org">cdi-dev-request@lists.jboss.<wbr>org</a><br>
>><br>
>> You can reach the person managing the list at<br>
>> <a href="mailto:cdi-dev-owner@lists.jboss.org">cdi-dev-owner@lists.jboss.org</a><br>
>><br>
>> When replying, please edit your Subject line so it is more specific<br>
>> than "Re: Contents of cdi-dev digest..."<br>
>><br>
>><br>
>> Today's Topics:<br>
>><br>
>> 1. Types of Principal object (John Ament)<br>
>> 2. Re: Types of Principal object (Romain Manni-Bucau)<br>
>> 3. Re: Types of Principal object (Matej Novotny)<br>
>> 4. Re: Types of Principal object (arjan tijms)<br>
>><br>
>><br>
>> ------------------------------<wbr>------------------------------<wbr>----------<br>
>><br>
>> Message: 1<br>
>> Date: Wed, 26 Apr 2017 13:54:57 +0000<br>
>> From: John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
>> Subject: [cdi-dev] Types of Principal object<br>
>> To: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
>> Message-ID:<br>
>> <<wbr>CY4PR04MB048607BF779F8680ED5CE<wbr>53898110@CY4PR04MB0486.namprd<br>
>> <a href="http://04.prod.outlook.com" rel="noreferrer" target="_blank">04.prod.outlook.com</a>><br>
>><br>
>> Content-Type: text/plain; charset="iso-8859-1"<br>
>><br>
>> Hey guys<br>
>><br>
>><br>
>> I raised a bug against the Weld guys, but think its worth an EG<br>
>> discussion. When a Principal object is injected, the only type it has is<br>
>> Principal. It does not retain the actual type used at runtime. This threw<br>
>> me off on some Keycloak integration I'm working on (in $dayjob). So I was<br>
>> wondering, is this expected from our POV or should it retain the types of<br>
>> the actual runtime instance?<br>
>><br>
>><br>
>> John<br>
>><br>
>> ______________________________<wbr>__<br>
>> NOTICE: This e-mail message and any attachments may contain confidential,<br>
>> proprietary, and/or privileged information which should be treated<br>
>> accordingly. If you are not the intended recipient, please notify the<br>
>> sender immediately by return e-mail, delete this message, and destroy all<br>
>> physical and electronic copies. Thank you.<br>
>> -------------- next part --------------<br>
>> An HTML attachment was scrubbed...<br>
>> URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/2017042" rel="noreferrer" target="_blank">http://lists.jboss.org/<wbr>pipermail/cdi-dev/attachments/<wbr>2017042</a><br>
>> 6/b6740722/attachment-0001.<wbr>html<br>
>><br>
>> ------------------------------<br>
>><br>
>> Message: 2<br>
>> Date: Wed, 26 Apr 2017 16:38:01 +0200<br>
>> From: Romain Manni-Bucau <<a href="mailto:rmannibucau@gmail.com">rmannibucau@gmail.com</a>><br>
>> Subject: Re: [cdi-dev] Types of Principal object<br>
>> To: John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
>> Cc: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
>> Message-ID:<br>
>> <CACLE=7N=<a href="mailto:pkvZDX3ULCFAK2Fhw8-bH0pbOsqctqsbkPhKk8i1VA@mail.gm">pkvZDX3ULCFAK2Fhw8-<wbr>bH0pbOsqctqsbkPhKk8i1VA@mail.<wbr>gm</a><br>
>> <a href="http://ail.com" rel="noreferrer" target="_blank">ail.com</a>><br>
>> Content-Type: text/plain; charset="utf-8"<br>
>><br>
>> Hi John,<br>
>><br>
>> agree CDI/security integration (mainly through Principal bean) is<br>
>> completely unusable in practise cause Principal type is too simple (name<br>
>> only) and casting is needed in 99.99% of apps. AFAIK It is tracked at<br>
>> <a href="https://issues.jboss.org/browse/CDI-597" rel="noreferrer" target="_blank">https://issues.jboss.org/<wbr>browse/CDI-597</a>.<br>
>><br>
>><br>
>> Romain Manni-Bucau<br>
>> @rmannibucau <<a href="https://twitter.com/rmannibucau" rel="noreferrer" target="_blank">https://twitter.com/<wbr>rmannibucau</a>> | Blog<br>
>> <<a href="https://blog-rmannibucau.rhcloud.com" rel="noreferrer" target="_blank">https://blog-rmannibucau.<wbr>rhcloud.com</a>> | Old Blog<br>
>> <<a href="http://rmannibucau.wordpress.com" rel="noreferrer" target="_blank">http://rmannibucau.wordpress.<wbr>com</a>> | Github <<br>
>> <a href="https://github.com/rmannibucau" rel="noreferrer" target="_blank">https://github.com/rmannibucau</a><wbr>> |<br>
>> LinkedIn <<a href="https://www.linkedin.com/in/rmannibucau" rel="noreferrer" target="_blank">https://www.linkedin.com/in/<wbr>rmannibucau</a>> | JavaEE Factory<br>
>> <<a href="https://javaeefactory-rmannibucau.rhcloud.com" rel="noreferrer" target="_blank">https://javaeefactory-<wbr>rmannibucau.rhcloud.com</a>><br>
>><br>
>> 2017-04-26 15:54 GMT+02:00 John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><wbr>:<br>
>><br>
>> > Hey guys<br>
>> ><br>
>> ><br>
>> > I raised a bug against the Weld guys, but think its worth an EG<br>
>> > discussion. When a Principal object is injected, the only type it has<br>
>> is<br>
>> > Principal. It does not retain the actual type used at runtime. This<br>
>> threw<br>
>> > me off on some Keycloak integration I'm working on (in $dayjob). So I<br>
>> was<br>
>> > wondering, is this expected from our POV or should it retain the types<br>
>> of<br>
>> > the actual runtime instance?<br>
>> ><br>
>> ><br>
>> > John<br>
>> ><br>
>> > ------------------------------<br>
>> > NOTICE: This e-mail message and any attachments may contain<br>
>> confidential,<br>
>> > proprietary, and/or privileged information which should be treated<br>
>> > accordingly. If you are not the intended recipient, please notify the<br>
>> > sender immediately by return e-mail, delete this message, and destroy<br>
>> all<br>
>> > physical and electronic copies. Thank you.<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > cdi-dev mailing list<br>
>> > <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>> ><br>
>> > Note that for all code provided on this list, the provider licenses the<br>
>> > code under the Apache License, Version 2 (<a href="http://www.apache.org/" rel="noreferrer" target="_blank">http://www.apache.org/</a><br>
>> > licenses/LICENSE-2.0.html). For all other ideas provided on this list,<br>
>> > the provider waives all patent and other intellectual property rights<br>
>> > inherent in such information.<br>
>> ><br>
>> -------------- next part --------------<br>
>> An HTML attachment was scrubbed...<br>
>> URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/2017042" rel="noreferrer" target="_blank">http://lists.jboss.org/<wbr>pipermail/cdi-dev/attachments/<wbr>2017042</a><br>
>> 6/19976ebd/attachment-0001.<wbr>html<br>
>><br>
>> ------------------------------<br>
>><br>
>> Message: 3<br>
>> Date: Wed, 26 Apr 2017 10:48:40 -0400 (EDT)<br>
>> From: Matej Novotny <<a href="mailto:manovotn@redhat.com">manovotn@redhat.com</a>><br>
>> Subject: Re: [cdi-dev] Types of Principal object<br>
>> To: John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
>> Cc: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
>> Message-ID:<br>
>> <<a href="mailto:1098875365.1348630.1493218120014.JavaMail.zimbra@redhat.com">1098875365.1348630.<wbr>1493218120014.JavaMail.zimbra@<wbr>redhat.com</a>><br>
>> Content-Type: text/plain; charset=utf-8<br>
>><br>
>> Hey John,<br>
>><br>
>> just to shed some light.<br>
>> One of the reasons it works this way is because the types the actual<br>
>> Principal has might not be proxyable.<br>
>> And spec requires all built-in beans to be decorable - e.g. you need them<br>
>> to be proxyable (although the added value of principal decorator is ...eh,<br>
>> disputable at best?).<br>
>><br>
>> Therefore, it is safer/viable to create a proxyable wrapper object which<br>
>> implements Principal only and delegetas calls (that's what Weld does).<br>
>><br>
>> Otherwise I agree it could be nice to ahve a way to cast the object as<br>
>> the pure Principal interface doesn't help much.<br>
>><br>
>> Matej<br>
>><br>
>> ----- Original Message -----<br>
>> > From: "John Ament" <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
>> > To: "cdi-dev" <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
>> > Sent: Wednesday, April 26, 2017 3:54:57 PM<br>
>> > Subject: [cdi-dev] Types of Principal object<br>
>> ><br>
>> ><br>
>> ><br>
>> > Hey guys<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > I raised a bug against the Weld guys, but think its worth an EG<br>
>> discussion.<br>
>> > When a Principal object is injected, the only type it has is Principal.<br>
>> It<br>
>> > does not retain the actual type used at runtime. This threw me off on<br>
>> some<br>
>> > Keycloak integration I'm working on (in $dayjob). So I was wondering, is<br>
>> > this expected from our POV or should it retain the types of the actual<br>
>> > runtime instance?<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > John<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > NOTICE: This e-mail message and any attachments may contain<br>
>> confidential,<br>
>> > proprietary, and/or privileged information which should be treated<br>
>> > accordingly. If you are not the intended recipient, please notify the<br>
>> sender<br>
>> > immediately by return e-mail, delete this message, and destroy all<br>
>> physical<br>
>> > and electronic copies. Thank you.<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > cdi-dev mailing list<br>
>> > <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>> ><br>
>> > Note that for all code provided on this list, the provider licenses the<br>
>> code<br>
>> > under the Apache License, Version 2<br>
>> > (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/<wbr>licenses/LICENSE-2.0.html</a>). For all other ideas<br>
>> > provided on this list, the provider waives all patent and other<br>
>> intellectual<br>
>> > property rights inherent in such information.<br>
>><br>
>><br>
>> ------------------------------<br>
>><br>
>> Message: 4<br>
>> Date: Wed, 26 Apr 2017 17:11:11 +0200<br>
>> From: arjan tijms <<a href="mailto:arjan.tijms@gmail.com">arjan.tijms@gmail.com</a>><br>
>> Subject: Re: [cdi-dev] Types of Principal object<br>
>> To: John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a>><br>
>> Cc: cdi-dev <<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>><br>
>> Message-ID:<br>
>> <CAE=-<wbr>AhA0PiXZpSKmy0XYoMxCFuyxjV3Wt=<wbr>jjFzhC=G+LOc9TDA@mail.<br>
>> <a href="http://gmail.com" rel="noreferrer" target="_blank">gmail.com</a>><br>
>> Content-Type: text/plain; charset="utf-8"<br>
>><br>
>> Hi,<br>
>><br>
>> We discussed this very issue in the Security API EG as well. In the<br>
>> Security API the actual type *MUST* be retained as per the spec<br>
>> definition.<br>
>><br>
>> The problem in CDI, at least in Weld, is that a proxy is injected. This<br>
>> happens via the build-in bean "PrincipalBean extends AbstractEEBean",<br>
>> where<br>
>> AbstractEEBean does:<br>
>><br>
>> public abstract class AbstractEEBean<T> extends<br>
>> AbstractStaticallyDecorableBui<wbr>ltInBean<T> {<br>
>><br>
>> private final T proxy;<br>
>><br>
>> protected AbstractEEBean(Class<T> type, Callable<T> callable,<br>
>> BeanManagerImpl beanManager) {<br>
>> super(beanManager, type);<br>
>> this.proxy = new ProxyFactory<T>(beanManager.<wbr>getContextId(),<br>
>> type,<br>
>> getTypes(), this).create(new EnterpriseTargetBeanInstance(<wbr>type, new<br>
>> CallableMethodHandler(<wbr>callable)));<br>
>> }<br>
>> // ...<br>
>> }<br>
>><br>
>> I'm not even sure if it's possible to downcast the proxy to the required<br>
>> runtime type.<br>
>><br>
>> Also note that the Principal can change during the request. The simplest<br>
>> case is when during an http request HttpServletRequest#logout is called.<br>
>><br>
>> Kind regards,<br>
>> Arjan Tijms<br>
>><br>
>><br>
>><br>
>><br>
>> On Wed, Apr 26, 2017 at 3:54 PM, John Ament <<a href="mailto:john.ament@spartasystems.com">john.ament@spartasystems.com</a><br>
>> ><br>
>> wrote:<br>
>><br>
>> > Hey guys<br>
>> ><br>
>> ><br>
>> > I raised a bug against the Weld guys, but think its worth an EG<br>
>> > discussion. When a Principal object is injected, the only type it has<br>
>> is<br>
>> > Principal. It does not retain the actual type used at runtime. This<br>
>> threw<br>
>> > me off on some Keycloak integration I'm working on (in $dayjob). So I<br>
>> was<br>
>> > wondering, is this expected from our POV or should it retain the types<br>
>> of<br>
>> > the actual runtime instance?<br>
>> ><br>
>> ><br>
>> > John<br>
>> ><br>
>> > ------------------------------<br>
>> > NOTICE: This e-mail message and any attachments may contain<br>
>> confidential,<br>
>> > proprietary, and/or privileged information which should be treated<br>
>> > accordingly. If you are not the intended recipient, please notify the<br>
>> > sender immediately by return e-mail, delete this message, and destroy<br>
>> all<br>
>> > physical and electronic copies. Thank you.<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > cdi-dev mailing list<br>
>> > <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>> ><br>
>> > Note that for all code provided on this list, the provider licenses the<br>
>> > code under the Apache License, Version 2 (<a href="http://www.apache.org/" rel="noreferrer" target="_blank">http://www.apache.org/</a><br>
>> > licenses/LICENSE-2.0.html). For all other ideas provided on this list,<br>
>> > the provider waives all patent and other intellectual property rights<br>
>> > inherent in such information.<br>
>> ><br>
>> -------------- next part --------------<br>
>> An HTML attachment was scrubbed...<br>
>> URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/2017042" rel="noreferrer" target="_blank">http://lists.jboss.org/<wbr>pipermail/cdi-dev/attachments/<wbr>2017042</a><br>
>> 6/206ff811/attachment.html<br>
>><br>
>> ------------------------------<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> cdi-dev mailing list<br>
>> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
>><br>
>> Note that for all code provided on this list, the provider licenses the<br>
>> code under the Apache License, Version 2 (<a href="http://www.apache.org/license" rel="noreferrer" target="_blank">http://www.apache.org/license</a><br>
>> s/LICENSE-2.0.html). For all other ideas provided on this list, the<br>
>> provider waives all patent and other intellectual property rights inherent<br>
>> in such information.<br>
>><br>
>> End of cdi-dev Digest, Vol 77, Issue 8<br>
>> ******************************<wbr>********<br>
>><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.jboss.org/pipermail/cdi-dev/attachments/20170426/ebea1962/attachment.html" rel="noreferrer" target="_blank">http://lists.jboss.org/<wbr>pipermail/cdi-dev/attachments/<wbr>20170426/ebea1962/attachment.<wbr>html</a><br>
<br>
------------------------------<br>
<br>
______________________________<wbr>_________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/<wbr>licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
<br>
End of cdi-dev Digest, Vol 77, Issue 10<br>
******************************<wbr>*********<br>
</blockquote></div><br></div></div></div>