126 lines
3.1 KiB
C#
126 lines
3.1 KiB
C#
|
using System;
|
||
|
using Novell.CASA;
|
||
|
|
||
|
namespace Novell.CASA
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Summary description for miCASA.
|
||
|
/// </summary>
|
||
|
public class miCASA
|
||
|
{
|
||
|
|
||
|
public static uint USERNAME_TYPE_CN_F = 0x00000000;
|
||
|
public static uint USERNAME_TYPE_NDS_DN_F = 0x00000001;
|
||
|
public static uint USERNAME_TYPE_NDS_FDN_F = 0x00000002;
|
||
|
public static uint USERNAME_TYPE_LDAP_DN_F = 0x00000004;
|
||
|
public static uint USERNAME_TYPE_EMAIL_F = 0x00000008;
|
||
|
public static uint USERNAME_TYPE_OTHER_F = 0x00000010;
|
||
|
|
||
|
public miCASA()
|
||
|
{
|
||
|
//
|
||
|
// TODO: Add constructor logic here
|
||
|
//
|
||
|
}
|
||
|
|
||
|
|
||
|
public static void SetBasicCredential(
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID,
|
||
|
string sUsername,
|
||
|
string sPassword)
|
||
|
{
|
||
|
SetCredential(0, sAppSecretID, sSharedSecretID, 0, sUsername, sPassword);
|
||
|
}
|
||
|
|
||
|
public static string GetCredentialUsername(
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID)
|
||
|
|
||
|
{
|
||
|
BasicCredential bc = GetBasicCredential(sAppSecretID, sSharedSecretID);
|
||
|
if (bc != null)
|
||
|
return bc.GetUsername();
|
||
|
else
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static string GetCredentialPassword(
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID)
|
||
|
|
||
|
{
|
||
|
BasicCredential bc = GetBasicCredential(sAppSecretID, sSharedSecretID);
|
||
|
if (bc != null)
|
||
|
return bc.GetPassword();
|
||
|
else
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public static BasicCredential GetBasicCredential(
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID)
|
||
|
{
|
||
|
return GetCredential(0, sAppSecretID, sSharedSecretID, miCASA.USERNAME_TYPE_CN_F);
|
||
|
}
|
||
|
|
||
|
public static void RemoveBasicCredential(
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID)
|
||
|
{
|
||
|
RemoveCredential(0, sAppSecretID, sSharedSecretID);
|
||
|
}
|
||
|
|
||
|
|
||
|
public static void SetCredential(
|
||
|
uint ssFlags,
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID,
|
||
|
uint unFlag,
|
||
|
string sUsername,
|
||
|
string sPassword)
|
||
|
{
|
||
|
NativeCalls.SetCredential(ssFlags, sAppSecretID, sSharedSecretID, unFlag, sUsername, sPassword);
|
||
|
}
|
||
|
|
||
|
public static BasicCredential GetCredential(
|
||
|
uint ssFlags,
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID,
|
||
|
uint unFlag)
|
||
|
|
||
|
{
|
||
|
return NativeCalls.GetCredential(ssFlags, sAppSecretID, sSharedSecretID, unFlag);
|
||
|
}
|
||
|
|
||
|
public static void RemoveCredential(
|
||
|
uint ssFlags,
|
||
|
string sAppSecretID,
|
||
|
string sSharedSecretID)
|
||
|
{
|
||
|
NativeCalls.RemoveCredential(ssFlags, sAppSecretID, sSharedSecretID);
|
||
|
}
|
||
|
public static int SetMasterPasscode(
|
||
|
uint ssFlags,
|
||
|
string passcodeStr)
|
||
|
{
|
||
|
return NativeCalls.SetMasterPasscode(ssFlags,passcodeStr);
|
||
|
}
|
||
|
public static int SetMasterPassword(
|
||
|
uint ssFlags,
|
||
|
string mPasswd)
|
||
|
{
|
||
|
return NativeCalls.SetMasterPassword(ssFlags,mPasswd);
|
||
|
}
|
||
|
public static bool IsSecretPersistent(
|
||
|
uint ssFlags,
|
||
|
string secretID)
|
||
|
{
|
||
|
return NativeCalls.IsSecretPersistent(ssFlags,secretID);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|