Search in sources :

Example 6 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class GUISSOClientFactory method createGUISSOClient.

private static GUISSOClient createGUISSOClient(HttpServletRequest request) {
    String ClientImplClassName = request.getServletContext().getInitParameter("uav.apphub.sso.implclass");
    if (StringHelper.isEmpty(ClientImplClassName)) {
        ClientImplClassName = "com.creditease.uav.apphub.sso.GUISSOLdapClient";
    }
    GUISSOClient GUISSOClientImpl = null;
    try {
        Class<?> cls = request.getClass().getClassLoader().loadClass(ClientImplClassName);
        GUISSOClientImpl = (GUISSOClient) cls.getDeclaredConstructor(HttpServletRequest.class).newInstance(request);
    } catch (Exception e) {
        throw new ApphubException(e);
    }
    return GUISSOClientImpl;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ApphubException(com.creditease.uav.exception.ApphubException) ApphubException(com.creditease.uav.exception.ApphubException)

Example 7 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class GUISSOLdapClient method formatEmailInfo.

@SuppressWarnings("rawtypes")
private String formatEmailInfo(Attribute attr) {
    if (null == attr) {
        return "";
    }
    StringBuilder values = new StringBuilder();
    boolean isFormat = false;
    try {
        String formatS = "=";
        String attrId = attr.getID();
        String groupKey = ldapConfig.get("groupKey");
        String groupTag = ldapConfig.get("groupTag");
        for (NamingEnumeration vals = attr.getAll(); vals.hasMore(); ) {
            String strValue = vals.next().toString();
            if (groupKey.equals(attrId) && strValue.indexOf(groupTag) >= 0) {
                values.append(",");
                isFormat = true;
                if (strValue.indexOf(formatS) == -1) {
                    values.append(strValue);
                    continue;
                }
                int begin = strValue.indexOf(formatS) + formatS.length();
                int end = strValue.indexOf(",");
                values.append(strValue.substring(begin, end));
            }
        }
    } catch (Exception e) {
        loggerError("formatEmailInfo 555", "", e);
        throw new ApphubException(e);
    }
    /**
     * 去除第一个逗号
     */
    String result = "";
    if (isFormat) {
        result = values.toString().substring(1);
    }
    return result;
}
Also used : NamingEnumeration(javax.naming.NamingEnumeration) ApphubException(com.creditease.uav.exception.ApphubException) ApphubException(com.creditease.uav.exception.ApphubException) NamingException(javax.naming.NamingException) AuthenticationException(javax.naming.AuthenticationException)

Example 8 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class AppHubInit method initApp.

private void initApp(final String id, final String appName) {
    try {
        Map<String, Object> modify = new HashMap<String, Object>();
        Map<String, Object> where = new HashMap<String, Object>();
        where.put("appid", id);
        modify.put("where", where);
        byte[] modifyData = getRequestData(manageTypeApp, createHttpMapRequest(bussinessTypeModify, modify));
        run(manageTypeApp, modifyData, new ManageTestCallback() {

            @Override
            public void completed(HttpClientCallbackResult result) {
                logger.info(this, "AppHubInit ADD APP:uavapp_" + appName);
                Map<String, Object> app1 = new HashMap<String, Object>();
                String appUrlStr = appName;
                app1.put("appid", id);
                app1.put("appurl", appUrlStr);
                app1.put("state", 1);
                app1.put("createtime", ctime);
                app1.put("operationtime", ctime);
                app1.put("operationuser", operationuser);
                byte[] addData = getRequestData(manageTypeApp, createHttpMapRequest(bussinessTypeCreate, app1));
                run(manageTypeApp, addData, new ManageTestCallback());
            }
        });
    } catch (Exception e) {
        logger.err(this, e.getMessage(), e);
        throw new ApphubException(e);
    }
}
Also used : HashMap(java.util.HashMap) ApphubException(com.creditease.uav.exception.ApphubException) HttpClientCallbackResult(com.creditease.uav.httpasync.HttpClientCallbackResult) HashMap(java.util.HashMap) Map(java.util.Map) ApphubException(com.creditease.uav.exception.ApphubException)

Example 9 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class AppHubInit method initGroup.

/**
 * @param groupid
 * @param appids
 * @param isAdd
 *            多个用,号隔开
 * @throws Exception
 */
protected void initGroup(final String groupid, final String appids, final boolean isAdd) {
    try {
        Map<String, Object> modify = new HashMap<String, Object>();
        Map<String, Object> where = new HashMap<String, Object>();
        where.put("groupid", groupid);
        modify.put("where", where);
        byte[] modifyData = getRequestData(manageTypeGroup, createHttpMapRequest(bussinessTypeModify, modify));
        GroupCallBack groupGb = new GroupCallBack();
        groupGb.setAdd(isAdd);
        groupGb.setAppids(appids);
        groupGb.setGroupid(groupid);
        run(manageTypeGroup, modifyData, groupGb);
    } catch (Exception e) {
        logger.err(this, e.getMessage(), e);
        throw new ApphubException(e);
    }
}
Also used : HashMap(java.util.HashMap) ApphubException(com.creditease.uav.exception.ApphubException) ApphubException(com.creditease.uav.exception.ApphubException)

Aggregations

ApphubException (com.creditease.uav.exception.ApphubException)9 UAVHttpMessage (com.creditease.agent.http.api.UAVHttpMessage)4 HashMap (java.util.HashMap)4 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 HttpClientCallbackResult (com.creditease.uav.httpasync.HttpClientCallbackResult)1 Map (java.util.Map)1 AuthenticationException (javax.naming.AuthenticationException)1 NamingEnumeration (javax.naming.NamingEnumeration)1 NamingException (javax.naming.NamingException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1