|
Hi All, I
have found a slight inconsistency in the Acegi Security UserMap class. The UserMap.getUser method returns a User object,
however the UserMap.addUser method takes in the UserDetails interface as a
parameter. I needed to write a custom UserAccounts class, which I wanted to be
able to be used by Acegi Security and so from reading the documentation I
thought that implementing this interface was all I needed to do and then add
this object to the UserMap via the addUser method. However when I attempt to log into our system using
Acegi Security I now get a ClassCastException since my object is not of type
User. I have had a look through the source and the only places that use the
UserMap class to get a configured user expert a return type of the UserDetails interface
anyway. I would like to suggest changing the getUser method to
return the UserDetails interface along with actually changing the getUserMethod
from: public User getUser(String
username) throws UsernameNotFoundException { User
result = (User) this.userMap.get(username.toLowerCase()); if (result
== null) {
throw new UsernameNotFoundException("Could not find user: " +
username); } return
result; } To public User getUser(String
username) throws UsernameNotFoundException { UserDetails
result = (UserDetails) this.userMap.get(username.toLowerCase()); if (result
== null) {
throw new UsernameNotFoundException("Could not find user: "
+ username); } return
result; } Does anyone have any objections to this suggestion? Sorry about posting this bug via the mailing list,
but I could not see any way to report this bug via JIRA or the website. For
future reference I would like to know the correct procedure for posting bugs. Kind Regards, Pete |
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Home: http://acegisecurity.org Acegisecurity-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
