Using Uniface Authentication

To use Uniface’s authentication method:

  1. In the servlet specification, add the AUTHORIZATION parameter, for example,
    <servlet>    
       <servlet-name>      
          wrd
       … …
       <init-param>          
          <param-name>AUTHORIZATION</param-name>          
          <param-value>Realm</param-value>
       </init-param>
    </servlet>

    If the Web server is Tomcat, the servlet specification is in web.xml.

    With this setting, a logon box is displayed for each first access of a server page by a particular user. The user name and password are available for the duration of the whole session. You can use $user and $password to access them.

    To validate the user name and password, you need to add ProcScript in the server page, or in the startup shell of the application server. The following steps give an example of how to check users information in the application shell.

  2. Define an application shell for the Uniface Server, for example, webasv.
  3. In the preRequest trigger of webasv, check the user name and the password, for example:
    if($user !="correct-user" | $password != "password-for-the-correct-user")   
       return (-21)
    endif

    The correct-user and the password-for-the-correct-user are only for the demonstration purpose.

  4. Compile the application shell and add it to a UAR.
  5. Edit the assignment file of the Uniface Router to specify the new server application shell. For example:
    ; For Uniface WebApplication Server
    wasv = "D:\Uniface\Uniface10\common\bin\userver.exe webasv.aps" /dir="D:\Uniface\Uniface10\project" /adm="D:\Uniface\Uniface10\uniface\adm" /asn=wasv.asn
  6. Edit the assignment file of the Uniface Web Application Server to use the new application shell.

    In wasv.asn, list the application shell higher in the [RESOURCES] section than userver.aps. For example:

    [RESOURCES]			
      c:\MyCompany\aps\webasv.aps
      c:\MyCompany\webapp.uar
      c:\MyCompany\webapp@usa.uar
      c:\MyCompany\aps\userver.aps

Related Topics