✨ 1.0.0

This commit is contained in:
smallbun
2023-08-08 11:32:26 +08:00
parent eb65d69e07
commit bd14832554
2178 changed files with 106872 additions and 76335 deletions
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-all - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source-all - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -56,5 +56,11 @@
<artifactId>eiam-identity-source-wechatwork</artifactId>
<version>${project.version}</version>
</dependency>
<!--excel -->
<dependency>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source-excel</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-core - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source-core - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -42,7 +42,7 @@ import lombok.extern.slf4j.Slf4j;
* 这个只适合目前流行的钉钉、企业微信等,如果是AD,LDAP,不行
*
* @author TopIAM
* Created by support@topiam.cn on 2022/3/1 19:47
* Created by support@topiam.cn on 2022/3/1 21:47
*/
@Slf4j
@Getter
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,12 +19,11 @@ package cn.topiam.employee.identitysource.core;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.topiam.employee.common.enums.TriggerType;
import cn.topiam.employee.support.exception.TopIamException;
import jakarta.servlet.http.HttpServletRequest;
/**
* 身份源Provider
*
@@ -64,10 +63,10 @@ public interface IdentitySource<T extends IdentitySourceConfig> {
* 回调
*
* @param request {@link HttpServletRequest}
* @param response {@link HttpServletResponse}
* @param body {@link String}
* @return {@link Map}
*/
default Object event(HttpServletRequest request, HttpServletResponse response) {
default Object event(HttpServletRequest request, String body) {
throw new TopIamException("暂未实现");
}
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -27,7 +27,7 @@ import lombok.RequiredArgsConstructor;
* 身份源配置事件
*
* @author TopIAM
* Created by support@topiam.cn on 2022/3/20 19:58
* Created by support@topiam.cn on 2022/3/20 21:58
*/
@Data
@RequiredArgsConstructor
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -37,7 +37,7 @@ import lombok.extern.slf4j.Slf4j;
* 身份源配置事件刷新
*
* @author TopIAM
* Created by support@topiam.cn on 2022/3/20 19:45
* Created by support@topiam.cn on 2022/3/20 21:45
*/
@Slf4j
@RequiredArgsConstructor
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -21,7 +21,7 @@ package cn.topiam.employee.identitysource.core.event;
* 身份源配置事件类型
*
* @author TopIAM
* Created by support@topiam.cn on 2022/3/20 19:59
* Created by support@topiam.cn on 2022/3/20 21:59
*/
public enum IdentitySourceEventType {
/**
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-core - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-core - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-dingtalk - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source-dingtalk - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -33,7 +33,7 @@
<dependency>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source-core</artifactId>
<version>1.0.0-beta1</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,14 +19,14 @@ package cn.topiam.employee.identitysource.dingtalk;
import java.io.Serial;
import javax.validation.constraints.NotEmpty;
import cn.topiam.employee.identitysource.core.IdentitySourceConfig;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import jakarta.validation.constraints.NotEmpty;
/**
* 钉钉配置
*
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,8 +17,6 @@
*/
package cn.topiam.employee.identitysource.dingtalk;
import javax.validation.ConstraintViolationException;
import org.apache.commons.lang3.StringUtils;
import com.aliyun.dingtalkcontact_1_0.models.GetOrgAuthInfoHeaders;
@@ -33,10 +31,12 @@ import com.aliyun.teautil.models.RuntimeOptions;
import cn.topiam.employee.identitysource.core.IdentitySourceConfigValidator;
import cn.topiam.employee.identitysource.core.exception.ApiCallException;
import cn.topiam.employee.identitysource.dingtalk.client.AbstractDingTalkClient;
import cn.topiam.employee.support.validation.ValidationHelp;
import cn.topiam.employee.support.validation.ValidationUtils;
import lombok.extern.slf4j.Slf4j;
import jakarta.validation.ConstraintViolationException;
/**
* 钉钉身份源客户端配置验证器
*
@@ -50,10 +50,10 @@ public class DingTalkConfigValidator implements IdentitySourceConfigValidator<Di
@Override
public Boolean validate(DingTalkConfig config) {
try {
ValidationHelp.ValidationResult<DingTalkConfig> validationResult = ValidationHelp
ValidationUtils.ValidationResult<DingTalkConfig> validationResult = ValidationUtils
.validateEntity(config);
if (validationResult.isHasErrors()) {
log.error("校验钉钉配置失败:{}", validationResult.getMessage());
log.error("校验钉钉配置失败:{}", validationResult.getMessage());
throw new ConstraintViolationException(validationResult.getConstraintViolations());
}
//获取 AccessToken
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -26,9 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson2.JSON;
@@ -51,11 +48,13 @@ import cn.topiam.employee.identitysource.dingtalk.util.DingTalkEventCryptoUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import jakarta.servlet.http.HttpServletRequest;
/**
* 钉钉
*
* @author TopIAM
* Created by support@topiam.cn on 2022/9/21 19:59
* Created by support@topiam.cn on 2022/9/21 21:59
*/
@Slf4j
public class DingTalkIdentitySource extends AbstractDefaultIdentitySource<DingTalkConfig> {
@@ -72,15 +71,13 @@ public class DingTalkIdentitySource extends AbstractDefaultIdentitySource<DingTa
* @see [book events](https://open.dingtalk.com/document/orgapp-server/address-book-events)
*
* @param request {@link HttpServletRequest}
* @param response {@link HttpServletResponse}
*/
@Override
public Object event(HttpServletRequest request, HttpServletResponse response) {
public Object event(HttpServletRequest request, String body) {
LocalDateTime eventTime = LocalDateTime.now();
Map<String, Object> params = RequestUtils.getParams(request);
String json = RequestUtils.getBody(request);
if (StringUtils.isNoneBlank(json)) {
String encrypt = JSON.parseObject(json).getString(ENCRYPT);
if (StringUtils.isNoneBlank(body)) {
String encrypt = JSON.parseObject(body).getString(ENCRYPT);
log.info("钉钉身份源 [{}] 回调入参: {}, encrypt: {}", getId(), JSON.toJSONString(params),
encrypt);
Object result = eventCallBack(eventTime, params, encrypt);
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -96,7 +96,7 @@ public abstract class AbstractDingTalkClient extends AbstractIdentitySourceClien
try {
return new Client(config);
} catch (Exception e) {
log.error("钉钉获取Client异常:{}", e.getMessage());
log.error("钉钉获取Client异常:{}", e.getMessage());
throw new ApiCallException(e.getMessage());
}
}
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -225,11 +225,11 @@ public class DingTalkClient extends AbstractDingTalkClient implements IdentitySo
private List<User> getUserList(OapiV2UserListRequest request) {
List<User> list = new ArrayList<>();
try {
log.info("分页获取用户列表入参:{}", JSON.toJSONString(request));
log.info("分页获取用户列表入参:{}", JSON.toJSONString(request));
com.dingtalk.api.DingTalkClient client = new DefaultDingTalkClient(
DingTalkConstants.USER_LIST);
OapiV2UserListResponse execute = client.execute(request, getAccessToken());
log.info("分页获取用户列表返回:{}", JSON.toJSONString(execute));
log.info("分页获取用户列表返回:{}", JSON.toJSONString(execute));
if (execute.isSuccess()) {
OapiV2UserListResponse.PageResult result = execute.getResult();
List<OapiV2UserListResponse.ListUserResponse> userList = result.getList();
@@ -247,10 +247,10 @@ public class DingTalkClient extends AbstractDingTalkClient implements IdentitySo
}
return list;
}
log.error("获取钉钉用户列表失败:{}", JSON.toJSONString(execute));
log.error("获取钉钉用户列表失败:{}", JSON.toJSONString(execute));
throw new ApiCallException(execute.getErrmsg());
} catch (ApiException e) {
log.error("获取钉钉用户列表异常:{}", e.getErrMsg(), e);
log.error("获取钉钉用户列表异常:{}", e.getErrMsg(), e);
throw new ApiCallException(e.getErrMsg());
}
}
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,7 +19,7 @@ package cn.topiam.employee.identitysource.dingtalk.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import cn.topiam.employee.common.enums.BaseEnum;
import cn.topiam.employee.support.enums.BaseEnum;
/**
* 钉钉事件类型
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-dingtalk - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-dingtalk - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-excel - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eiam-identity-source-excel</artifactId>
<dependencies>
<dependency>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,18 @@
/*
* eiam-identity-source-excel - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cn.topiam.employee.identitysource.excel;
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-feishu - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source-feishu - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -36,7 +36,7 @@
<dependency>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source-core</artifactId>
<version>1.0.0-beta1</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,14 +19,14 @@ package cn.topiam.employee.identitysource.feishu;
import java.io.Serial;
import javax.validation.constraints.NotEmpty;
import cn.topiam.employee.identitysource.core.IdentitySourceConfig;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import jakarta.validation.constraints.NotEmpty;
/**
* 飞书配置
*
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -17,8 +17,6 @@
*/
package cn.topiam.employee.identitysource.feishu;
import javax.validation.ConstraintViolationException;
import org.springframework.http.*;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
@@ -30,9 +28,11 @@ import cn.topiam.employee.identitysource.core.exception.ApiCallException;
import cn.topiam.employee.identitysource.core.exception.InvalidClientConfigException;
import cn.topiam.employee.identitysource.feishu.domain.request.GetAccessTokenRequest;
import cn.topiam.employee.identitysource.feishu.domain.response.GetAccessTokenResponse;
import cn.topiam.employee.support.validation.ValidationHelp;
import cn.topiam.employee.support.validation.ValidationUtils;
import lombok.extern.slf4j.Slf4j;
import jakarta.validation.ConstraintViolationException;
import static cn.topiam.employee.identitysource.feishu.FeiShuConstant.APP_ACCESS_TOKEN_URL;
/**
@@ -54,15 +54,15 @@ public class FeiShuConfigValidator implements
@Override
public Boolean validate(FeiShuConfig config) throws InvalidClientConfigException {
try {
ValidationHelp.ValidationResult<FeiShuConfig> validationResult = ValidationHelp
ValidationUtils.ValidationResult<FeiShuConfig> validationResult = ValidationUtils
.validateEntity(config);
if (validationResult.isHasErrors()) {
log.error("校验飞书配置失败:{}", validationResult.getMessage());
log.error("校验飞书配置失败:{}", validationResult.getMessage());
throw new ConstraintViolationException(validationResult.getConstraintViolations());
}
GetAccessTokenRequest request = new GetAccessTokenRequest(config.getAppId(),
config.getAppSecret());
cn.topiam.employee.identitysource.feishu.domain.request.GetAccessTokenRequest request = new GetAccessTokenRequest(
config.getAppId(), config.getAppSecret());
GetAccessTokenResponse response = postToken(request);
if (response.getCode() != 0) {
throw new ApiCallException(response.getMsg());
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -20,14 +20,10 @@ package cn.topiam.employee.identitysource.feishu;
import java.time.LocalDateTime;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceProvider;
import cn.topiam.employee.common.util.RequestUtils;
import cn.topiam.employee.identitysource.core.AbstractDefaultIdentitySource;
import cn.topiam.employee.identitysource.core.client.IdentitySourceClient;
import cn.topiam.employee.identitysource.core.enums.IdentitySourceEventReceiveType;
@@ -40,11 +36,13 @@ import cn.topiam.employee.identitysource.feishu.util.FeiShuEventDecryptUtils;
import lombok.extern.slf4j.Slf4j;
import jakarta.servlet.http.HttpServletRequest;
/**
* 飞书身份源
*
* @author TopIAM
* Created by support@topiam.cn on 2022/9/21 20:04
* Created by support@topiam.cn on 2022/9/21 21:04
*/
@Slf4j
public class FieShuIdentitySource extends AbstractDefaultIdentitySource<FeiShuConfig> {
@@ -63,14 +61,13 @@ public class FieShuIdentitySource extends AbstractDefaultIdentitySource<FeiShuCo
* 回调
*
* @param request {@link HttpServletRequest}
* @param response {@link HttpServletResponse}
* @param body {@link String}
*/
@Override
public Object event(HttpServletRequest request, HttpServletResponse response) {
public Object event(HttpServletRequest request, String body) {
LocalDateTime eventTime = LocalDateTime.now();
String json = RequestUtils.getBody(request);
log.debug("飞书身份源 [{}] 事件回调入参: {}", getId(), json);
JSONObject result = eventCallBack(eventTime, JSON.parseObject(json));
log.debug("飞书身份源 [{}] 事件回调入参: {}", getId(), body);
JSONObject result = eventCallBack(eventTime, JSON.parseObject(body));
log.debug("飞书身份源 [{}] 事件回调返回: {}", getId(), JSON.toJSONString(result));
return result;
}
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,7 +19,7 @@ package cn.topiam.employee.identitysource.feishu.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import cn.topiam.employee.common.enums.BaseEnum;
import cn.topiam.employee.support.enums.BaseEnum;
/**
* 飞书事件类型
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-feishu - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-feishu - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source-wechatwork - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source-wechatwork - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -36,7 +36,7 @@
<dependency>
<groupId>cn.topiam</groupId>
<artifactId>eiam-identity-source-core</artifactId>
<version>1.0.0-beta1</version>
<version>${project.version}</version>
</dependency>
</dependencies>
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,14 +19,14 @@ package cn.topiam.employee.identitysource.wechatwork;
import java.io.Serial;
import javax.validation.constraints.NotEmpty;
import cn.topiam.employee.identitysource.core.IdentitySourceConfig;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import jakarta.validation.constraints.NotEmpty;
/**
* 企业微信配置
*
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,8 +19,6 @@ package cn.topiam.employee.identitysource.wechatwork;
import java.util.Objects;
import javax.validation.ConstraintViolationException;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
@@ -28,10 +26,12 @@ import cn.topiam.employee.identitysource.core.IdentitySourceConfigValidator;
import cn.topiam.employee.identitysource.core.exception.ApiCallException;
import cn.topiam.employee.identitysource.core.exception.InvalidClientConfigException;
import cn.topiam.employee.identitysource.wechatwork.domain.response.AccessTokenResponse;
import cn.topiam.employee.support.validation.ValidationHelp;
import cn.topiam.employee.support.validation.ValidationUtils;
import lombok.extern.slf4j.Slf4j;
import jakarta.validation.ConstraintViolationException;
/**
* 企业微信身份源客户端配置验证器
*
@@ -50,10 +50,10 @@ public class WeChatWorkConfigValidator implements IdentitySourceConfigValidator<
@Override
public Boolean validate(WeChatWorkConfig config) throws InvalidClientConfigException {
try {
ValidationHelp.ValidationResult<WeChatWorkConfig> validationResult = ValidationHelp
ValidationUtils.ValidationResult<WeChatWorkConfig> validationResult = ValidationUtils
.validateEntity(config);
if (validationResult.isHasErrors()) {
log.error("校验企业微信配置失败:{}", validationResult.getMessage());
log.error("校验企业微信配置失败:{}", validationResult.getMessage());
throw new ConstraintViolationException(validationResult.getConstraintViolations());
}
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -23,8 +23,6 @@ import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
@@ -55,11 +53,13 @@ import cn.topiam.employee.support.exception.BadParamsException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import jakarta.servlet.http.HttpServletRequest;
/**
* 企业微信
*
* @author TopIAM
* Created by support@topiam.cn on 2022/9/21 19:59
* Created by support@topiam.cn on 2022/9/21 21:59
*/
@Slf4j
@SuppressWarnings("AlibabaSwitchStatement")
@@ -73,18 +73,18 @@ public class WeChatWorkIdentitySource extends AbstractDefaultIdentitySource<WeCh
* 企业微信事件回调事件
*
* @param request {@link HttpServletRequest}
* @param response {@link HttpServletRequest}
* @param body {@link String}
* @return {@link ResponseEntity}
*/
@Override
public Object event(HttpServletRequest request, HttpServletResponse response) {
public Object event(HttpServletRequest request, String body) {
LocalDateTime eventTime = LocalDateTime.now();
Map<String, Object> params = RequestUtils.getParams(request);
WeChatWorkRequest weWorkResult = null;
try {
if (RequestMethod.POST.name().equals(request.getMethod())) {
try {
weWorkResult = RequestUtils.getXml(request, WeChatWorkRequest.class);
weWorkResult = RequestUtils.getXml(body, WeChatWorkRequest.class);
} catch (JAXBException e) {
log.error("企业微信身份源 [{}] 事件回调入参转换异常: {}", getId(), e.getMessage());
throw new BadParamsException("企业微信事件回调数据转换异常: " + e.getMessage());
@@ -94,7 +94,7 @@ public class WeChatWorkIdentitySource extends AbstractDefaultIdentitySource<WeCh
log.debug("企业微信身份源 [{}] 事件回调入参: {}, {}", getId(), params, weWorkResult);
String result = eventCallBack(eventTime, params, weWorkResult);
log.debug("企业微信身份源 [{}] 事件回调返回: {}", getId(), JSON.toJSONString(result));
return ResponseEntity.ok(result);
return result;
} catch (Exception e) {
log.error("企业微信回调通知异常: 身份源id: [{}], 入参: [{}, {}], 异常信息: [{}]", getId(), params,
weWorkResult, e.getMessage(), e);
@@ -221,7 +221,7 @@ public class WeChatWorkIdentitySource extends AbstractDefaultIdentitySource<WeCh
* 事件回调DTO
*
* @author TopIAM
* Created by support@topiam.cn on 2022/9/21 19:59
* Created by support@topiam.cn on 2022/9/21 21:59
*/
@Data
@XmlRootElement(name = "xml")
@@ -255,7 +255,7 @@ public class WeChatWorkIdentitySource extends AbstractDefaultIdentitySource<WeCh
* 企业微信事件回调入参
*
* @author TopIAM
* Created by support@topiam.cn on 2022/9/21 19:59
* Created by support@topiam.cn on 2022/9/21 21:59
*/
@Data
@XmlRootElement(name = "xml")
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -19,7 +19,7 @@ package cn.topiam.employee.identitysource.wechatwork.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import cn.topiam.employee.common.enums.BaseEnum;
import cn.topiam.employee.support.enums.BaseEnum;
/**
* 企业微信事件类型
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
/*
* eiam-identity-source-wechatwork - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
* eiam-identity-source-wechatwork - Employee Identity and Access Management
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
+5 -4
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
eiam-identity-source - Employee Identity and Access Management Program
Copyright © 2020-2023 TopIAM (support@topiam.cn)
eiam-identity-source - Employee Identity and Access Management
Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -24,12 +24,12 @@
<parent>
<groupId>cn.topiam</groupId>
<artifactId>eiam</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eiam-identity-source</artifactId>
<version>1.0.0-beta1</version>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
@@ -38,6 +38,7 @@
<module>eiam-identity-source-dingtalk</module>
<module>eiam-identity-source-wechatwork</module>
<module>eiam-identity-source-feishu</module>
<module>eiam-identity-source-excel</module>
</modules>
<dependencies>