You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Flavio Minori <fl...@topcs.it> on 2007/03/16 10:28:34 UTC

[ApacheDS] Password refresh

Hi all,
I am devoloping my own application and I use Apache DS 1.0.1 + Spring +
Acegi.
When I need to update the userPassword attribute, I use something like this:


[CODE]
...
BasicAttribute userPasswordAttribute = new BasicAttribute("userPassword");
ModificationItem replacedPassword = new
ModificationItem(DirContext.REPLACE_ATTRIBUTE,userPasswordAttribute);
ModificationItem[] modificationItemArray = new ModificationItem[1];
modificationItemArray[0] = "newPasswordString"; try {
ldapTemplate.modifyAttributes(distinguishedName.toString(),modificationItemA
rray);
} catch (DataAccessException e) { ...
[/CODE]

This works right, but I need to restart APACHE DS to make the changes
happens.
This is due to APACHEDS which uses a cache for the simple authenticator.

Possible solutions for me are: 

1) invalidate this cache from the server.xml configuration? How can I do?

2) use my own authenticator that extends the SimpleAuthenticator .. just
remove 2 lines about cache check .. but I need to rebuild ApacheDS
completely. 

Best regards,


Flavio







[ApacheDS] Password refresh

Posted by Flavio Minori <fl...@topcs.it>.
Hi again!
I fix my problem thanks to your explanations about the usage of the cache!
Simply, I use now  a new Acegi authenticator: the
PasswordComparisonAuthenticator.
Before I was using a BindAuthenticator so it was the user himself connecting
to the server, and now there is a manager
Account that verify the ( principal, credentials ) against the LdapServer
and eventually change the user password.

Thank you again,
See ya

Flavio



Re: R: [ApacheDS] Password refresh

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/16/07, Flavio Minori <fl...@topcs.it> wrote:
>
> Hello Emmanuel,
> thanks for the reply.
>
> I am going to check the links you gave me.
>
> I use JXplorer to browse the APACHE DS and I noticed something that I am
> not
> able to explain myself, those are the steps:
>
> - I connect with my user, then I remove the userPassword attribute and
> submit it (so            the userPassword attribute exists with a blank
> value).
> - I change the password and disconnect.
> - Now, I connect again with the new password and it works!
>
> Can u tell me why seems that JXplorer can remove the principal/credentials
> from the authenticationCache without a LDAPServer restart?


Ooops, I think we have fixed the issue in the 1.0.1 version :
https://issues.apache.org/jira/browse/DIRSERVER-782

This is why it now works for you with JXplorer.

In your code, you have to know that the credentials are kept alive until the
user disconnect. It may be improved.


Might it be that it is a simple error on my code and not related to any bug?


Don't know at this point ...
If you can build a very simple test which expose your problem, we can try to
find a fix for it.

What about filling an issue on JIRA with this piece of code so that we try
to add it to the 1.0.2 release ? (we are trying to release this version very
soon, so it's good timing )

Emmanuel.

PS : FYI, we have LdapStudio which is also a ldapBrowser you can try :
http://directory.apache.org/ldapstudio/. It's not yet an official release,
but the Ldap browser is pretty much ok, I think.

-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

R: [ApacheDS] Password refresh

Posted by Flavio Minori <fl...@topcs.it>.
Hello Emmanuel,
thanks for the reply.

I am going to check the links you gave me.

I use JXplorer to browse the APACHE DS and I noticed something that I am not
able to explain myself, those are the steps:

- I connect with my user, then I remove the userPassword attribute and
submit it (so            the userPassword attribute exists with a blank
value).
- I change the password and disconnect.
- Now, I connect again with the new password and it works!

Can u tell me why seems that JXplorer can remove the principal/credentials
from the authenticationCache without a LDAPServer restart?

Might it be that it is a simple error on my code and not related to any bug?

Flavio

  


________________________________________
Da: Emmanuel Lecharny [mailto:elecharny@gmail.com] 
Inviato: venerdì 16 marzo 2007 11.10
A: Apache Directory Developers List
Oggetto: Re: [ApacheDS] Password refresh

Hi Flavion

I reply on the dev list, because I think it's much more a dev related issue
than an user one...

We have fixed this issue and it will be released in the 1.0.2 version,
coming very soon.

In the meantime, you can check out the latest version from the svn
repository, or downloaded the nighty build here :
http://iktek.com/index.jsp?rubrique=ads

The cache is now updated when a user change a password (I least, I hope it
works :)

Emmanuel
On 3/16/07, Flavio Minori <fl...@topcs.it> wrote:
Hi all,
I am devoloping my own application and I use Apache DS 1.0.1 + Spring +
Acegi.
When I need to update the userPassword attribute, I use something like this:


[CODE]
...
BasicAttribute userPasswordAttribute = new BasicAttribute("userPassword"); 
ModificationItem replacedPassword = new
ModificationItem(DirContext.REPLACE_ATTRIBUTE,userPasswordAttribute);
ModificationItem[] modificationItemArray = new ModificationItem[1];
modificationItemArray[0] = "newPasswordString"; try { 
ldapTemplate.modifyAttributes(distinguishedName.toString(),modificationItemA
rray);
} catch (DataAccessException e) { ...
[/CODE]

This works right, but I need to restart APACHE DS to make the changes
happens.
This is due to APACHEDS which uses a cache for the simple authenticator.

Possible solutions for me are:

1) invalidate this cache from the server.xml configuration? How can I do?

2) use my own authenticator that extends the SimpleAuthenticator .. just 
remove 2 lines about cache check .. but I need to rebuild ApacheDS
completely.

Best regards,


Flavio








-- 
Cordialement,
Emmanuel Lécharny 
www.iktek.com 



Re: [ApacheDS] Password refresh

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi Flavion

I reply on the dev list, because I think it's much more a dev related issue
than an user one...

We have fixed this issue and it will be released in the 1.0.2 version,
coming very soon.

In the meantime, you can check out the latest version from the svn
repository, or downloaded the nighty build here :
http://iktek.com/index.jsp?rubrique=ads

The cache is now updated when a user change a password (I least, I hope it
works :)

Emmanuel

On 3/16/07, Flavio Minori <fl...@topcs.it> wrote:
>
> Hi all,
> I am devoloping my own application and I use Apache DS 1.0.1 + Spring +
> Acegi.
> When I need to update the userPassword attribute, I use something like
> this:
>
>
> [CODE]
> ...
> BasicAttribute userPasswordAttribute = new BasicAttribute("userPassword");
> ModificationItem replacedPassword = new
> ModificationItem(DirContext.REPLACE_ATTRIBUTE,userPasswordAttribute);
> ModificationItem[] modificationItemArray = new ModificationItem[1];
> modificationItemArray[0] = "newPasswordString"; try {
> ldapTemplate.modifyAttributes(distinguishedName.toString
> (),modificationItemA
> rray);
> } catch (DataAccessException e) { ...
> [/CODE]
>
> This works right, but I need to restart APACHE DS to make the changes
> happens.
> This is due to APACHEDS which uses a cache for the simple authenticator.
>
> Possible solutions for me are:
>
> 1) invalidate this cache from the server.xml configuration? How can I do?
>
> 2) use my own authenticator that extends the SimpleAuthenticator .. just
> remove 2 lines about cache check .. but I need to rebuild ApacheDS
> completely.
>
> Best regards,
>
>
> Flavio
>
>
>
>
>
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com