wavemaker visual ajax studio 4.0 training authentication

15
WaveMaker Visual AJAX Studio 4.0 Training Authentication

Upload: philip-boyd

Post on 28-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: WaveMaker Visual AJAX Studio 4.0 Training Authentication

WaveMaker Visual AJAX Studio 4.0 Training

Authentication

Page 2: WaveMaker Visual AJAX Studio 4.0 Training Authentication

2

How to enable authentication

● Users can be authenticated in many ways depending on the particular environment

● Out of the box there are 2 primary authentications methods for production applications

– Database Authentication

– User names and pass words are stored in a DB

– LDAP or Active Directory Authentication

– User names and pass words are stored in a Directory Server

● A Demo authentication mechanism is provided for prototype and non-production use

● Additionally the underlying architecture (ACEGI) is an extensible security model

Page 3: WaveMaker Visual AJAX Studio 4.0 Training Authentication

3

How to enable authentication

● Open Security editor

● Select Security Provider – Demo

– Database

– LDAP

● Check Enable Security

● Check Show Login Page

● Click Save Security Settings

Page 4: WaveMaker Visual AJAX Studio 4.0 Training Authentication

4

Using Database authentication

● Database which stores username/password must be imported.

● Username and Password must stored as different columns in the same table

● Roles will be discussed later

Page 5: WaveMaker Visual AJAX Studio 4.0 Training Authentication

5

Using Database authentication

● Security Provider: Set to Database

● Enable Security: Allows you to turn authentication on and off during development

● Show Login Page: Allows use of generated login page or you can use API’s to authenticate users behind the scenes (i.e. Using Cookies or other SSO)

● Username Field: Used at Login time

● Username ID Field: The ID field for the username can be used to query for additional information

● Password Field: Password field

● Roles Field: More on this later

Page 6: WaveMaker Visual AJAX Studio 4.0 Training Authentication

6

Using Database authentication

● Once you save the settings a few things happen– An internal security service is

added to the application (more on this in a moment)

– A log in page is created and added to your project.

– Do not change the page name

– You can change the fields, style etc of the page

Page 7: WaveMaker Visual AJAX Studio 4.0 Training Authentication

7

Using Database authentication

● Test Run your application

● Users must enter a valid Username / Password combination– Authentication errors are handled

by the login page by default.

– Login button executed JavaScript to call the Login function.

– Can edit the script via source tab to change the error messages

Page 8: WaveMaker Visual AJAX Studio 4.0 Training Authentication

8

Using LDAP or AD authentication

● LDAP Connection parameters: These can be tricky, work with your LDAP Admin

– LDAP URL – specify the host name and port number of the LDAP server

– Manager DN - distinguished name for LDAP access account

– Manager Password – password for LDAP access account

– User DN Pattern – pattern used to create a distinguished name for the user; should be the name relative to the root DN; argument {0} will contain the username

Page 9: WaveMaker Visual AJAX Studio 4.0 Training Authentication

9

Using Demo authentication

● Use the Demo data source for non-production authentication

● Quickly add and remove usernames/passwords for testing

● Before deployment, change to a more secure authentication data source

Page 10: WaveMaker Visual AJAX Studio 4.0 Training Authentication

10

Calling the Security Service

● If security is enabled, WaveMaker adds the Security Service to the project

● You can access the Security Service and it’s common operations using ServiceVariables – getUserName – returns the current user that is

logged in

– getUserRoles – returns a list of all user roles in the project

– isAuthenticated – takes a username as the argument and returns a Boolean

– logout – logs out the current user and terminates the session

Page 11: WaveMaker Visual AJAX Studio 4.0 Training Authentication

11

Adding a Logout Button

● Create a Logout Button– Add a Button to your page

– Create a New ServiceVariable

– name: logout

– service: securityService

– operation: logout

– Set the Button’s onclick event to logout

● When the Button is clicked, the user will be logged out and the session ended BUT the application will be open on the same page with functionality disabled

● To return to the login page you can set the LogoutServices onResult event to go to the Login page using a Navigation Service Call.

Page 12: WaveMaker Visual AJAX Studio 4.0 Training Authentication

12

Calling the Login Page

● Once a user has logged out you will want to reload the login page

– Add a New Navigation: gotoLoginPage

– The logoutService has an event called onResult set it to gotoLoginPage

Page 13: WaveMaker Visual AJAX Studio 4.0 Training Authentication

13

FYI: Live Layout disable with authentication

● Live Layout cannot run if security is enabled

● Enable security just before a test run of the project

● Disable security while designing

Page 14: WaveMaker Visual AJAX Studio 4.0 Training Authentication

14

Questions?

Page 15: WaveMaker Visual AJAX Studio 4.0 Training Authentication

15

Exercise 10

● Enable security

● Add Roles and Users

● Test Authentication

● Add Logout Button