Peter Kharchenko wrote:
Hello,
Another small question. I am using both anonymous and dao
authentication providers. I am using Authentication.getPrincipal()
method to obtain user name. In the case of anonymous authentication,
the method returns a String, but DAO authentication returns a User
object. So to get the user name, I have to check what is being
returned, and have special clauses for the DAO authentication. I was
hoping that getName() method would return user name, but it returns a
serialized version of the User object.
I am wondering if there's another way of getting user name, or if this
is a bug.
If you'd always like a String to be returned, use
DaoAuthenticationProvider.setForcePrincipalAsString(true). It defaults
to false.
Cheers
Ben
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Home: http://acegisecurity.sourceforge.net
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer