Example: Authentication Using Client/Server Login Dialog |
This example describes a case where a Client/Server startup login dialog is required to authenticates the USoft application user. In this example, the user is a funneling account that only exists in USoft; there is no database account for that user. The USoft application uses a single RDBMS funnel account to serve all its funneling users.
This login dialog is the result of specifying a WindowsCreate action in the Windows Designer, when defining this application, for example: WindowCreate(My Login Dialog) This action is specified in the Windows Designer using the Edit Application option from the File menu, the choosing the Behavior tab from the Application Properties option. The default username is retrieved using: RulesEngine.GetProperty('OSUSERNAME'). The assignment takes place on the Username field, in the behavior tab Post-create property specified as: Variables.Username(RulesEngine.GetProperty('OSUSERNAME'))
The action on the OK button executes the Rules Engine SetUser method but avoids readable password echoes by making sure that error messages are not generated: ActionDecision(StartCatchingErrors) ActionDecision( SET_USER, Variables.Username(), Variables.Password() ) ActionDecision( StopCatchingErrors) ActionDecision(GetCaughtErrors) If the user name does not exist or is not associated with the application, a message is shown about the credentials being invalid. The logic specified in decisions for this example is:
SQL: SELECT RulesEngine.StartCatchingErrors('Yes') Yes/No actions: do-nothing()
SQL: SELECT RulesEngine.StopCatchingErrors() Yes/No actions: do-nothing()
SQL: SELECT RulesEngine.SetUser(:1, :2, '') Yes action: dialog-ok() No action: Variables.Password(''); Variables.Username.Text_Box.ControlSetFocus()
SQL: SELECT RulesEngine.GetLastCaughtErrors() Yes action: MessageInformation(:1) No action: do-nothing()
If the user group changes, the application property "After Usergroup Changed" fires. This allows user group-specific actions like opening a window or catalog. If the user group changes, the First Menu Page specified for the new user group become active. The After SetUser behavior property fires. This allows user-specific actions to be programmed.
|