First of all, I suspect that you are in the wrong forum, since I assume your question is about web applications.
Second, what is the name of the principal that (probably) is defined in your application server?
Note that you can NOT obtain the name of the user retrieving the name of the principal, you will obtain the name of the principal which matched the user login credentials.
Thank you for your reply.
Actually I posated in EJB and Other Java EE Technologies. As there is no reply, I posted here also.
As I am using getUserPrincipal() method first time. I dont know much about it.
But here I will describe about my application below clearly.
My application is recently integrating with SSO. SSO (LTPA) part is taking care by another team. As my client has many applications, he is going to integrate all applications under SSO. One of them is my application. Only authorized persons can enter into my application.
Here from our side we have done all changes and application is working fine except the above issue.
For testing getUserPrincipal() method in my local system, in websphere 6.1 I have enabled Administrative security and selected Local operating system user account repository. Now we have to provide credentials in order to enter into websphere console and also my application.
After login into websphere with credentials(user name as proliant ), on top its showing welcome Proliant i.e, p as capitcal letter.
When I ran my application, in logs it showing user name as Proliant. If we create new user with Proliant at the backend then its working.
Below is my code
You have mention name of the principal that (probably) is defined in your application server . Please let me know where this name of the principal is defined in application server and as read some where that Java.security.Principal.getName() will gives the username.
Actually what is the meaning of principal....???
Note: Websphere is installed by portal team. we dont have any admin role on it.
Joined: Oct 04, 2006
A principal connects an identity with a credential which can be used for authentication. For instance, associates a user with a password.
For some explanations, see page 322-323 in this document: http://www.slideshare.net/krizsan/ocp-jbcd-6-study-notes The reason for you seeing "proliant" in one place and "Proliant" in another may be that the latter is the user name (being part of the principal) and the former is the login credential (not being available in the principal).
I am not familiar with Websphere, so I cannot help you with configuration of the server, sorry.