dingding rename to dingtalk

maxkey-synchronizers-dingding
This commit is contained in:
MaxKey 2022-01-20 10:14:24 +08:00
parent 34fffac032
commit 8ecdc236f0
13 changed files with 118 additions and 113 deletions

View File

@ -50,7 +50,7 @@ def libjarsmapper=[
'maxkey-synchronizers' :'maxkey_mgt',
'maxkey-synchronizers-activedirectory' :'maxkey_mgt',
'maxkey-synchronizers-ldap' :'maxkey_mgt',
'maxkey-synchronizers-dingding' :'maxkey_mgt',
'maxkey-synchronizers-dingtalk' :'maxkey_mgt',
'maxkey-synchronizers-workweixin' :'maxkey_mgt',
'maxkey-synchronizers-reorgdept' :'maxkey_mgt',
'maxkey-boot-monitor' :'maxkey_monitor'
@ -300,9 +300,9 @@ subprojects {
implementation group: 'com.alibaba.cloud', name: 'spring-cloud-starter-alibaba-nacos-config', version: "${springcloudalibabaVersion}"
//saml
implementation group: 'org.opensaml', name: 'opensaml', version: "${opensamlVersion}"
implementation group: 'org.opensaml', name: 'openws', version: "${openwsVersion}"
implementation group: 'org.opensaml', name: 'xmltooling', version: "${xmltoolingVersion}"
//implementation group: 'org.opensaml', name: 'opensaml', version: "${opensamlVersion}"
//implementation group: 'org.opensaml', name: 'openws', version: "${openwsVersion}"
//implementation group: 'org.opensaml', name: 'xmltooling', version: "${xmltoolingVersion}"
implementation group: 'net.shibboleth.utilities', name: 'java-support', version: "${javasupportVersion}"
//jose-jwt
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: "${nimbusjosejwtVersion}"

View File

@ -50,7 +50,7 @@ def libjarsmapper=[
'maxkey-synchronizers' :'maxkey_mgt',
'maxkey-synchronizers-activedirectory' :'maxkey_mgt',
'maxkey-synchronizers-ldap' :'maxkey_mgt',
'maxkey-synchronizers-dingding' :'maxkey_mgt',
'maxkey-synchronizers-dingtalk' :'maxkey_mgt',
'maxkey-synchronizers-workweixin' :'maxkey_mgt',
'maxkey-synchronizers-reorgdept' :'maxkey_mgt',
'maxkey-boot-monitor' :'maxkey_monitor'

View File

@ -1,92 +0,0 @@
/*
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.synchronizer.dingding;
import org.maxkey.entity.Synchronizers;
import org.maxkey.synchronizer.ISynchronizerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.taobao.api.ApiException;
@Service
public class DingdingSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingdingSynchronizerService.class);
Synchronizers synchronizer;
@Autowired
DingdingUsersService dingdingUsersService;
@Autowired
DingdingOrganizationService dingdingOrganizationService;
DingdingAccessTokenService dingdingAccessTokenService = new DingdingAccessTokenService();
public DingdingSynchronizerService() {
super();
}
public void sync() throws ApiException {
_logger.info("Sync ...");
dingdingAccessTokenService.setAppkey(synchronizer.getPrincipal());
dingdingAccessTokenService.setAppsecret(synchronizer.getCredentials());
String access_token=dingdingAccessTokenService.requestToken();
dingdingOrganizationService.setSynchronizer(synchronizer);
dingdingOrganizationService.setAccess_token(access_token);
dingdingOrganizationService.sync();
dingdingUsersService.setSynchronizer(synchronizer);
dingdingUsersService.setAccess_token(access_token);
dingdingUsersService.sync();
}
public DingdingUsersService getDingdingUsersService() {
return dingdingUsersService;
}
public void setDingdingUsersService(DingdingUsersService dingdingUsersService) {
this.dingdingUsersService = dingdingUsersService;
}
public DingdingOrganizationService getDingdingOrganizationService() {
return dingdingOrganizationService;
}
public void setDingdingOrganizationService(DingdingOrganizationService dingdingOrganizationService) {
this.dingdingOrganizationService = dingdingOrganizationService;
}
public DingdingAccessTokenService getDingdingAccessTokenService() {
return dingdingAccessTokenService;
}
public void setDingdingAccessTokenService(DingdingAccessTokenService dingdingAccessTokenService) {
this.dingdingAccessTokenService = dingdingAccessTokenService;
}
@Override
public void setSynchronizer(Synchronizers synchronizer) {
this.synchronizer = synchronizer;
}
}

View File

@ -1,4 +1,4 @@
description = "maxkey-synchronizers-dingding"
description = "maxkey-synchronizers-dingtalk"
apply plugin: 'java'

View File

@ -15,7 +15,7 @@
*/
package org.maxkey.synchronizer.dingding;
package org.maxkey.synchronizer.dingtalk;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -26,17 +26,17 @@ import com.dingtalk.api.request.OapiGettokenRequest;
import com.dingtalk.api.response.OapiGettokenResponse;
import com.taobao.api.ApiException;
public class DingdingAccessTokenService {
final static Logger _logger = LoggerFactory.getLogger(DingdingAccessTokenService.class);
public class DingtalkAccessTokenService {
final static Logger _logger = LoggerFactory.getLogger(DingtalkAccessTokenService.class);
String appkey;
String appsecret;
public DingdingAccessTokenService() {
public DingtalkAccessTokenService() {
}
public DingdingAccessTokenService(String appkey, String appsecret) {
public DingtalkAccessTokenService(String appkey, String appsecret) {
super();
this.appkey = appkey;
this.appsecret = appsecret;

View File

@ -15,7 +15,7 @@
*/
package org.maxkey.synchronizer.dingding;
package org.maxkey.synchronizer.dingtalk;
import org.maxkey.entity.Organizations;
import org.maxkey.synchronizer.AbstractSynchronizerService;
@ -31,8 +31,8 @@ import com.dingtalk.api.response.OapiV2DepartmentListsubResponse.DeptBaseRespons
import com.taobao.api.ApiException;
@Service
public class DingdingOrganizationService extends AbstractSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingdingOrganizationService.class);
public class DingtalkOrganizationService extends AbstractSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingtalkOrganizationService.class);
OapiV2DepartmentListsubResponse rspDepts;

View File

@ -0,0 +1,97 @@
/*
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.synchronizer.dingtalk;
import org.maxkey.entity.Synchronizers;
import org.maxkey.synchronizer.ISynchronizerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.taobao.api.ApiException;
@Service
public class DingtalkSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingtalkSynchronizerService.class);
Synchronizers synchronizer;
@Autowired
DingtalkUsersService dingtalkUsersService;
@Autowired
DingtalkOrganizationService dingtalkOrganizationService;
DingtalkAccessTokenService dingtalkAccessTokenService = new DingtalkAccessTokenService();
public DingtalkSynchronizerService() {
super();
}
public void sync() throws ApiException {
_logger.info("Sync ...");
dingtalkAccessTokenService.setAppkey(synchronizer.getPrincipal());
dingtalkAccessTokenService.setAppsecret(synchronizer.getCredentials());
String access_token=dingtalkAccessTokenService.requestToken();
dingtalkOrganizationService.setSynchronizer(synchronizer);
dingtalkOrganizationService.setAccess_token(access_token);
dingtalkOrganizationService.sync();
dingtalkUsersService.setSynchronizer(synchronizer);
dingtalkUsersService.setAccess_token(access_token);
dingtalkUsersService.sync();
}
public DingtalkUsersService getDingtalkUsersService() {
return dingtalkUsersService;
}
public void setDingtalkUsersService(DingtalkUsersService dingtalkUsersService) {
this.dingtalkUsersService = dingtalkUsersService;
}
public DingtalkOrganizationService getDingtalkOrganizationService() {
return dingtalkOrganizationService;
}
public void setDingtalkOrganizationService(DingtalkOrganizationService dingtalkOrganizationService) {
this.dingtalkOrganizationService = dingtalkOrganizationService;
}
public Synchronizers getSynchronizer() {
return synchronizer;
}
public DingtalkAccessTokenService getDingtalkAccessTokenService() {
return dingtalkAccessTokenService;
}
public void setDingtalkAccessTokenService(DingtalkAccessTokenService dingtalkAccessTokenService) {
this.dingtalkAccessTokenService = dingtalkAccessTokenService;
}
@Override
public void setSynchronizer(Synchronizers synchronizer) {
this.synchronizer = synchronizer;
}
}

View File

@ -15,7 +15,7 @@
*/
package org.maxkey.synchronizer.dingding;
package org.maxkey.synchronizer.dingtalk;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
@ -36,11 +36,11 @@ import com.dingtalk.api.response.OapiV2DepartmentListsubResponse.DeptBaseRespons
import com.dingtalk.api.response.OapiV2UserListResponse.ListUserResponse;
@Service
public class DingdingUsersService extends AbstractSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingdingUsersService.class);
public class DingtalkUsersService extends AbstractSynchronizerService implements ISynchronizerService{
final static Logger _logger = LoggerFactory.getLogger(DingtalkUsersService.class);
@Autowired
DingdingOrganizationService dingdingOrganizationService;
DingtalkOrganizationService dingdingOrganizationService;
String access_token;
@ -115,7 +115,7 @@ public class DingdingUsersService extends AbstractSynchronizerService implement
this.access_token = access_token;
}
public void setDingdingOrganizationService(DingdingOrganizationService dingdingOrganizationService) {
public void setDingdingOrganizationService(DingtalkOrganizationService dingdingOrganizationService) {
this.dingdingOrganizationService = dingdingOrganizationService;
}

Binary file not shown.

BIN
maxkey-lib/openws-1.5.6.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -22,7 +22,7 @@ dependencies {
implementation project(":maxkey-identitys:maxkey-synchronizers-activedirectory")
implementation project(":maxkey-identitys:maxkey-synchronizers-ldap")
implementation project(":maxkey-identitys:maxkey-synchronizers-workweixin")
implementation project(":maxkey-identitys:maxkey-synchronizers-dingding")
implementation project(":maxkey-identitys:maxkey-synchronizers-dingtalk")
implementation project(":maxkey-webs:maxkey-web-resources")
}

View File

@ -37,7 +37,7 @@ include (
'maxkey-identitys:maxkey-synchronizers-reorgdept',
'maxkey-identitys:maxkey-synchronizers-activedirectory',
'maxkey-identitys:maxkey-synchronizers-ldap',
'maxkey-identitys:maxkey-synchronizers-dingding',
'maxkey-identitys:maxkey-synchronizers-dingtalk',
'maxkey-identitys:maxkey-synchronizers-workweixin',
//Protocol
'maxkey-protocols:maxkey-protocol-authorize',