Login customization

Introduction

After you have configured the host connections, your users can start a LogWeb/Ajax session. Usually, only the "base URL" is entered, for example, for a stand-alone servlet container in test mode

http://test.mycompany.com:8080/ajax

or for an front-end Web server in productive operation

http://www.mycompany.com/tomcat/ajax

In LogWeb/Ajax, further paths are defined:

You can display these links on any HTML pages.

The following sections describe further customization options for special cases:

Overview: starting a session

When you enter the LogWeb/Ajax base URL in the browser's address field, the login page usually opens:

The login page also enables the user password to be changed.

The login page is skipped

After a successful login, the start page is displayed:

If you made this setting in the connection template, the client computer environment is then identified and transmitted to the server.

The actual start of the session now takes place:

When calling the base URL, you can add additional parameters in the query string. If these have been successfully checked, the login or start page can be skipped.

Customizing the start page

The start page

showLinks.jsp

is automatically loaded when starting a session and is divided into four sections:

  1. Message area

    You can inform users about changes to access times or announce other general information.

  2. Login area

    Depending on user rights, this area offers the following options:

    You can find a detailed description of the defined attributes in the "User administration" section.

  3. Global links

    Displays links to host connections that are available for all users.

  4. Group-specific links

    In this area, users only see the host connections that only their corresponding user group can access.

Before you change the start page, you must decide which users the page is intended for:

We recommend that you always change only a copy of the showLinks.jsp file. Note that you must update the cache to apply the changes.

In the following example, the global links (section 3 of the start page) are hidden. The section for displaying general notes (section 1 of the start page) is thus made visible:

<!-- the dialog -->
<table class="dialog">
    <!-- title msg -->
    <thead>
        <tr>
            <td colspan="2"><h3><%= pagetitle %></h3></td>
        </tr>
    </thead>
    <!-- space at bottom of dialog -->
    <tfoot>
        <tr><td colspan="2"></td></tr>
    </tfoot>
    <!-- message area ; to hide, use style='display: none;' -->
    <tbody>
        <tr>
            <td colspan="2">
                <div class="textbox">
                ...
                </div>
            </td>
        </tr>
    </tbody>
...
<%
}
String[][] links;
// create custom links; to hide, comment following lines
links = globalLinks;
if (links.length > 0)
{
%> <!-- Start of generated links for all groups; to hide specify style='display: none;' --> <tbody style='display: none;'> <tr> <td colspan="2"> <hr> </td> </tr> <% for (int i = 0; i < links.length; i++) { %> <tr> <td colspan="2"> <a href="<lws:root/>/login/index.jsp?_StartLink=*<%= links[i][0] %>" onclick="return load(this.href)"><%= links[i][1] %></a> </td> </tr> <% } %> <!-- End of generated links for all groups --> </tbody> <% } // End of custom links // create group specific links; to hide, comment following lines links = groupLinks; if (links.length > 0) { %> <!-- Start of generated links for current group; to hide specify style='display: none;' --> <tbody> <tr> <td colspan="2"> <hr> </td> </tr> <% for (int i = 0; i < links.length; i++) { %> <tr> <td colspan="2"> <a href="<lws:root/>/login/index.jsp?_StartLink=<%= links[i][0] %>" onclick="return load(this.href)"><%= links[i][1] %></a> </td> </tr> <% } %> <!-- End of generated links for current group --> </tbody> <% } // End of group specific links %>

Using start links on other HTML pages

If you want to use the start links that are displayed on the start page for other Web applications or portal pages, you must display the source code of the start page in the browser. The links are then generated from the valid connection templates after the login and are therefore not located in the source code of the start page showLinks.jsp.

The generated links are structured as follows:

    <tbody>
        <!-- Start of generated links -->
        ...
        <tr>
            <td colspan="2">
                <a href="../login/index.jsp?_StartLink=*logweb-demo.ini"
                   onclick="return load(this.href)">LOG-WEB mit user "demo" auf localhost:5000</a>
            </td>
        </tr>
        ...
        <!-- End of generated links -->
    </tbody>

Each start link uses

?_StartLink=VORLAGE.ini

to link to a connection template:

<a href="../login/index.jsp?_StartLink=*logweb-demo.ini"
   onclick="return load(this.href)">LOG-WEB mit user "demo" auf localhost:5000</a> 

The JavaScript command load(url) in the start page ensures that the current browser window is replaced by the Ajax application when the command is called:

<script type="text/javascript">
...
function load(url) {
    if (url) {
        if (lwData) {
            var qm = url.indexOf('?');
            var sep = qm >= 0 ? '&' : '?';
            for (x in lwData) {
                url += sep + x + '=' + encodeURIComponent(lwData[x]);
                sep = '&';
            }
        }
        window.location.replace(url);
    }
    // MUST return false for <a href="..." onclick="load(..)">..
    return false;
}
...
</script>

You can copy the generated links to other HTML pages, however, you must then either remove the onclick="..." attribute from the link or provide the load(url) JavaScript function. In any case, you must add the base URL to the URL ../login/index.jsp of the login page.

If you use the link that is inserted in this way, you are usually prompted for your user name and password before the specified connection is started.

Notes:

In these cases, use only the connection templates that you have made available for all users ("All Groups" is selected in the connection wizard). If users from another group log in, they have no access to the called application, and the start page that is valid for their group is displayed.

The links to connections for all groups can be found in section 3 of the start page; the names of the relevant connection names begin with an asterisk '*'.

Start links with parameters

If you need to generate many external links that only differ by a single option, you can also define these values in the query string of the URL.

If you want to display several of these links on the start page, we recommend that you copy and modify an existing template in the connection wizard.

Example: The links only have different server names:

Important:

The acceptance of external data at the start of a session can be a security risk and is therefore disabled by default. However, you can define a test file that specifically checks and accept external data.

Evaluating the client computer environment

In special situations, it may make sense to define additional settings like "LU name" or "Unix Environment Variables" during application start individually. In these cases, copy the login page config/doLogin.jsp to the file directory //CustomData and modify the page accordingly.

Frequently, such additional settings can be automatically generated from the environment of the client computer. The login page can be modified so that a small Java Applet is loaded to provide this information.

...
/**
 * set to true if information from the local (client) environment have to be
 * retrieved.
 * Further modifications must be made to the JavaScript function
 *     lw.env.collectParams
 * in this case.
 */
final boolean useApplet = true;
...

To generate additional settings, edit the login page

//CustomData/doLogin.jsp

and enter your special algorithm in the form of JavaScript commands. The function lw.env.collectParams() contains some examples to help you modify the page to your requirements. You can find other useful fields and methods in the JavaScript objects lw.env and lw.login.

Finally, in the myOnload() function, you define whether to automatically load the Ajax application and whether the login page is loaded without user interaction:

/**
 * Callback from BODY.onload
 */
function myOnload() {
    ...
    // do not pass the back the received user name since we do a new login
    // delete at loading the page since the form provides _User
    delete lwData._User;
    // do not pass _Group back to /login/index.jsp since we do a new login
    // delete at loading the page since automated logins may provide _Group
    delete lwData._Group;
<% if (useApplet) { // Start of code supporting the AjaxApplet %>
    // start AjaxApplet automatically
    lw.env.createAppletTag();
    // set to true if data have to be transmitted automatically
    lw.env.autoStart = false;
<% } // End of code supporting the AjaxApplet %>
}

Note that you must update the cache after you have changed these files.

Test files: *.valid and valid.properties

As described above, additional information from the query string of the URL or from the environment of the client computercan be evaluated. This can be a security risk, because the (basically secure) internal information from the connection template or from the user administration service is supplemented or modified by (basically insecure) external information.

Therefore, both of these options are excluded by default. However, you can define a test file that specifically checks and accepts external data:

Test files are simple text files that are structured by lines:

Examples:

You can find a template with all parameters in config/valid.properties. You need to copy this file according to the above conventions to the relevant directory (//CustomData/_login or //GroupData/GROUP/_login). This template allows any input for all parameters. Therefore, you need to customize this test file so that only the input you want is allowed. In the following example, irrelevant lines are simply commented out:

# contains regular expressions for all parameters
# that may be changed in a copy of doLogin.jsp

# should be modified according to the variable values
# returned by doLogin.jsp

# general parameters
_StatusText               = .*
#_Language                = de|en
#_LogLevel                = [0-9]?
...
#LOGWEB_IdleTimeout       = -?[0-9]*
# dialog terminal
LOGWEB_StationName        = .*
LOGWEB_StationType        = .*
#LOGWEB_UnicodeConversion = .*
...

Note that you must update the cache after you have changed these files.

Customizing the layout of the emulation window

The start page config/_ajax.jsp defines the visible LogWeb/Ajax emulation window. If all security checks are successful, the start page is loaded after the login and after a connection has been selected.

Usually, you do not need to customize this file. For special cases and for the integration into your own portal page, there are the following configuration options:

If you want to customize the file, first copy the file from the basic configuration config to the custom configuration //CustomData and make your changes there. This enables you to easily apply your customizations when updating to subsequent versions.

Note that your changes are only applied after the cache is refreshed!