如何以编程方式初始化 JGroups AUTH 协议
How to initialize the JGroups AUTH protocol programmatically
我尝试以编程方式初始化 AUTH
协议,但不断收到 java.lang.IllegalArgumentException: field auth_class not found
。
显然 AUTH.java
没有字段 auth_class
,尽管有一个 setter 用此 属性 注释。
这是协议栈的一个片段:
new ASYM_ENCRYPT()
.setValue("use_external_key_exchange", true)
.setValue("encrypt_entire_message", true)
.setValue("sym_keylength", 256)
.setValue("sym_algorithm", "AES")
.setValue("asym_keylength", 512)
.setValue("asym_algorithm", "RSA"),
new AUTH()
.setValue("auth_class", "org.jgroups.auth.X509Token")
.setValue("keystore_path", "/tmp/cert.jks")
.setValue("keystore_password", "changeit")
.setValue("cert_alias", "mycert")
.setValue("cert_password", "changeit")
.setValue("auth_value", "secret")
.setValue("cipher_type", "RSA"),
new GMS()
.setValue("print_local_addr", true)
.setValue("join_timeout", 2000)
那么如何使用 X509Token
和适当的属性初始化 AUTH
?
auth_class
不是属性,因此您必须使用 setter:
AUTH auth=new AUTH()
.setValue("keystore_path", "/tmp/cert.jks")
.setValue("keystore_password", "changeit")
.setValue("cert_alias", "mycert")
.setValue("cert_password", "changeit")
.setValue("auth_value", "secret")
.setValue("cipher_type", "RSA");
auth.setAuthClass("org.jgroups.auth.X509Token");
我尝试以编程方式初始化 AUTH
协议,但不断收到 java.lang.IllegalArgumentException: field auth_class not found
。
显然 AUTH.java
没有字段 auth_class
,尽管有一个 setter 用此 属性 注释。
这是协议栈的一个片段:
new ASYM_ENCRYPT()
.setValue("use_external_key_exchange", true)
.setValue("encrypt_entire_message", true)
.setValue("sym_keylength", 256)
.setValue("sym_algorithm", "AES")
.setValue("asym_keylength", 512)
.setValue("asym_algorithm", "RSA"),
new AUTH()
.setValue("auth_class", "org.jgroups.auth.X509Token")
.setValue("keystore_path", "/tmp/cert.jks")
.setValue("keystore_password", "changeit")
.setValue("cert_alias", "mycert")
.setValue("cert_password", "changeit")
.setValue("auth_value", "secret")
.setValue("cipher_type", "RSA"),
new GMS()
.setValue("print_local_addr", true)
.setValue("join_timeout", 2000)
那么如何使用 X509Token
和适当的属性初始化 AUTH
?
auth_class
不是属性,因此您必须使用 setter:
AUTH auth=new AUTH()
.setValue("keystore_path", "/tmp/cert.jks")
.setValue("keystore_password", "changeit")
.setValue("cert_alias", "mycert")
.setValue("cert_password", "changeit")
.setValue("auth_value", "secret")
.setValue("cipher_type", "RSA");
auth.setAuthClass("org.jgroups.auth.X509Token");