简体   繁体   English

在 Tibco BW 5.12 中使用 REST 调用进行 LDAP 身份验证?

[英]LDAP authentication with REST calls in Tibco BW 5.12?

Can we implement LDAP authentication with REST calls in Tibco BW 5.12.我们可以在 Tibco BW 5.12 中使用 REST 调用实现 LDAP 身份验证吗? I was trying to find but couldnt find anything in documentation.我试图找到但在文档中找不到任何内容。 If yes, can someone please explain the process to do so.如果是,请有人解释这样做的过程。

Tibco Designer for BW 5.12 is not providing REST API palette by default but you can use REST plugin https://docs.tibco.com/products/tibco-activematrix-businessworks-plug-in-for-rest-and-json-1-1-1 (require a separate license purchase). 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 (需要单独购买许可证)。 Please note that you may need to fix the bug TIBCO BW - ERROR , Can not open Project (REST and JSON Plugin)请注意,您可能需要修复错误TIBCO BW - ERROR , Can not open Project (REST and JSON Plugin)

Here is tutorial for REST API using tibco "REST & JSON Palette" http://tutorialspedia.com/develop-restful-web-service-in-tibco-step-by-step-tutorial/这是使用 tibco“REST & JSON Palette”的 REST API 教程http://tutorialspedia.com/develop-restful-web-service-in-tibco-step-by-step-tutorial/

LDAP REST API integration implementation will depend on your LDAP server vendor. LDAP REST API 集成实施将取决于您的 LDAP 服务器供应商。

If the client is in intranet another option is to use LDAP protocol directly from java using "Java Code" action如果客户端在 Intranet 中,另一种选择是使用“Java 代码”操作直接从 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);
    }

please note that you need to add imports.请注意,您需要添加导入。 Full 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);
        }}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM