This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Configure application authentication

Information about development with ProjX.

--Configure application authentication

Postby Development@SIB » Sat Dec 22, 2012 9:37 pm



This article is outdated - please use our new system at

https://doc.sibvisions.com




The default JVx application has a login screen and the user must enter a valid username and password for successful authentication. It does not offer automatic login or login with different authentication mechanism like OpenID, Facebook, etc.

With ProjX, it's easy to integrate new authentication mechanism or change authentication mechanism.

Configure an authenticator in the application.xml of your application, like:

Code: Select all
<Application.authenticator>
  com.sibvisions.apps.auth.UserPwdAuthenticator
</Application.authenticator>

It's allowed to use more than one authenticator, comma separated. We have ready-to-use authenticators for Username/Password, AutoLogin for returning users, Online registration, NTLM.

If you need a different authenticator, simply implement com.sibvisions.apps.auth.IAuthenticator.

Our Username and Password authenticator contains following code:

Syntax: [ Download ] [ Hide ]
public Hashtable<String, String> getCredentials(ILauncher pLauncher)
{
        Hashtable<String, String> htCred = new Hashtable<String, String>();
       
        String sValue = pLauncher.getParameter("Application.Login.application");
       
        if (sValue != null)
        {
                htCred.put(APPLICATION, sValue);
        }
       
        sValue = pLauncher.getParameter("Application.Login.username");
       
        if (sValue != null)
        {
                htCred.put(USERNAME, sValue);
        }
       
        sValue = pLauncher.getParameter("Application.Login.password");
       
        if (sValue != null)
        {
                htCred.put(PASSWORD, sValue);
        }
       
        if (htCred.isEmpty() || htCred.size() == 1)
        {
                //empty: no login data available
                //1 entry: only application name is not enough;
                //         only username is not enough
                return null;
        }
       
        return htCred;
}

It needs some more lines in application.xml:

Code: Select all
<Application.Login.username>jvx</Application.Login.username>
<Application.Login.password>welcome</Application.Login.password>

If you implement your own authenticator, consider that you' need (or not) a custom security manager, because the authenticator is client-side only. If you configure an authenticator, ProjX tries to open a new MasterConnection and sets your "credentials" as connection properties. The security manager checks given credentials and authenticates a user.

In ProjX we have a security manager that allows anonymous authentication. It allows an application to show database content before a user is authenticated. It's not a security problem because the client sends an authentication request and the security manager checks if anonymous authentication is enabled. An anonymous user has no screens assigned. It only has access to the Session life-cycle object.
User avatar
Development@SIB
 
Posts: 325
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation