87 lines
2.9 KiB
Java
87 lines
2.9 KiB
Java
/**
|
|
* Created by IntelliJ IDEA.
|
|
* User: jnorman@novell.com
|
|
* Date: Apr 19, 2005
|
|
* Time: 9:45:02 AM
|
|
* To change this template use Options | File Templates.
|
|
*/
|
|
package com.novell.casa;
|
|
|
|
public class MiCasa {
|
|
|
|
public static int USERNAME_TYPE_CN_F = 0x00000000;
|
|
public static int USERNAME_TYPE_NDS_DN_F = 0x00000001;
|
|
public static int USERNAME_TYPE_NDS_FDN_F = 0x00000002;
|
|
public static int USERNAME_TYPE_LDAP_DN_F = 0x00000004;
|
|
public static int USERNAME_TYPE_EMAIL_F = 0x00000008;
|
|
public static int USERNAME_TYPE_OTHER_F = 0x00000010;
|
|
|
|
public static native int jmiCASASetCredential(
|
|
int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID,
|
|
int unFlag,
|
|
String sUsername,
|
|
String sPassword
|
|
);
|
|
|
|
public static native int jmiCASAGetCredential(
|
|
int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID,
|
|
int unFlag,
|
|
NetCredential credential
|
|
);
|
|
|
|
public static native int jmiCASARemoveCredential(
|
|
int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID
|
|
);
|
|
|
|
// **********************************************************************************************
|
|
static {
|
|
System.loadLibrary("jmicasa");
|
|
}
|
|
|
|
public static void setCredential(int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID,
|
|
int iUserFlag,
|
|
String sUsername,
|
|
String sPassword) throws Exception {
|
|
|
|
int rcode = 0;
|
|
rcode = jmiCASASetCredential(iSSFlags, sAppSecretID, sSharedSecretID, iUserFlag, sUsername, sPassword);
|
|
if (rcode != 0) {
|
|
throw new MiCasaException(rcode);
|
|
}
|
|
}
|
|
|
|
public static NetCredential getCredential(int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID,
|
|
int iUserFlag) throws Exception {
|
|
int rcode = 0;
|
|
NetCredential netCred = new NetCredential();
|
|
rcode = jmiCASAGetCredential(iSSFlags, sAppSecretID, sSharedSecretID, iUserFlag, netCred);
|
|
if (rcode != 0) {
|
|
throw new MiCasaException(rcode);
|
|
}
|
|
|
|
return netCred;
|
|
}
|
|
|
|
public static void removeCredential(int iSSFlags,
|
|
String sAppSecretID,
|
|
String sSharedSecretID) throws Exception {
|
|
int rcode = 0;
|
|
rcode = jmiCASARemoveCredential(iSSFlags, sAppSecretID, sSharedSecretID);
|
|
if (rcode != 0) {
|
|
throw new MiCasaException(rcode);
|
|
}
|
|
|
|
}
|
|
|
|
}
|