mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-23 16:38:09 +08:00
Identity Provisioning based on Kafka
Identity Provisioning based on Kafka, Have many connectors
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
|
||||
@@ -5,5 +5,5 @@ dependencies {
|
||||
compile fileTree(dir: '../maxkey-lib/*/', include: '*.jar')
|
||||
|
||||
compile project(":maxkey-core")
|
||||
|
||||
compile project(":maxkey-identitys:maxkey-identity-kafka")
|
||||
}
|
||||
@@ -3,11 +3,18 @@ package org.maxkey.dao.service;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.dao.persistence.OrganizationsMapper;
|
||||
import org.maxkey.domain.Organizations;
|
||||
import org.maxkey.identity.kafka.KafkaIdentityAction;
|
||||
import org.maxkey.identity.kafka.KafkaIdentityTopic;
|
||||
import org.maxkey.identity.kafka.KafkaProvisioningService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OrganizationsService extends JpaBaseService<Organizations>{
|
||||
|
||||
@Autowired
|
||||
KafkaProvisioningService kafkaProvisioningService;
|
||||
|
||||
public OrganizationsService() {
|
||||
super(OrganizationsMapper.class);
|
||||
}
|
||||
@@ -21,4 +28,31 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
|
||||
return (OrganizationsMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public boolean insert(Organizations organization) {
|
||||
if(super.insert(organization)){
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.ORG_TOPIC, organization, KafkaIdentityAction.CREATE_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean update(Organizations organization) {
|
||||
if(super.update(organization)){
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.ORG_TOPIC, organization, KafkaIdentityAction.UPDATE_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean delete(Organizations organization) {
|
||||
if(super.delete(organization)){
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.ORG_TOPIC, organization, KafkaIdentityAction.DELETE_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
import org.maxkey.dao.persistence.UserInfoMapper;
|
||||
import org.maxkey.domain.ChangePassword;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.identity.kafka.KafkaIdentityAction;
|
||||
import org.maxkey.identity.kafka.KafkaIdentityTopic;
|
||||
import org.maxkey.identity.kafka.KafkaProvisioningService;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.maxkey.web.WebContext;
|
||||
@@ -29,6 +32,8 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Autowired
|
||||
KafkaProvisioningService kafkaProvisioningService;
|
||||
|
||||
public UserInfoService() {
|
||||
super(UserInfoMapper.class);
|
||||
@@ -46,22 +51,27 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
||||
public boolean insert(UserInfo userInfo) {
|
||||
userInfo = passwordEncoder(userInfo);
|
||||
if (super.insert(userInfo)) {
|
||||
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.USERINFO_TOPIC, userInfo, KafkaIdentityAction.CREATE_ACTION);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean update(UserInfo userinfo) {
|
||||
if(super.update(userinfo)){
|
||||
public boolean update(UserInfo userInfo) {
|
||||
if(super.update(userInfo)){
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.USERINFO_TOPIC, userInfo, KafkaIdentityAction.UPDATE_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean delete(UserInfo userinfo) {
|
||||
if( super.delete(userinfo)){
|
||||
public boolean delete(UserInfo userInfo) {
|
||||
if( super.delete(userInfo)){
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.USERINFO_TOPIC, userInfo, KafkaIdentityAction.DELETE_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -130,6 +140,8 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
|
||||
changePassword.setUsername(userInfo.getUsername());
|
||||
changePassword.setDecipherable(userInfo.getDecipherable());
|
||||
changePassword.setPassword(userInfo.getPassword());
|
||||
kafkaProvisioningService.send(
|
||||
KafkaIdentityTopic.PASSWORD_TOPIC, changePassword, KafkaIdentityAction.PASSWORD_ACTION);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user