📄 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 + -