cancel
Showing results for 
Search instead for 
Did you mean: 

JAAS J2EE Remote Login

Former Member
0 Kudos

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");

}

}

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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!