-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1. Add batch create and invite 2. Clean user objects to correctly reflect reality * Forgot new files
- Loading branch information
Showing
13 changed files
with
286 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/descope/enums/BatchUserPasswordAlgorithm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.descope.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import lombok.Getter; | ||
|
||
public enum BatchUserPasswordAlgorithm { | ||
BATCH_USER_PASSWORD_ALGORITHM_BCRYPT("bcrypt"), | ||
BATCH_USER_PASSWORD_ALGORITHM_PBKDF2SHA1("pbkdf2sha1"), | ||
BATCH_USER_PASSWORD_ALGORITHM_PBKDF2SHA256("pbkdf2sha256"), | ||
BATCH_USER_PASSWORD_ALGORITHM_PBKDF2SHA512("pbkdf2sha512"); | ||
|
||
@Getter | ||
@JsonValue | ||
private final String value; | ||
|
||
BatchUserPasswordAlgorithm(String value) { | ||
this.value = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/com/descope/model/user/request/BatchUserPasswordHashed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.descope.model.user.request; | ||
|
||
import com.descope.enums.BatchUserPasswordAlgorithm; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class BatchUserPasswordHashed { | ||
BatchUserPasswordAlgorithm algorithm; | ||
byte[] hash; | ||
byte[] salt; | ||
int iterations; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/descope/model/user/request/BatchUserRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.descope.model.user.request; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@EqualsAndHashCode(callSuper = true) | ||
public class BatchUserRequest extends UserRequest { | ||
String loginId; | ||
String password; | ||
BatchUserPasswordHashed hashedPassword; | ||
} |
38 changes: 28 additions & 10 deletions
38
src/main/java/com/descope/model/user/request/UserRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,53 @@ | ||
package com.descope.model.user.request; | ||
|
||
|
||
import static com.descope.utils.CollectionUtils.addIfNotNull; | ||
|
||
import com.descope.model.auth.AssociatedTenant; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@Builder | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UserRequest { | ||
String userId; | ||
String loginId; | ||
String email; | ||
Boolean verifiedEmail; | ||
String phone; | ||
Boolean verifiedPhone; | ||
String displayName; | ||
String givenName; | ||
String middleName; | ||
String familyName; | ||
List<String> roleNames; | ||
List<AssociatedTenant> userTenants; | ||
Map<String, Object> customAttributes; | ||
String picture; | ||
Boolean invite; | ||
Boolean test; | ||
String inviteUrl; | ||
Boolean sendEmail; | ||
@JsonProperty("sendSMS") | ||
Boolean sendSMS; | ||
List<String> additionalLoginIds; | ||
|
||
public Map<String, Object> toMap() { | ||
Map<String, Object> m = new HashMap<>(); | ||
addIfNotNull(m, "email", email); | ||
addIfNotNull(m, "verifiedEmail", verifiedEmail); | ||
addIfNotNull(m, "phone", phone); | ||
addIfNotNull(m, "verifiedPhone", verifiedPhone); | ||
addIfNotNull(m, "displayName", displayName); | ||
addIfNotNull(m, "givenName", givenName); | ||
addIfNotNull(m, "middleName", middleName); | ||
addIfNotNull(m, "familyName", familyName); | ||
addIfNotNull(m, "roleNames", roleNames); | ||
addIfNotNull(m, "userTenants", userTenants); | ||
addIfNotNull(m, "customAttributes", customAttributes); | ||
addIfNotNull(m, "picture", picture); | ||
addIfNotNull(m, "test", test); | ||
addIfNotNull(m, "additionalLoginIds", additionalLoginIds); | ||
return m; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/descope/model/user/response/UserFailedResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.descope.model.user.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UserFailedResponse { | ||
String failure; | ||
UserResponse user; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/descope/model/user/response/UsersBatchResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.descope.model.user.response; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UsersBatchResponse { | ||
private List<UserResponse> createdUsers; | ||
private List<UserFailedResponse> failedUsers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.