Hello Tibi,
That was very helpful for me, I thank you a lot.
The first problem is solved. My problem now is:
I want to Enable/Disable a Hyperlink on my jsp page depending on the user
role. Do you have an idea please? I dont have an experience with struts but
I am obliged o use it.
Thanks.
tibi wrote:
>
> you mean something like this:
>
> public User getLoggedInUser() {
> User currentUser = null;
> final SecurityContext ctx = SecurityContextHolder.getContext();
> if (ctx.getAuthentication() != null) {
> final Authentication auth = ctx.getAuthentication();
> if (auth.getPrincipal() instanceof UserDetails) {
> currentUser = (User) auth.getPrincipal();
> } else if (auth.getDetails() instanceof UserDetails) {
> currentUser = (User) auth.getDetails();
> } else {
> throw new AccessDeniedException("User not properly
> authenticated.");
> }
> }
> return currentUser;
> }
>
>
> lounnaci wrote:
>> How can i recuperate the user logged in name using struts?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Appfuse-login-user-tp25040252s2369p25041233.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]