IMetabaseLink.Credentials

Syntax

Credentials: ICredentials;

Credentials: Prognoz.Platform.Interop.Metabase.ICredentials;

Description

The Credentials property returns the user credentials that are necessary for connecting to another repository.

Comments

This property is:

If the credentials are specified for the repository description, then on saving the description they will be encrypted and saved to the registry of the operation system. Saved credentials can be used on impersonation of users during the connection to the repository in the application code.

Example

Executing the example requires the Test server, the TestShema schema and the User1 user credentials with the "password" password.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Link: IMetabaseLink;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_METABASELINK;
    CrInfo.Id := "Link_1";
    CrInfo.Name := "Test1 repository connection";
    CrInfo.Parent := MB.Root;
    Link := MB.CreateObject(CrInfo).Edit As IMetabaseLink;
    Link.Authentication := AuthenticationMode.Password;
    Link.DriverId := "ORCL8";
    Link.SecurityPackage := "STANDARDSECURITYPACKAGE";
    Link.LogonData.ParamValue("SERVER") := "Test";
    Link.LogonData.ParamValue("SCHEME") := "TestShema";
    Debug.WriteLine(Link.LoginPrompt);
    Link.LoginPrompt := False;
    Link.Credentials.SlotValue("USERNAME") := "User1";
    Link.Credentials.SlotValue("PASSWORD") := "password";
    (Link As IMetabaseObject).Save;
End Sub UserProc;
Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Link: IMetabaseLink;
Begin
    MB := Params.Metabase;
    CrInfo := MB.CreateCreateInfo();
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_METABASELINK As Integer;
    CrInfo.Id := "Link_1";
    CrInfo.Name := "Test1 repository connection";
    CrInfo.Parent := MB.Root;
    Link := MB.CreateObject(CrInfo).Edit() As IMetabaseLink;
    Link.Authentication := AuthenticationMode.amPassword;
    Link.DriverId := "ORCL8";
    Link.SecurityPackage := "STANDARDSECURITYPACKAGE";
    Link.LogonData.ParamValue["SERVER"] := "Test";
    Link.LogonData.ParamValue["SCHEME"] := "TestShema";
    System.Diagnostics.Debug.WriteLine(Link.LoginPrompt);
    Link.LoginPrompt := False;
    Link.Credentials.SlotValue["USERNAME"] := "User1";
    Link.Credentials.SlotValue["PASSWORD"] := "password";
    (Link As IMetabaseObject).Save();
End Sub;

After executing the example the new object Connection with Repository is created in the repository root. This object connects with the repository that is placed on the Test server in the TestShema schema. Password authentication, DBMS type installed on the server - Oracle 9.x or later are used on connection. The automatic connection with the specified credentials is established if this connection is used.

See also:

IMetabaseLink