Built-in client support for authenticating database connection identity
- Last Updated: October 17, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
Built-in client support for authenticating database connection identity
OpenEdge provides built-in support for client authentication of OpenEdge database connections. If the security administrator has defined authentication-enabled domains in an OpenEdge database, your application can prompt for a user ID and password at the appropriate point to establish a database connection identity by running the standard OpenEdge startup pro2cedure, _prostar.p. This procedure, in turn, runs the standard ABL authentication procedure, _login.p, for each connected database. Your application can also reset a current connection identity, as your application requires.
The _prostar.p procedure also prepares _login.p to
run appropriately in the current application environment (character
or graphical) and verifies that no connected databases have the
logical name DICTDB. This allows _prostar.p to
assign the same alias (DICTDB) to each connected
database before calling _login.p. Then, _login.p can
authenticate access as it is called for each different database
using the same database name.
This is the _login.p procedure.
_login.p
|
The _login.p procedure initializes a client-principal object
by passing the fully qualified user ID and password that the user
enters to the INITIALIZE( ) method and
uses the ABL SET-DB-CLIENT function to authenticate
the user's identity that is passed in the client-principal object.
The user has three tries to enter the correct user ID and password
for each database. If the user fails to do so after three tries, OpenEdge exits
the user from the application. If the user ID and password combination
is valid for the database, SET-DB-CLIENT establishes
that user ID as the database connection ID and deletes the client-principal.
_login.p,
to set the ABL session identity using the same identity as a database
connection, the application can invoke the GET-DB-CLIENT function
on that connection to return a copy of the client-principal. For
more information on setting the ABL session identity, see Establishing ABL session identity.The input parameter for _login.p allows
it to display the authentication prompts either in a dialog box
(viewAsDialog = TRUE) or in the frame of a separate
window (viewAsDialog = FALSE). The _prostar.p procedure
uses a separate window in graphical environments and the default
window in character environments, so it always passes FALSE as
an argument to _login.p.
As explained previously, the _login.p procedure
only works for a database with the DICTDB alias.
(By default, this alias is assigned to the first database you connect
to during a session.) If you want to avoid this restriction, you
can create your own procedures, based on _prostar.p and _login.p,
that pass an argument with the database name.
If your application uses server authentication, you might also
create your own client login procedure, for example, that replace
the call to SET-DB-CLIENT in _login.p with
a call to a remote login procedure on the authentication server.
Typically, this remote login procedure invokes the SECURITY-POLICY:SET-CLIENT( ) method
to authenticate the user identity and returns a sealed client-principal
to the client, which then calls SET-CLIENT( ) to
set the client session identity and possibly the connection identity
for all connected application databases.
If the application does not run _prostar.p at connection time, or if the user bypasses _login.p (by pressing END–ERROR when prompted for the user ID and password), the user is assigned an OpenEdge default user ID. For more information on the OpenEdge default user identity, see Authenticating and managing user identity in ABL.
If you connect to a database dynamically using the CONNECT statement,
you can use the User ID (–U) and Password (–P) connection parameters
in the CONNECT statement, or you can use the SET-DB-CLIENT (or SETUSERID)
function to reset the connection user identity after the connection
is already established.
The following i-passts.p procedure connects
to the mywork database that has a list of valid
users. The user initially connects to the database using the CONNECT statement
with the OpenEdge default user identity. The code then enters a
loop that forces the user to provide a valid user ID and password
for the database user list.
i-passts.p
|