Skip to Content
author's profile photo Former Member
Former Member

JAAS J2EE Remote Login

How can i login to a remote SAP NetWeaver 6.40 SR1 j2ee server?

I try this:

LoginContext vLContext = new LoginContext("SAP-J2EE-Engine", new ABSCallbackHanlder("id", "psw));

vLContext.login();

and this work fine if this run under the web container.

But if is used from a external client (on other machine), this exception occurs:

Caused by: java.lang.SecurityException: Unable to locate a login configuration

at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)

I have the jndi.properties in classpath.

Using JBoss the system properties "java.security.auth.login.config" must be set to the auth.conf file.

I think that for SAP i need to do it also, but i don't find this kind of configuration file.... Where i can find it?

Thank You

Roberto

ABSCallBackHanlder is:

public class ABSCallbackHanlder implements CallbackHandler

{

protected String iUserName;

protected String iUserPassword;

public ABSCallbackHanlder(String aUserName, String aUserPassword)

{

iUserName = aUserName;

iUserPassword = aUserPassword;

}

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException

{

for (int i = 0; i < callbacks.length; i++)

{

if (callbacks<i> instanceof TextOutputCallback)

{

TextOutputCallback toc = (TextOutputCallback) callbacks<i>;

switch (toc.getMessageType())

{

case TextOutputCallback.INFORMATION :

System.out.println(toc.getMessage());

break;

case TextOutputCallback.ERROR :

System.out.println("ERROR: " + toc.getMessage());

break;

case TextOutputCallback.WARNING :

System.out.println("WARNING: " + toc.getMessage());

break;

default :

throw new IOException("Unsupported message type: " + toc.getMessageType());

}

}

else if (callbacks<i> instanceof NameCallback)

{

NameCallback nc = (NameCallback) callbacks<i>;

nc.setName(iUserName);

}

else if (callbacks<i> instanceof PasswordCallback)

{

PasswordCallback pc = (PasswordCallback) callbacks<i>;

pc.setPassword(iUserPassword.toCharArray());

}

else

{

throw new UnsupportedCallbackException(callbacks<i>, "Unrecognized Callback");

}

}

}

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 22, 2005 at 07:16 AM

    Hi Roberto,

    AFAIK, to do a remote login you need to use the RemoteLoginContext instead of the pure JAAS LoginContext. For more details you can have a look at this page in the documentation: http://help.sap.com/saphelp_nw04/helpdata/en/ac/ce417acc9a4d48aa52fa562cb9b194/frameset.htm

    Hope that helps!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.