Visual Guard Class Library Documentation

Upgrading v2.5 to v2.6

The version 2.6 of Visual Guard console needs to migrate the repository created by an older version of Visual Guard. This migration will alter the database structure of the repository. If you do not migrate these repositories, the Visual Guard console will not be able to access to them.

After migrating a repository, all applications using a Visual Guard runtime older than the version 2.5.706.18 will not able to access to this repository. For these applications, you must replace all referenced Visual Guard assemblies by assemblies more recent than the version 2.5.706.18.

Before migrating a repository, we strongly recommend to backup the data and the database structure.

It is possible to use the Visual Guard console to migrate the repository or execute SQL scripts installed with the product against the database.

Migrating the repository by using the Visual Guard console

Before migrating the repository, you must check that:

 

To migrate your repository, you must declare the repository in the list of repository (if needed) and connect you to the repository by using a 'Master Administrator' user. During the connection, the console will automatically detect that the repository needs to be migrate and will ask you a confirmation before launching the migration process.

If the underlying database user has not enough rigths, you have to delete the current repository from the list of repository then add the new repository in the list of repository. In the 'Add Repository Wizard', you should select the option 'Select an existing repository' and specify the credentials of your DBA account. When you use Windows authentitcation ro connect to your database, you have to close the console and use the option "Run As" to launch the console.

Migrating the repository by using the SQL Scripts

If you or your DBA want to migrate manually your repository, you can use SQL Scripts installed with the product. These scripts need to be modified before running against the database.

After the migration of the repository strutcure, you have to launch the Visual Guard console and connect you to the repository as 'Master Administrator' to validate the migration.

Migrating the code of your application

Referencing the new version of Visual Guard assemblies

In order to take into account the version 2.6 of the assemblies of Visual Guard, you should remove the references of old version from your project, add the new ones (select the version 2.6.x.x ), then rebuild your project.

Note: If you have more than one version of Visual Guard installed on your computer, Visual Studio can display more than one version of the assemblies in the list. You should select the version 2.6 of Visual Guard 

If the version 2.6 of Visual Guard assemblies does not appear in the list of .Net assemblies, select the Browse tab in the Add Reference dialog box then select them in the directory <Visual Guard Installation Directory>\Bin\2.0 when your project is based on the .Net Framework 2.0 or <Visual Guard Installation Directory>\Bin\1.1 when your project is based on the Framework 1.1. By default the Visual Guard installation directory is C:\Program Files\Novalys\Visual Guard 2.6 for .Net.

Authentication process

Visual Guard 2.6 allows now to force users to change their password at next logon. In order to use this feature in your application, you must take into account the following modifications:

The property VGAuthenticationState.MustChangePasswordAtNextLogon and the flag VGAuthenticationStatus.MustChangePasswordAtNextLogon are added. This value indicates that the authentication process has failed because the user has to change the password at next logon. When the authentication process returns this value, the application must change the password then retry to authenticate by using the new password.

The following sample tests whether the user must change the password and opens a dialog box in order to change the password then retry to authenticate the user with the new password.

 Reauthenticate:
    Dim state As VGAuthenticationState = VGSecurityManager.Authenticate(userTextBox.Text, passwordTextBox.Text)
    If state.IsFailed Then
         Me.DialogResult = System.Windows.Forms.DialogResult.None
         If state.Is... Then 
	    	' Tests all other authentication states ...
         ElseIf state.MustChangePasswordAtNextLogon Then
                ' The user must change the password at next logon.
                MessageBox.Show("You are required to change your password at first logon.")
                Dim form As ChangePassword = New ChangePassword
                form.OldPassword = Me.passwordTextBox.Text
                form.UserName = Me.userTextBox.Text
                If form.ShowDialog() = Windows.Forms.DialogResult.OK Then
                    Me.passwordTextBox.Text = form.NewPassword
                    GoTo Reauthenticate
                End If
         End If 
    End If