cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Login Module

Former Member
0 Kudos

Hi Everyone,

I have several doubts on creating a custom login module.

1. If I wanted to extend my login module from SAP's HeaderVariableLoginModule class, what is the base class I should extend from? Where can I get the package that contains this base class?

2. The HeaderVariableLoginModule is using the REMOTE_USER header variable. Is there a way to use some other headers instead of using REMOTE_USER? I have tried to configure an option called header="myHeader" in the login stack, but the login module keeps reverting to the REMOTE_USER header variable.

3. In my custom login module, I wanted to get the user's login ID from the header. I used the following lines in my code:

((HttpGetterCallback) callbacks[0]).setType(

HttpCallback.HEADER);

((HttpGetterCallback) callbacks[0]).setName("REMOTE_USER");

If my understanding is correct, this should get the user's login ID from the "REMOTE_USER" header. However, the code is not getting any values from the header. I am pretty positive that the header has been injected into the request because SAP's HeaderVariableLoginModule is working with my "REMOTE_USER" header injection.

Any assistance is greatly appreciated. Should there be any need for clarifications, I would be more than happy to provide them.

Thank You.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Answers (3)

Answers (3)

Former Member
0 Kudos

<i>3. In my custom login module, I wanted to get the user's login ID from the header. I used the following lines in my code:

((HttpGetterCallback) callbacks[0]).setType(

HttpCallback.HEADER);

((HttpGetterCallback) callbacks[0]).setName("REMOTE_USER");

If my understanding is correct, this should get the user's login ID from the "REMOTE_USER" header. However, the code is not getting any values from the header. I am pretty positive that the header has been injected into the request because SAP's HeaderVariableLoginModule is working with my "REMOTE_USER" header injection.</i>

To obtain values from a callback handler:

<i>Callback[] callbacks = new Callback[2];

callbacks[0] = new HttpGetterCallback();

callbacks[1] = new HttpGetterCallback();

String headerName = (String)this.options.get("header");

String trustedIPs = (String)this.options.get("trusted_IPs");

if (headerName == null)

headerName = "myHeader";

if (trustedIPs == null)

trustedIPs = "";

((HttpGetterCallback) callbacks[0]).setType(

HttpCallback.HEADER);

((HttpGetterCallback) callbacks[0]).setName(headerName);

((HttpGetterCallback) callbacks[1]).setType(

HttpCallback.CLIENT_IP);

try {

callbackHandler.handle(callbacks);

} catch (UnsupportedCallbackException e) {

return false;

} catch (IOException e) {

throwUserLoginException(e, LoginExceptionDetails.IO_EXCEPTION);

}

userName = (String) ((HttpGetterCallback) callbacks[0]).getValue();

String IP = (String) ((HttpGetterCallback) callbacks[1]).getValue();

loc.infoT("userName: " + userName);

loc.infoT("IP: " + IP);</i>

Former Member
0 Kudos

<i>2. The HeaderVariableLoginModule is using the REMOTE_USER header variable. Is there a way to use some other headers instead of using REMOTE_USER? I have tried to configure an option called header="myHeader" in the login stack, but the login module keeps reverting to the REMOTE_USER header variable.</i>

To use a header other than the default "REMOTE_USER" header for the HeaderVariableLoginModule, specify "Header=<header name to be used>" in the options. The options are case-sensitive and it is therefore imperative to use only "<b>H</b>eader"

Former Member
0 Kudos