public class DatabaseAuthenticationHook extends java.lang.Object implements Authenticator
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.String> |
authUsers
The map of authenticated userids for each database.
|
private static int |
BUTTON_CANCEL_ID
Cancel button field ID.
|
private static int |
BUTTON_OK_ID
OK button field ID.
|
private ThinClient |
client
Client interface.
|
private static java.lang.String |
DLG_BTN_CANCEL_TEXT
The text on OK button from the [Login] dialog
|
private static java.lang.String |
DLG_BTN_OK_TEXT
The text on OK button from the [Login] dialog
|
private static int |
EDIT_FID
Edit frame ID.
|
private ScreenBuffer |
editsb
The screen buffer for the editing frame.
|
private static java.lang.String |
INVALID_CREDENTIALS
Invalid user status message.
|
private static int |
LAST_CONFIG_COMP
Keep the id of the last component.
|
private static int |
MSG1_ID
ID for message on 1st line.
|
private static int |
MSG2_ID
ID for message on 2nd line.
|
private java.lang.String |
p2jAuthUser
The value of "option" node from AuthPlugin for this Authenticator
|
private static int |
PASSWORD_ID
Password field ID.
|
private static java.lang.String |
STD_MSG_1
First line of the [Login] dialog.
|
private static java.lang.String |
STD_MSG_2
First line of the [Login] dialog.
|
private static int |
USER_ID
User ID field ID.
|
AUTH_ACTION_ABORT, AUTH_ACTION_CONTINUE, AUTH_ACTION_DONE, AUTH_ACTION_RETRY, AUTH_MODE_CUSTOM, AUTH_MODE_HIGHEST, AUTH_MODE_IDPW, AUTH_MODE_LOWEST, AUTH_MODE_NONE, AUTH_MODE_X509, AUTH_MODE_X509_IDPW, AUTH_REQ_PROCESS, AUTH_REQ_PROGRAM, AUTH_REQ_USER, AUTH_RESULT_INSUFFICIENT_RIGHTS, AUTH_RESULT_INVALID_PASSWORD, AUTH_RESULT_INVALID_USERID, AUTH_RESULT_NONE, AUTH_RESULT_SKIP_TO_NEXT, AUTH_RESULT_SUCCESS, AUTH_RESULT_UNSPECIFIED_FAILURE, PKT_SIZE_SKIP_TO_NEXT
Constructor and Description |
---|
DatabaseAuthenticationHook()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addAuthUser(java.lang.String ldbName,
java.lang.String userid)
Adds an authenticated user to the internal list list.
|
private static void |
addSkip(ScreenDefinition sd,
int lines,
int id)
Helper method, adds specified number of empty lines to a ScreenDefinition.
|
byte[] |
clientAuthHook(java.util.Map<java.lang.String,java.lang.Object> parameters,
int code)
Implements client side authentication logic.
|
void |
clientFinalize()
Finalizes any resources allocated during authentication by the client.
|
void |
configure(java.lang.String p2jUser)
Configures the Authenticator by setting the "option" parameter from directory.xml.
|
private void |
createFrameDefinition(java.lang.String database)
Create the user interface definition for frame that holds the standard dialog that prompts
the user for userid/password combination.
|
static void |
displayWrongPassword(java.lang.String userid)
Displays a dialog informing the user that the entered database credentials are invalid.
|
java.util.Set<java.lang.String> |
getAuthenticationEntities()
Returns a set of databases that need to be authenticated.
|
SessionListener |
getSessionListener()
A session listener will be returned only if any user was successfully authenticated
to a database.
|
AuthenticationResponse |
serverAuthHook(byte[] auth,
java.lang.String ldbName)
Implements server side authentication logic.
|
private static final int EDIT_FID
private static final int MSG1_ID
private static final int MSG2_ID
private static final int USER_ID
private static final int PASSWORD_ID
private static final int BUTTON_OK_ID
private static final int BUTTON_CANCEL_ID
private static final int LAST_CONFIG_COMP
private static final java.lang.String STD_MSG_1
private static final java.lang.String STD_MSG_2
private static final java.lang.String DLG_BTN_OK_TEXT
private static final java.lang.String DLG_BTN_CANCEL_TEXT
private static final java.lang.String INVALID_CREDENTIALS
private ThinClient client
private ScreenBuffer editsb
private java.util.Map<java.lang.String,java.lang.String> authUsers
private java.lang.String p2jAuthUser
public DatabaseAuthenticationHook()
public byte[] clientAuthHook(java.util.Map<java.lang.String,java.lang.Object> parameters, int code)
clientAuthHook
in interface Authenticator
parameters
- Additional configuration parameters.code
- The result of the most recent attempt to authenticate or
AUTH_RESULT_NONE
if this is the first attempt.public AuthenticationResponse serverAuthHook(byte[] auth, java.lang.String ldbName)
Accepts the byte array produced by the client side authentication hook as authentication input as well as any custom parameters.
serverAuthHook
in interface Authenticator
auth
- The authorization input from the client.ldbName
- Additional configuration parameters taken from the directory.public java.util.Set<java.lang.String> getAuthenticationEntities()
getAuthenticationEntities
in interface Authenticator
public void configure(java.lang.String p2jUser)
configure
in interface Authenticator
p2jUser
- The value of userid stored that will be used for authentication to p2j
SecurityManager.private void addAuthUser(java.lang.String ldbName, java.lang.String userid)
ldbName
- The logical name of teh database that authenticated the user.userid
- The authenticated user.public SessionListener getSessionListener()
getSessionListener
in interface Authenticator
public void clientFinalize()
clientFinalize
in interface Authenticator
public static void displayWrongPassword(java.lang.String userid)
userid
is null, the displayed dialog will simply print
+------------ Error ------------+
| Userid/Password is incorrect. |
| ----------------------------- |
| <OK> |
+-------------------------------+
Otherwise will print the P2J counter-part message of the 710 dialog of P4GL.
+---------------------- Error ----------------------+
| ** Your Password and Userid x do not match. (710) |
| |
| ------------------------------------------------- |
| <OK> |
+---------------------------------------------------+userid
- The userid that was used in an authentication attempt.private static void addSkip(ScreenDefinition sd, int lines, int id)
sd
- The frame to which to add a skip.lines
- Lines to skip.id
- Widget ID to be used for this skip widget.private void createFrameDefinition(java.lang.String database)
+------------------- Login -------------------+ | | | Please enter a User Id and Password for | | database: <ldbname> | | | | User Id: ________________ | | Password: ________________ | | | | <OK> <Cancel> | +---------------------------------------------+
database
- The name of the database for which the userid/password is requested.