mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
scim domain init
scim domain init
This commit is contained in:
@@ -15,7 +15,7 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.kafka.bootstrap-servers=localhost:9092
|
||||
###########【初始化消费者配置】###########
|
||||
# 默认的消费组ID
|
||||
spring.kafka.consumer.properties.group.id=defaultConsumerGroup
|
||||
spring.kafka.consumer.properties.group.id=ActiveDirectoryConsumerGroup
|
||||
# 是否自动提交offset
|
||||
spring.kafka.consumer.enable-auto-commit=true
|
||||
# 提交offset延时(接收到消息后多久提交offset)
|
||||
|
||||
@@ -17,7 +17,7 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.kafka.bootstrap-servers=localhost:9092
|
||||
###########【初始化消费者配置】###########
|
||||
# 默认的消费组ID
|
||||
spring.kafka.consumer.properties.group.id=test-consumer-group
|
||||
spring.kafka.consumer.properties.group.id=LdapConsumerGroup
|
||||
# 是否自动提交offset
|
||||
spring.kafka.consumer.enable-auto-commit=true
|
||||
# 提交offset延时(接收到消息后多久提交offset)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.maxkey.json;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* JSON deserializer for Jackson to handle regular date instances as timestamps
|
||||
* in ISO format.
|
||||
*
|
||||
*/
|
||||
public class JsonDateDeserializer extends JsonDeserializer<Date> {
|
||||
|
||||
private static final SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser parser, DeserializationContext context)
|
||||
throws IOException, JsonProcessingException {
|
||||
try {
|
||||
return dateFormat.parse(parser.getText());
|
||||
} catch (ParseException e) {
|
||||
throw new JsonParseException(parser,"Could not parse date", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +1,30 @@
|
||||
package org.maxkey.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 日期json序列化格式
|
||||
* 日期json序列化格式.
|
||||
*
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class JsonDateSerializer extends JsonSerializer<Date>{
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator gen, SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
String formattedDate = dateFormat.format(date);
|
||||
gen.writeString(formattedDate);
|
||||
}
|
||||
@Component
|
||||
public class JsonDateSerializer extends JsonSerializer<Date> {
|
||||
private static final SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator gen, SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
String formattedDate = dateFormat.format(date);
|
||||
gen.writeString(formattedDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
package org.maxkey.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class JsonDateTimeDeserializer extends JsonDeserializer<Date>{
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@Override
|
||||
public Date deserialize(JsonParser jsonParser, DeserializationContext dc)
|
||||
throws IOException, JsonProcessingException {
|
||||
Date parserDate=null;
|
||||
try {
|
||||
parserDate = dateFormat.parse(jsonParser.getText());
|
||||
} catch (ParseException e) {
|
||||
public class JsonDateTimeDeserializer extends JsonDeserializer<Date> {
|
||||
private static final SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return parserDate;
|
||||
}
|
||||
@Override
|
||||
public Date deserialize(JsonParser parser, DeserializationContext dc)
|
||||
throws IOException, JsonProcessingException {
|
||||
Date parserDate = null;
|
||||
try {
|
||||
parserDate = dateFormat.parse(parser.getText());
|
||||
} catch (ParseException e) {
|
||||
throw new JsonParseException(parser,"Could not parse date", e);
|
||||
}
|
||||
return parserDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
package org.maxkey.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* 日期时间json序列化格式
|
||||
* 日期时间json序列化格式.
|
||||
*
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class JsonDateTimeSerializer extends JsonSerializer<Date>{
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator gen, SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
String formattedDate = dateFormat.format(date);
|
||||
gen.writeString(formattedDate);
|
||||
}
|
||||
public class JsonDateTimeSerializer extends JsonSerializer<Date> {
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator gen, SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
String formattedDate = dateFormat.format(date);
|
||||
gen.writeString(formattedDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,34 @@
|
||||
/*
|
||||
* Cloud Foundry 2012.02.03 Beta
|
||||
* Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this product except in compliance with the License.
|
||||
*
|
||||
* This product includes a number of subcomponents with
|
||||
* separate copyright notices and license terms. Your use of these
|
||||
* subcomponents is subject to the terms and conditions of the
|
||||
* subcomponent's license, as noted in the LICENSE file.
|
||||
*/
|
||||
package org.maxkey.json;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* JSON deserializer for Jackson to handle regular date instances as timestamps in ISO format.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* JSON deserializer for Jackson to handle regular date instances as timestamps
|
||||
* in ISO format.
|
||||
*
|
||||
*/
|
||||
|
||||
public class JsonISODateDeserializer extends JsonDeserializer<Date> {
|
||||
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
|
||||
try {
|
||||
return dateFormat.parse(parser.getText());
|
||||
}
|
||||
catch (ParseException e) {
|
||||
throw new JsonParseException("Could not parse date", parser.getCurrentLocation(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser parser, DeserializationContext context)
|
||||
throws IOException, JsonProcessingException {
|
||||
try {
|
||||
return dateFormat.parse(parser.getText());
|
||||
} catch (ParseException e) {
|
||||
throw new JsonParseException(parser,"Could not parse date", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +1,28 @@
|
||||
/*
|
||||
* Cloud Foundry 2012.02.03 Beta
|
||||
* Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this product except in compliance with the License.
|
||||
*
|
||||
* This product includes a number of subcomponents with
|
||||
* separate copyright notices and license terms. Your use of these
|
||||
* subcomponents is subject to the terms and conditions of the
|
||||
* subcomponent's license, as noted in the LICENSE file.
|
||||
*/
|
||||
package org.maxkey.json;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* JSON serializer for Jackson to handle regular date instances as timestamps in ISO format.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
* JSON serializer for Jackson to handle regular date instances as timestamps in
|
||||
* ISO format.
|
||||
*/
|
||||
|
||||
public class JsonISODateSerializer extends JsonSerializer<Date> {
|
||||
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
private static final SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator generator, SerializerProvider provider) throws IOException,
|
||||
JsonProcessingException {
|
||||
String formatted = dateFormat.format(date);
|
||||
generator.writeString(formatted);
|
||||
}
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator generator, SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
String formatted = dateFormat.format(date);
|
||||
generator.writeString(formatted);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,20 @@
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="test"/>
|
||||
<attribute name="gradle_used_by_scope" value="test"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="test"/>
|
||||
<attribute name="gradle_used_by_scope" value="test"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer">
|
||||
<attributes>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="maxkey-identity-scim">
|
||||
<wb-resource deploy-path="/" source-path="src/main/resources"/>
|
||||
<wb-resource deploy-path="/" source-path="src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/test/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/test/resources"/>
|
||||
<dependent-module deploy-path="../" handle="module:/resource/maxkey-core/maxkey-core">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
@@ -3,11 +3,8 @@ package org.maxkey.identity.scim.resources;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Enterprise implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -204619629148409697L;
|
||||
|
||||
private String employeeNumber;
|
||||
private String costCenter;
|
||||
private String organization;
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class EnterpriseUser extends User {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3212312511630459427L;
|
||||
|
||||
public static final String SCHEMA = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";
|
||||
|
||||
@JsonProperty(SCHEMA)
|
||||
Enterprise enterprise;
|
||||
|
||||
public EnterpriseUser() {
|
||||
schemas =new HashSet<String>();
|
||||
schemas.add(User.SCHEMA);
|
||||
schemas.add(SCHEMA);
|
||||
}
|
||||
|
||||
public Enterprise getEnterprise() {
|
||||
return enterprise;
|
||||
}
|
||||
|
||||
public void setEnterprise(Enterprise enterprise) {
|
||||
this.enterprise = enterprise;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Group {
|
||||
public class Group extends Resource{
|
||||
private static final long serialVersionUID = 404613567384513866L;
|
||||
|
||||
public static final String SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:Group";
|
||||
|
||||
|
||||
private String displayName;
|
||||
private Set<MemberRef> members;
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
@@ -20,7 +23,10 @@ public class Group {
|
||||
public void setMembers(Set<MemberRef> members) {
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public Group() {
|
||||
schemas =new HashSet<String>();
|
||||
schemas.add(SCHEMA);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import org.maxkey.json.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
public class Meta implements Serializable {
|
||||
|
||||
/**
|
||||
@@ -12,10 +17,20 @@ public class Meta implements Serializable {
|
||||
private static final long serialVersionUID = -2244662962968933591L;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
@JsonSerialize(using = JsonISODateSerializer.class)
|
||||
@JsonDeserialize(using = JsonISODateDeserializer.class)
|
||||
private Date created;
|
||||
|
||||
@JsonSerialize(using = JsonISODateSerializer.class)
|
||||
@JsonDeserialize(using = JsonISODateDeserializer.class)
|
||||
|
||||
private Date lastModified;
|
||||
|
||||
private String location;
|
||||
|
||||
private String version;
|
||||
|
||||
private Set<String> attributes;
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,16 @@ package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class MultiValuedAttribute implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6878912593878245947L;
|
||||
|
||||
String value;
|
||||
String display;
|
||||
boolean primary;
|
||||
@JsonProperty("$ref")
|
||||
String reference;
|
||||
String type;
|
||||
|
||||
|
||||
@@ -9,10 +9,11 @@ public class Resource implements Serializable {
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5159743553948621024L;
|
||||
protected Set<String> schemas;
|
||||
private String id;
|
||||
private String externalId;
|
||||
private Meta meta;
|
||||
private Set<String> schemas;
|
||||
|
||||
public Resource() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -176,6 +177,8 @@ public class User extends Resource{
|
||||
this.extensions = extensions;
|
||||
}
|
||||
public User() {
|
||||
schemas =new HashSet<String>();
|
||||
schemas.add(SCHEMA);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserPhoneNumber implements Serializable {
|
||||
public class UserPhoneNumber extends MultiValuedAttribute implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
public class ReadJson2String {
|
||||
|
||||
public static String read(String jsonFileName) {
|
||||
try {
|
||||
List<String> list = FileUtils.readLines(new File(ReadJson2String.class.getResource(jsonFileName).getFile()),"UTF-8");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String ss : list) {
|
||||
sb.append(ss);
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"schemas": [
|
||||
"urn:ietf:params:scim:schemas:core:2.0:User",
|
||||
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
|
||||
],
|
||||
"id": "1111111111111",
|
||||
"externalId": "UserName",
|
||||
"meta": {
|
||||
"resourceType": "User",
|
||||
"created": "2020-06-15T23:06:00.129Z",
|
||||
"lastModified": "2020-06-15T23:06:00.129Z",
|
||||
"location": "https://example.com/v2/Users/2819c223...",
|
||||
"version": "W\\/\"f250dd84f0671c3\""
|
||||
},
|
||||
"userName": "UserName",
|
||||
"name": {
|
||||
"formatted": "Ms. Barbara J Jensen, III",
|
||||
"familyName": "Jensen",
|
||||
"givenName": "Barbara",
|
||||
"middleName": "Jane",
|
||||
"honorificPrefix": "Ms.",
|
||||
"honorificSuffix": "III"
|
||||
},
|
||||
"emails": [
|
||||
{
|
||||
"value": "bjensen@example.com",
|
||||
"primary": false,
|
||||
"type": "work"
|
||||
}
|
||||
],
|
||||
"phoneNumbers": [
|
||||
{
|
||||
"value": "555-555-8377",
|
||||
"primary": false,
|
||||
"type": "home"
|
||||
},
|
||||
{
|
||||
"value": "555-555-8377",
|
||||
"primary": false,
|
||||
"type": "work"
|
||||
}
|
||||
],
|
||||
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
|
||||
"employeeNumber": "k200908",
|
||||
"costCenter": "1111",
|
||||
"department": "de"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimEnterpriseUserJsonString2ObjectTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String userJsonString = ReadJson2String.read("ScimEnterpriseUserJsonString.json");
|
||||
EnterpriseUser u = JsonUtils.json2Object(userJsonString, EnterpriseUser.class);
|
||||
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(u)));
|
||||
System.out.println(u.getEnterprise().getCostCenter());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimEnterpriseUserJsonTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
EnterpriseUser u = new EnterpriseUser();
|
||||
u.setUserName("UserName");
|
||||
u.setExternalId("UserName");
|
||||
u.setId("1111111111111");
|
||||
|
||||
Meta meta = new Meta();
|
||||
meta.setVersion("W\\/\"f250dd84f0671c3\"");
|
||||
meta.setCreated(new Date());
|
||||
meta.setLocation("https://example.com/v2/Users/2819c223...");
|
||||
meta.setResourceType("User");
|
||||
meta.setLastModified(new Date());
|
||||
u.setMeta(meta);
|
||||
|
||||
UserName un=new UserName();
|
||||
un.setFamilyName("Jensen");
|
||||
un.setFormatted("Ms. Barbara J Jensen, III");
|
||||
un.setGivenName("Barbara");
|
||||
un.setHonorificPrefix("Ms.");
|
||||
un.setHonorificSuffix("III");
|
||||
un.setMiddleName("Jane");
|
||||
u.setName(un);
|
||||
|
||||
List<UserPhoneNumber> UserPhoneNumberList = new ArrayList<UserPhoneNumber>();
|
||||
UserPhoneNumber pn =new UserPhoneNumber();
|
||||
pn.setValue("555-555-8377");
|
||||
pn.setType(UserPhoneNumber.UserPhoneNumberType.WORK);
|
||||
|
||||
UserPhoneNumber pnh =new UserPhoneNumber();
|
||||
pnh.setValue("555-555-8377");
|
||||
pnh.setType(UserPhoneNumber.UserPhoneNumberType.HOME);
|
||||
UserPhoneNumberList.add(pnh);
|
||||
|
||||
UserPhoneNumberList.add(pn);
|
||||
|
||||
u.setPhoneNumbers(UserPhoneNumberList);
|
||||
|
||||
List<UserEmail> ueList = new ArrayList<UserEmail>();
|
||||
UserEmail ue =new UserEmail();
|
||||
ue.setValue("bjensen@example.com");
|
||||
ue.setType(UserEmail.UserEmailType.WORK);
|
||||
ueList.add(ue);
|
||||
u.setEmails(ueList);
|
||||
|
||||
Enterprise ent =new Enterprise();
|
||||
ent.setCostCenter("1111");
|
||||
ent.setDepartment("de");
|
||||
ent.setEmployeeNumber("k200908");
|
||||
u.setEnterprise(ent);
|
||||
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(u)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"schemas": [
|
||||
"urn:ietf:params:scim:schemas:core:2.0:Group"
|
||||
],
|
||||
"meta": {
|
||||
"resourceType": "User",
|
||||
"created": "2020-06-15T23:08:50.698Z",
|
||||
"lastModified": "2020-06-15T23:08:50.698Z",
|
||||
"location": "https://example.com/v2/Users/2819c223...",
|
||||
"version": "W\\/\"f250dd84f0671c3\""
|
||||
},
|
||||
"displayName": "Tour Guides",
|
||||
"members": [
|
||||
{
|
||||
"value": "2819c223-7f76-453a-919d-413861904646",
|
||||
"display": "Babs Jensen",
|
||||
"primary": false,
|
||||
"$ref": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646"
|
||||
},
|
||||
{
|
||||
"value": "2819c223-7f76-453a-919d-413861904646",
|
||||
"display": "Babs Jensen",
|
||||
"primary": false,
|
||||
"$ref": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646"
|
||||
},
|
||||
{
|
||||
"value": "2819c223-7f76-453a-919d-413861904646",
|
||||
"display": "Babs Jensen",
|
||||
"primary": false,
|
||||
"$ref": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimGroupJsonString2ObjectTest {
|
||||
public static void main(String[] args) {
|
||||
String userJsonString = ReadJson2String.read("ScimGroupJsonString.json");
|
||||
Group g = JsonUtils.json2Object(userJsonString, Group.class);
|
||||
|
||||
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(g)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimGroupJsonTest {
|
||||
public static void main(String[] args) {
|
||||
Group g= new Group();
|
||||
|
||||
Meta meta = new Meta();
|
||||
meta.setVersion("W\\/\"f250dd84f0671c3\"");
|
||||
meta.setCreated(new Date());
|
||||
meta.setLocation("https://example.com/v2/Users/2819c223...");
|
||||
meta.setResourceType("User");
|
||||
meta.setLastModified(new Date());
|
||||
g.setMeta(meta);
|
||||
|
||||
g.setDisplayName("Tour Guides");
|
||||
|
||||
Set<MemberRef> mrSet =new HashSet<MemberRef>();
|
||||
MemberRef mr1 =new MemberRef();
|
||||
mr1.setReference("https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646");
|
||||
mr1.setValue("2819c223-7f76-453a-919d-413861904646");
|
||||
mr1.setDisplay("Babs Jensen");
|
||||
MemberRef mr2 =new MemberRef();
|
||||
mr2.setReference("https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646");
|
||||
mr2.setValue("2819c223-7f76-453a-919d-413861904646");
|
||||
mr2.setDisplay("Babs Jensen");
|
||||
MemberRef mr3 =new MemberRef();
|
||||
mr3.setReference("https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646");
|
||||
mr3.setValue("2819c223-7f76-453a-919d-413861904646");
|
||||
mr3.setDisplay("Babs Jensen");
|
||||
mrSet.add(mr1);
|
||||
mrSet.add(mr2);
|
||||
mrSet.add(mr3);
|
||||
|
||||
g.setMembers(mrSet);
|
||||
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(g)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"schemas": [
|
||||
"urn:ietf:params:scim:schemas:core:2.0:User"
|
||||
],
|
||||
"id": "1111111111111",
|
||||
"externalId": "UserName",
|
||||
"meta": {
|
||||
"resourceType": "User",
|
||||
"created": "2020-06-15T23:09:30.763Z",
|
||||
"lastModified": "2020-06-15T23:09:30.763Z",
|
||||
"location": "https://example.com/v2/Users/2819c223...",
|
||||
"version": "W\\/\"f250dd84f0671c3\""
|
||||
},
|
||||
"userName": "UserName",
|
||||
"name": {
|
||||
"formatted": "Ms. Barbara J Jensen, III",
|
||||
"familyName": "Jensen",
|
||||
"givenName": "Barbara",
|
||||
"middleName": "Jane",
|
||||
"honorificPrefix": "Ms.",
|
||||
"honorificSuffix": "III"
|
||||
},
|
||||
"emails": [
|
||||
{
|
||||
"value": "bjensen@example.com",
|
||||
"primary": false,
|
||||
"type": "work"
|
||||
}
|
||||
],
|
||||
"phoneNumbers": [
|
||||
{
|
||||
"value": "555-555-8377",
|
||||
"primary": false,
|
||||
"type": "home"
|
||||
},
|
||||
{
|
||||
"value": "555-555-8377",
|
||||
"primary": false,
|
||||
"type": "work"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimUserJsonString2ObjectTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String userJsonString = ReadJson2String.read("ScimUserJsonString.json");
|
||||
User u = JsonUtils.json2Object(userJsonString, User.class);
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(u)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.maxkey.identity.scim.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
|
||||
public class ScimUserJsonTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
User u = new User();
|
||||
u.setUserName("UserName");
|
||||
u.setExternalId("UserName");
|
||||
u.setId("1111111111111");
|
||||
|
||||
Meta meta = new Meta();
|
||||
meta.setVersion("W\\/\"f250dd84f0671c3\"");
|
||||
meta.setCreated(new Date());
|
||||
meta.setLocation("https://example.com/v2/Users/2819c223...");
|
||||
meta.setResourceType("User");
|
||||
meta.setLastModified(new Date());
|
||||
u.setMeta(meta);
|
||||
|
||||
UserName un=new UserName();
|
||||
un.setFamilyName("Jensen");
|
||||
un.setFormatted("Ms. Barbara J Jensen, III");
|
||||
un.setGivenName("Barbara");
|
||||
un.setHonorificPrefix("Ms.");
|
||||
un.setHonorificSuffix("III");
|
||||
un.setMiddleName("Jane");
|
||||
u.setName(un);
|
||||
|
||||
List<UserPhoneNumber> UserPhoneNumberList = new ArrayList<UserPhoneNumber>();
|
||||
UserPhoneNumber pn =new UserPhoneNumber();
|
||||
pn.setValue("555-555-8377");
|
||||
pn.setType(UserPhoneNumber.UserPhoneNumberType.WORK);
|
||||
|
||||
UserPhoneNumber pnh =new UserPhoneNumber();
|
||||
pnh.setValue("555-555-8377");
|
||||
pnh.setType(UserPhoneNumber.UserPhoneNumberType.HOME);
|
||||
UserPhoneNumberList.add(pnh);
|
||||
|
||||
UserPhoneNumberList.add(pn);
|
||||
|
||||
u.setPhoneNumbers(UserPhoneNumberList);
|
||||
|
||||
List<UserEmail> ueList = new ArrayList<UserEmail>();
|
||||
UserEmail ue =new UserEmail();
|
||||
ue.setValue("bjensen@example.com");
|
||||
ue.setType(UserEmail.UserEmailType.WORK);
|
||||
ueList.add(ue);
|
||||
u.setEmails(ueList);
|
||||
|
||||
System.out.println(
|
||||
(new JsonPretty()).format(JsonUtils.object2Json(u)));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user