You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Darren Shepherd <da...@gmail.com> on 2013/09/13 01:11:13 UTC

Q's about UserAuthenticators and getName()

DefaultUserAuthenticator masks the _name variable in 
ComponentLifecycleBase effectively making it so that no 
UserAuthenticator gets the default name of getClass().getSimpleName().

Then each authenticator, except LDAP, does something like

if (name == null) {
   name = "MD5";
}

So instead of the default MD5UserAuthenticator it comes up with MD5 as 
its name.

So my problem is that LDAP currently has a null name on getName().  So 
which should I do?  Add

if (name == null) {
   name = "LDAP";
}

Or remove the masked variable in DefaultUserAuthenticator such that all 
authenticators names will become the classname.  I just need it to be 
consistent for what I'm doing at the moment.  I'd personally prefer that 
they all just get the default name of getSimpleName().  But I don't know 
if there was some reason it was done this way.

Darren

Re: Q's about UserAuthenticators and getName()

Posted by Ian Duffy <ia...@ianduffy.ie>.
Great. Applied it.

You can mark it as submitted.


On 13 September 2013 16:10, Darren Shepherd <da...@gmail.com>wrote:

> On 09/12/2013 10:56 PM, Ian Duffy wrote:
>
>> So my problem is that LDAP currently has a null name on getName().  So
>>>
>> which should I do?  Add
>>
>> Go ahead and add it. I missed that override in error.
>>
>>  Okay I created https://reviews.apache.org/r/**14126/<https://reviews.apache.org/r/14126/>
>
> Darren
>

Re: Q's about UserAuthenticators and getName()

Posted by Darren Shepherd <da...@gmail.com>.
On 09/12/2013 10:56 PM, Ian Duffy wrote:
>> So my problem is that LDAP currently has a null name on getName().  So
> which should I do?  Add
>
> Go ahead and add it. I missed that override in error.
>
Okay I created https://reviews.apache.org/r/14126/

Darren

Re: Q's about UserAuthenticators and getName()

Posted by Ian Duffy <ia...@ianduffy.ie>.
> So my problem is that LDAP currently has a null name on getName().  So
which should I do?  Add

Go ahead and add it. I missed that override in error.

Re: Q's about UserAuthenticators and getName()

Posted by Darren Shepherd <da...@gmail.com>.
I'll clean it up and submit a patch then. 

Darren

On Sep 15, 2013, at 9:36 PM, Abhinandan Prateek <Ab...@citrix.com> wrote:

> On 13/09/13 10:04 pm, "Darren Shepherd" <da...@gmail.com>
> wrote:
> 
>> On 09/13/2013 03:48 AM, Abhinandan Prateek wrote:
>>> The code already has the name set to ³LDAP² in 4.2. What branch are you
>>> on
>>> ?
>>> Will also prefer if we can use getClass().getSimpleName() to get the
>>> classname, but we should check the possibility of the adapter classnames
>>> getting enhanced by underlying framework.
>> 
>> I'm on master but that doesn't matter, its actually broke in 4.2 also.
>> I originally stated that the DefaultUserAuthenticator masks _name in
>> ComponentLifecycleBase so even though the XML is setting the property to
>> LDAP it doesn't work.  That was sort of my original question, why was it
>> done like that?
>> 
>> I can clean up all the authenticators and submit a patch if we want.
> 
> 
> Looking at git history it appears that _name got masked when the
> DefaultUserAuthenticator was made to extend AdapterBase.
> A cleanup will help.
> 
> -abhi
> 
> 

Re: Q's about UserAuthenticators and getName()

Posted by Abhinandan Prateek <Ab...@citrix.com>.
On 13/09/13 10:04 pm, "Darren Shepherd" <da...@gmail.com>
wrote:

>On 09/13/2013 03:48 AM, Abhinandan Prateek wrote:
>> The code already has the name set to ³LDAP² in 4.2. What branch are you
>>on
>> ?
>> Will also prefer if we can use getClass().getSimpleName() to get the
>> classname, but we should check the possibility of the adapter classnames
>> getting enhanced by underlying framework.
>>
>
>I'm on master but that doesn't matter, its actually broke in 4.2 also.
>I originally stated that the DefaultUserAuthenticator masks _name in
>ComponentLifecycleBase so even though the XML is setting the property to
>LDAP it doesn't work.  That was sort of my original question, why was it
>done like that?
>
>I can clean up all the authenticators and submit a patch if we want.
>


Looking at git history it appears that _name got masked when the
DefaultUserAuthenticator was made to extend AdapterBase.
A cleanup will help.

-abhi

>


Re: Q's about UserAuthenticators and getName()

Posted by Darren Shepherd <da...@gmail.com>.
On 09/13/2013 03:48 AM, Abhinandan Prateek wrote:
> The code already has the name set to ³LDAP² in 4.2. What branch are you on
> ?
> Will also prefer if we can use getClass().getSimpleName() to get the
> classname, but we should check the possibility of the adapter classnames
> getting enhanced by underlying framework.
>

I'm on master but that doesn't matter, its actually broke in 4.2 also. 
I originally stated that the DefaultUserAuthenticator masks _name in 
ComponentLifecycleBase so even though the XML is setting the property to 
LDAP it doesn't work.  That was sort of my original question, why was it 
done like that?

I can clean up all the authenticators and submit a patch if we want.

Darren


Re: Q's about UserAuthenticators and getName()

Posted by Abhinandan Prateek <Ab...@citrix.com>.
The code already has the name set to ³LDAP² in 4.2. What branch are you on
?
Will also prefer if we can use getClass().getSimpleName() to get the
classname, but we should check the possibility of the adapter classnames
getting enhanced by underlying framework.



On 13/09/13 4:41 am, "Darren Shepherd" <da...@gmail.com> wrote:

>DefaultUserAuthenticator masks the _name variable in
>ComponentLifecycleBase effectively making it so that no
>UserAuthenticator gets the default name of getClass().getSimpleName().
>
>Then each authenticator, except LDAP, does something like
>
>if (name == null) {
>   name = "MD5";
>}
>
>So instead of the default MD5UserAuthenticator it comes up with MD5 as
>its name.
>
>So my problem is that LDAP currently has a null name on getName().  So
>which should I do?  Add
>
>if (name == null) {
>   name = "LDAP";
>}
>
>Or remove the masked variable in DefaultUserAuthenticator such that all
>authenticators names will become the classname.  I just need it to be
>consistent for what I'm doing at the moment.  I'd personally prefer that
>they all just get the default name of getSimpleName().  But I don't know
>if there was some reason it was done this way.
>
>Darren