?? clientapilevelauthenticationimpl.java
字號:
package samples.fw;
public class ClientAPILevelAuthenticationImpl
extends org.csapi.fw.fw_access.trust_and_security.IpClientAPILevelAuthenticationPOA
{
boolean authenticated = false;
public ClientAPILevelAuthenticationImpl(){}
byte[] clientChallenge = {(byte)111,(byte)21,(byte)214,(byte)65,(byte)196,(byte)22,(byte)222};
public byte[] authenticate (byte[] challenge)
{
(new Thread() {
public void run() {
try {
Thread.sleep(1000); // let the fw challenge get back first
byte[] ret =
AppFWImpl.ipAPILevelAuthentication.authenticate(clientChallenge);
// to check ret is valid
if (!validateChallenge(AppFWImpl.authMethodName,ret))
{
System.out.println("Framework failed challenge");
System.exit(1);
}
}
catch(Exception e) {}
}
}).start();
return applyAuthMethod(AppFWImpl.authMethodName, challenge);
}
public void abortAuthentication ()
{
System.out.println("Framework abort the authentication");
System.exit(1);
}
public void authenticationSucceeded ()
{
authenticated = true;
final Object lock = AppFWImpl.getInstance();
(new Thread() {
public void run() {
synchronized (lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
}).start();
}
byte[] applyAuthMethod(String authName, String challenge)
{
// just to return enpty array.
//
return new byte[0];
boolean validateChallenge(String authName, String challengeRet)
{
return true;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -