在 Tibco BW 5.12 中使用 REST 调用进行 LDAP 身份验证?
LDAP authentication with REST calls in Tibco BW 5.12?
我们能否在 Tibco BW 5.12 中使用 REST 调用实现 LDAP 身份验证。我试图找到但无法在文档中找到任何内容。如果是,有人可以解释一下这样做的过程吗?
Tibco Designer for BW 5.12 默认不提供 REST API 调色板,但您可以使用 REST 插件 https://docs.tibco.com/products/tibco-activematrix-businessworks-plug-in-for-rest-and-json-1-1-1 (require a separate license purchase). Please note that you may need to fix the bug TIBCO BW - ERROR , Can not open Project (REST and JSON Plugin)
这是使用 tibco "REST & JSON Palette" 的 REST API 教程
http://tutorialspedia.com/develop-restful-web-service-in-tibco-step-by-step-tutorial/
LDAP REST API 集成实施将取决于您的 LDAP 服务器供应商。
如果客户端在 Intranet 中,另一种选择是使用 "Java Code" 操作
直接从 java 使用 LDAP 协议
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("bw.logger");
logger.info("START LDAP Connection");
LdapContext ctx = null;
try {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
env.put(Context.SECURITY_PRINCIPAL, "testuser@test.com");
env.put(Context.SECURITY_CREDENTIALS, "Password");
env.put(Context.PROVIDER_URL, "ldap://ldap.test.com:389");
ctx = new InitialLdapContext(env, null);
logger.info("Connection Successful.");
} catch (NamingException nex) {
logger.info("LDAP Connection: FAILED\n" + nex.getMessage(), nex);
}
请注意,您需要添加导入。完整 class:
package Processes.TestProcess.LDAPcall;
import java.util.*;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
public class LDAPcallJavaCode{
/****** START SET/GET METHOD, DO NOT MODIFY *****/
/****** END SET/GET METHOD, DO NOT MODIFY *****/
public LDAPcallJavaCode() {
}
public void invoke() throws Exception {
/* Available Variables: DO NOT MODIFY
* Available Variables: DO NOT MODIFY *****/
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("bw.logger");
logger.info("START LDAP Connection");
LdapContext ctx = null;
try {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
env.put(Context.SECURITY_PRINCIPAL, "testuser@test.com");
env.put(Context.SECURITY_CREDENTIALS, "Password");
env.put(Context.PROVIDER_URL, "ldap://ldap.test.com:389");
ctx = new InitialLdapContext(env, null);
logger.info("Connection Successful.");
} catch (NamingException nex) {
logger.info("LDAP Connection: FAILED\n" + nex.getMessage(), nex);
}}
}
我们能否在 Tibco BW 5.12 中使用 REST 调用实现 LDAP 身份验证。我试图找到但无法在文档中找到任何内容。如果是,有人可以解释一下这样做的过程吗?
Tibco Designer for BW 5.12 默认不提供 REST API 调色板,但您可以使用 REST 插件 https://docs.tibco.com/products/tibco-activematrix-businessworks-plug-in-for-rest-and-json-1-1-1 (require a separate license purchase). Please note that you may need to fix the bug TIBCO BW - ERROR , Can not open Project (REST and JSON Plugin)
这是使用 tibco "REST & JSON Palette" 的 REST API 教程 http://tutorialspedia.com/develop-restful-web-service-in-tibco-step-by-step-tutorial/
LDAP REST API 集成实施将取决于您的 LDAP 服务器供应商。
如果客户端在 Intranet 中,另一种选择是使用 "Java Code" 操作
直接从 java 使用 LDAP 协议 org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("bw.logger");
logger.info("START LDAP Connection");
LdapContext ctx = null;
try {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
env.put(Context.SECURITY_PRINCIPAL, "testuser@test.com");
env.put(Context.SECURITY_CREDENTIALS, "Password");
env.put(Context.PROVIDER_URL, "ldap://ldap.test.com:389");
ctx = new InitialLdapContext(env, null);
logger.info("Connection Successful.");
} catch (NamingException nex) {
logger.info("LDAP Connection: FAILED\n" + nex.getMessage(), nex);
}
请注意,您需要添加导入。完整 class:
package Processes.TestProcess.LDAPcall;
import java.util.*;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
public class LDAPcallJavaCode{
/****** START SET/GET METHOD, DO NOT MODIFY *****/
/****** END SET/GET METHOD, DO NOT MODIFY *****/
public LDAPcallJavaCode() {
}
public void invoke() throws Exception {
/* Available Variables: DO NOT MODIFY
* Available Variables: DO NOT MODIFY *****/
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("bw.logger");
logger.info("START LDAP Connection");
LdapContext ctx = null;
try {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
env.put(Context.SECURITY_PRINCIPAL, "testuser@test.com");
env.put(Context.SECURITY_CREDENTIALS, "Password");
env.put(Context.PROVIDER_URL, "ldap://ldap.test.com:389");
ctx = new InitialLdapContext(env, null);
logger.info("Connection Successful.");
} catch (NamingException nex) {
logger.info("LDAP Connection: FAILED\n" + nex.getMessage(), nex);
}}
}