VGAuthenticationState Class |
Namespace: Novalys.VisualGuard.Security
The VGAuthenticationState type exposes the following members.
Name | Description | |
---|---|---|
VGAuthenticationState |
Creates a new instance of VGAuthenticationState.
|
Name | Description | |
---|---|---|
IsCanceled |
Checks whether the authentication process has been canceled by the user.
| |
IsCredentialInvalid |
Checks whether the authentication process has failed due to bad credentials (user or password incorrect).
| |
IsFailed |
Checks if the authentication process has failed
| |
IsLastBadLogin |
Checks whether the next bad logon attempt will lock out the user account.
| |
IsLastGraceLogon | Obsolete.
Checks whether it is the last grace logon before locking out the account.
| |
IsNotApproved |
Checks whether the user is not approved and cannot be authenticated.
| |
IsPasswordExpired |
Checks whether the password is expired according to the password policy.
| |
IsPasswordSecure |
Checks whether the password is secure enough according to the password policy.
| |
IsUserAccountDisabled |
Checks whether user account is disabled.
| |
IsUserAccountExpired |
Checks whether the user account has expired.
| |
IsUserAccountLocked |
Checks whether user account is locked
| |
IsUserAccountLockedOut |
Checks whether the user account is locked out due to bad credentials.
| |
IsUserAccountNotYetAvailable |
Checks whether the user account exists but is not yet available.
| |
IsUserAccountWillBeLockedOut |
Checks whether the user account will be locked out for the next logon attempt.
| |
IsUserNotAuthorized |
Checks whether the user is not authorized to access to the application.
| |
MustChangePasswordAtNextLogon |
Checks whether the user must change the password at next logon.
| |
Status |
Gets a VGAuthenticationStatus corresponding to the authentication state.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString |
Convert the state to a string value.
(Overrides ObjectToString.) |
Reauthenticate: VGAuthenticationState state = VGSecurityManager.Authenticate(user.Text, password.Text); if (state.IsFailed) { if (state.IsCanceled) return; if (state.IsCredentialInvalid) { if (state.IsLastBadLogin) { MessageBox.Show("Invalid user or password. The next bad login will lock your account."); } else { MessageBox.Show("Invalid user or password"); } } else if (state.IsUserNotAuthorized) { MessageBox.Show("user not authorized to log on the application"); } else if (state.IsUserAccountExpired) { MessageBox.Show("your account is no more valid. Contact your administrator"); } else if (state.IsUserAccountNotYetAvailable) { MessageBox.Show("your account is not yet available."); } else if (state.IsUserAccountLockedOut) { MessageBox.Show("your account is locked out. Contact your administrator."); } else if (state.MustChangePasswordAtNextLogon) { if (!state.IsPasswordSecure) { if (state.PasswordExpired) { MessageBox.Show("Your password has expired. You are required to change it."); } else { MessageBox.Show("Your password is not secure enough. You are required to change it."); } } else { MessageBox.Show("You are required to change your password at first logon."); } VGChangePasswordForm form = new VGChangePasswordForm(runtime); form.UserName = currentUsername; form.OldPassword = currentPassword; if (form.ShowDialog(this) == DialogResult.OK) { currentPassword = form.NewPassword; goto Reauthenticate; } } } else { this.DialogResult = DialogResult.OK; if (!state.IsPasswordSecured) { if (MessageBox.Show("Your password is not secure enough. " + Environment.NewLine + "Do you want to change it?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) = DialogResult.Yes) { // Use the Visual guard form to change the password // You can replace it by your own form VGChangePasswordForm form = new VGChangePasswordForm(); form.ShowDialog(); } } }