mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 17:38:32 +08:00
identity fix
This commit is contained in:
parent
d52fe42ccc
commit
2d1844f81a
@ -43,8 +43,10 @@ public class ApplicationConfig {
|
||||
|
||||
@Autowired
|
||||
EmailConfig emailConfig;
|
||||
|
||||
@Autowired
|
||||
CharacterEncodingConfig characterEncodingConfig;
|
||||
|
||||
@Autowired
|
||||
LoginConfig loginConfig;
|
||||
|
||||
@ -82,36 +84,9 @@ public class ApplicationConfig {
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
/*
|
||||
* //is enable whiteList for ipAddress filter boolean whiteList;
|
||||
*
|
||||
* //All user have permission Access URL public ConcurrentHashMap<String,String>
|
||||
* anonymousAccessUrls;
|
||||
*/
|
||||
|
||||
public ApplicationConfig() {
|
||||
super();
|
||||
|
||||
/*
|
||||
* anonymousAccessUrls=new ConcurrentHashMap<String,String>();
|
||||
* anonymousAccessUrls.put("/index/", "/index/");
|
||||
* anonymousAccessUrls.put("/index/top","/index/top/");
|
||||
* anonymousAccessUrls.put("/index/left/","/index/left/");
|
||||
* anonymousAccessUrls.put("/index/main/","/index/main/");
|
||||
* anonymousAccessUrls.put("/index/bottom/","/index/bottom/");
|
||||
*
|
||||
* anonymousAccessUrls.put("/menus/onelevelchild/","/menus/onelevelchild/");
|
||||
* anonymousAccessUrls.put("/menus/leftchild/","/menus/leftchild/");
|
||||
* anonymousAccessUrls.put("/menus/loadMenu/","/menus/loadMenu/");
|
||||
*
|
||||
* anonymousAccessUrls.put("/enterprises/select/","/enterprises/select/");
|
||||
* anonymousAccessUrls.put("/employees/selectAppRoles/",
|
||||
* "/employees/selectAppRoles/");
|
||||
* anonymousAccessUrls.put("/approles/appRolesGrid/","/approles/appRolesGrid/");
|
||||
*
|
||||
* _logger.debug("Anonymous Access Urls : \n"+anonymousAccessUrls);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,15 +157,6 @@ public class ApplicationConfig {
|
||||
this.subDomainName = subDomainName;
|
||||
}
|
||||
|
||||
/*
|
||||
* public ConcurrentHashMap<String, String> getAnonymousAccessUrls() { return
|
||||
* anonymousAccessUrls; }
|
||||
*
|
||||
* public void setAnonymousAccessUrls(ArrayList<String> anonymousAccessUrls) {
|
||||
* //this.anonymousAccessUrls = anonymousAccessUrls; for (String
|
||||
* anonymousAccessUrl: anonymousAccessUrls){
|
||||
* this.anonymousAccessUrls.put(anonymousAccessUrl,anonymousAccessUrl); } }
|
||||
*/
|
||||
/**
|
||||
* @return the emailConfig
|
||||
*/
|
||||
@ -237,10 +203,4 @@ public class ApplicationConfig {
|
||||
this.maxKeyUri = maxKeyUri;
|
||||
}
|
||||
|
||||
/*
|
||||
* public boolean isWhiteList() { return whiteList; }
|
||||
*
|
||||
* public void setWhiteList(boolean whiteList) { this.whiteList = whiteList; }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
description = "maxkey-identity-kafka"
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse-wtp'
|
||||
|
||||
|
||||
dependencies {
|
||||
//local jars
|
||||
|
||||
@ -19,9 +19,12 @@ package org.maxkey.identity.kafka;
|
||||
|
||||
public class KafkaIdentityAction {
|
||||
|
||||
public static String CREATE_ACTION = "CREATE_ACTION";
|
||||
public static String DELETE_ACTION = "DELETE_ACTION";
|
||||
public static String UPDATE_ACTION = "UPDATE_ACTION";
|
||||
public static String PASSWORD_ACTION = "PASSWORD_ACTION";
|
||||
public static String CREATE_ACTION = "CREATE_ACTION";
|
||||
|
||||
public static String DELETE_ACTION = "DELETE_ACTION";
|
||||
|
||||
public static String UPDATE_ACTION = "UPDATE_ACTION";
|
||||
|
||||
public static String PASSWORD_ACTION = "PASSWORD_ACTION";
|
||||
|
||||
}
|
||||
|
||||
@ -19,9 +19,12 @@ package org.maxkey.identity.kafka;
|
||||
|
||||
public class KafkaIdentityTopic {
|
||||
|
||||
public final static String USERINFO_TOPIC = "IDENTITY_USERINFO_TOPIC";
|
||||
public final static String ORG_TOPIC = "IDENTITY_ORG_TOPIC";
|
||||
public final static String GROUP_TOPIC = "IDENTITY_GROUP_TOPIC";
|
||||
public final static String USERINFO_TOPIC = "IDENTITY_USERINFO_TOPIC";
|
||||
|
||||
public final static String ORG_TOPIC = "IDENTITY_ORG_TOPIC";
|
||||
|
||||
public final static String GROUP_TOPIC = "IDENTITY_GROUP_TOPIC";
|
||||
|
||||
public final static String PASSWORD_TOPIC = "IDENTITY_PASSWORD_TOPIC";
|
||||
|
||||
|
||||
|
||||
@ -18,42 +18,53 @@
|
||||
package org.maxkey.identity.kafka;
|
||||
|
||||
public class KafkaMessage {
|
||||
|
||||
String topic;
|
||||
String actionType;
|
||||
String sendTime;
|
||||
String msgId;
|
||||
String content;
|
||||
|
||||
|
||||
public String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
public void setTopic(String topic) {
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public String getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public void setActionType(String actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public String getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(String sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public String getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
||||
public void setMsgId(String msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public KafkaMessage() {
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,13 +47,23 @@ public class KafkaProvisioningService {
|
||||
this.kafkaTemplate = kafkaTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* send msg to kafka
|
||||
* @param topic kafka TOPIC
|
||||
* @param content msg Object
|
||||
* @param actionType CREATE UPDATE DELETE
|
||||
*/
|
||||
public void send(String topic,Object content,String actionType) {
|
||||
//config.identity.kafkasupport , if true
|
||||
if(applicationConfig.isKafkaSupport()) {
|
||||
KafkaMessage message = new KafkaMessage();
|
||||
//message id uuid
|
||||
message.setMsgId(UUID.randomUUID().toString());
|
||||
message.setActionType(actionType);
|
||||
message.setTopic(topic);
|
||||
//send to kafka time
|
||||
message.setSendTime(DateUtils.getCurrentDateTimeAsString());
|
||||
//content Object to json message content
|
||||
message.setContent(JsonUtils.gson2Json(content));
|
||||
String msg = JsonUtils.gson2Json(message);
|
||||
_logger.info("send message = {}", msg);
|
||||
@ -67,6 +77,10 @@ public class KafkaProvisioningService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* KafkaProvisioningThread for send message
|
||||
*
|
||||
*/
|
||||
class KafkaProvisioningThread extends Thread{
|
||||
|
||||
KafkaTemplate<String, String> kafkaTemplate;
|
||||
@ -75,15 +89,22 @@ public class KafkaProvisioningService {
|
||||
|
||||
String msg;
|
||||
|
||||
public KafkaProvisioningThread(KafkaTemplate<String, String> kafkaTemplate, String topic, String msg) {
|
||||
public KafkaProvisioningThread(
|
||||
KafkaTemplate<String, String> kafkaTemplate,
|
||||
String topic,
|
||||
String msg) {
|
||||
|
||||
this.kafkaTemplate = kafkaTemplate;
|
||||
this.topic = topic;
|
||||
this.msg = msg;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
kafkaTemplate.send(topic, msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/identity/api/org"})
|
||||
public class RestApiOrgController {
|
||||
public class RestOrganizationController {
|
||||
|
||||
@Autowired
|
||||
OrganizationsService organizationsService;
|
||||
@ -36,7 +36,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/identity/api/userinfo"})
|
||||
public class RestApiUserInfoController {
|
||||
public class RestUserInfoController {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("userInfoService")
|
||||
@ -1,8 +1,6 @@
|
||||
description = "maxkey-identity-scim"
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse-wtp'
|
||||
|
||||
|
||||
dependencies {
|
||||
//local jars
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user