WebSphere Application Server - Initial Context for security enabled WAS Server

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > May 2004 > Initial Context for security enabled WAS Server





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Initial Context for security enabled WAS Server
biyer

2004-05-24, 2:29 am

Hi,
I have a security enabled WAS Server authenticating using LDAP. I have a program which is supposed to run on the same server as Websphere is currently running. Websphere is security enabled with LDAP.

I am getting a security dialog popup asking me to login whenever I run my standalone program. The standalone Java program is supposed to connect to Websphere and invoke a sessionbean. Everytime I run the program, this security logon popup comes up. I have
given the user-id password to bind to websphere in the Initialcontext..inspite of this ..Websphere asks me to login...Any clues.

Here is my code to get an initial context


Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

env.put(Context.PROVIDER_URL, providerURL);
/**User id and password from Ldap/
env.put(Context.SECURITY_PRINCIPAL, "wpsbind");
env.put(Context.SECURITY_CREDENTIALS,"wpsbind");
Is there anything specific to be done to get intialcontext of WAS for passing the username and password of an authenticated user on websphere ?
Manglu

2004-05-24, 7:30 am

Hi,

If you enable Security then you Session Bean is secured.

THe standalone application makes a request to the SB method

THe container notices that the request does not have any credentials
or a token which says that you are authenticated so it challenges via
the pop up box,

This is probably what is happening.

HTH
Manglu
Paul Ilechko

2004-05-24, 11:30 pm

biyer wrote:

> Hi, I have a security enabled WAS Server authenticating using LDAP. I
> have a program which is supposed to run on the same server as
> Websphere is currently running. Websphere is security enabled with
> LDAP.
>
> I am getting a security dialog popup asking me to login whenever I
> run my standalone program. The standalone Java program is supposed to
> connect to Websphere and invoke a sessionbean. Everytime I run the
> program, this security logon popup comes up. I have given the user-id
> password to bind to websphere in the Initialcontext..inspite of this
> ..Websphere asks me to login...Any clues.
>
> Here is my code to get an initial context
>
>
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.ibm.websphere.naming.WsnInitialContextFactory");
>
> env.put(Context.PROVIDER_URL, providerURL); /**User id and password
> from Ldap/ env.put(Context.SECURITY_PRINCIPAL, "wpsbind");
> env.put(Context.SECURITY_CREDENTIALS,"wpsbind"); Is there anything
> specific to be done to get intialcontext of WAS for passing the
> username and password of an authenticated user on websphere ?


You need to do a JAAS login, something like this:

LoginContext lc = null;

try {
lc = new LoginContext("WSLogin",
new WSCallbackHandlerImpl("userName", "realm",
"password"));
} catch (LoginException le) {
System.out.println("Cannot create LoginContext. " +
le.getMessage());
// insert error processing code
} catch(SecurityException se) {
System.out.printlin("Cannot create LoginContext." +
se.getMessage();
// Insert error processing
}

try {
lc.login();
} catch(LoginExcpetion le) {
System.out.printlin("Fails to create Subject. " +
le.getMessage());
// Insert error processing code


Do a search in the WAS info center on "programmatic login" to get more
info.

biyer

2004-05-24, 11:30 pm

Hi,
I got the answer to my query...
Websphere was opening a login prompt everytime, For this: The sas.client.properties was edited.

Following is how the property should look like

#other values are prompt [default], properties, keyfile, stdin, none

com.ibm.CORBA.loginSource=properties
com.ibm.CORBA.securityEnabled=true
com.ibm.CORBA.loginUserid=<user id in ldap>
com.ibm.CORBA.loginPassword=<password>


Thanks
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com