Credentials: ICredentials;
The Credentials property determines the user credentials used on automatic connection.
The property is write-only.
This property is:
Relevant for use, if the IMetabaseLink.LoginPrompt property is set to False.
Not relevant for use, if the IMetabaseLink.UseMetabaseCredentials property is set to True.
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.
Executing the example on DBMS server where the current repository is created, requires the TestRepository repository.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Link: IMetabaseLink;
Package: ISecurityPackage;
MSSPLD: IPrimaryMsSqlSPLD;
PswCreds: IPasswordCredentials;
Begin
MB := MetabaseClass.Active;
// Create a repository connection
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_METABASELINK;
CrInfo.Id := "Link_1";
CrInfo.Name := "Connection with the TestRepository repository";
CrInfo.Parent := MB.Root;
// Repository connection settings
Link := MB.CreateObject(CrInfo).Edit As IMetabaseLink;
Link.Authentication := AuthenticationMode.Password;
Link.DriverId := "MSSQL2012";
MSSPLD := Link.LogonData As IPrimaryMsSqlSPLD;
MSSPLD.Server := "%METABASE_SERVER%";
MSSPLD.Database := "TestRepository";
// Credentials
Package := New StandardSecurityPackage.Create;
PswCreds := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
PswCreds.UserName := "User";
PswCreds.Password := "Password";
Link.LoginPrompt := False;
Link.Credentials := PswCreds;
// Save changes
(Link As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, the Repository Connection new object is created in the repository root. Automatic connection with the specified credentials is established if this connection is used.
See also: