identity fix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user