Hey Ben,
I got it the same way you proposed it, but I always get an ClassCastException.
What is wrong?
My Class:
Code:
package clara.bo.model;
import net.sf.acegisecurity.GrantedAuthority;
import net.sf.acegisecurity.UserDetails;
/**
*
*/
/**
* @author Johannes.Hiemer
*
*/
public class AuthenticatedUser implements UserDetails {
public User currentUser;
/**
* @return Returns the currentUser.
*/
public User getCurrentUser() {
return currentUser;
}
/**
* @param currentUser The currentUser to set.
*/
public void setCurrentUser(User currentUser) {
this.currentUser = currentUser;
}
public boolean isAccountNonExpired() {
return false;
}
public boolean isAccountNonLocked() {
return false;
}
public GrantedAuthority[] getAuthorities() {
return null;
}
public boolean isCredentialsNonExpired() {
return false;
}
public boolean isEnabled() {
return false;
}
public String getPassword() {
return null;
}
public String getUsername() {
return null;
}
}
Code:
((AuthenticatedUser)acegiContext.getAuthentication().getPrincipal()).getCurrentUser();
Thanks a lot
Regards Johannes