Skip to content

Commit 43728c2

Browse files
authored
ADjust SDK to new format of password migration (#177)
* ADjust SDK to new format of password migration fix relevant test as well * Add missing files
1 parent 018b861 commit 43728c2

11 files changed

Lines changed: 126 additions & 30 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.descope</groupId>
55
<artifactId>java-sdk</artifactId>
66
<modelVersion>4.0.0</modelVersion>
7-
<version>1.0.33</version>
7+
<version>1.0.34</version>
88
<name>${project.groupId}:${project.artifactId}</name>
99
<description>Java library used to integrate with Descope.</description>
1010
<url>https://github.com/descope/descope-java</url>

src/main/java/com/descope/enums/BatchUserPasswordAlgorithm.java

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordArgon2 {
13+
byte[] hash; // the hash in raw bytes (base64 strings should be decoded first)
14+
byte[] salt; // the salt in raw bytes (base64 strings should be decoded first)
15+
int iterations; // the memory cost value (usually between 1 to 10)
16+
int memory; // the memory cost value in kilobytes (usually between 1,000 to 1,000,000)
17+
int threads; // the threads cost value (usually between 1 to 10)
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordBcrypt {
13+
String hash;
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordDjango {
13+
String hash; // the django hash in plaintext format, for example "pbkdf2_sha256$..."
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordFirebase {
13+
byte[] hash; // the hash in raw bytes (base64 strings should be decoded first)
14+
byte[] salt; // the salt in raw bytes (base64 strings should be decoded first)
15+
byte[] saltSeparator; // the salt separator (usually 1 byte long)
16+
byte[] signerKey; // the signer key (base64 strings should be decoded first)
17+
int memory; // the memory cost value (usually between 12 to 17)
18+
int rounds; // the rounds cost value (usually between 6 to 10)
19+
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.descope.model.user.request;
22

3-
import com.descope.enums.BatchUserPasswordAlgorithm;
43
import lombok.AllArgsConstructor;
54
import lombok.Builder;
65
import lombok.Data;
@@ -11,8 +10,11 @@
1110
@NoArgsConstructor
1211
@AllArgsConstructor
1312
public class BatchUserPasswordHashed {
14-
BatchUserPasswordAlgorithm algorithm;
15-
byte[] hash;
16-
byte[] salt;
17-
int iterations;
13+
BatchUserPasswordBcrypt bcrypt;
14+
BatchUserPasswordFirebase firebase;
15+
BatchUserPasswordPbkdf2 pbkdf2;
16+
BatchUserPasswordDjango django;
17+
BatchUserPasswordPhpass phpass;
18+
BatchUserPasswordMd5 md5;
19+
BatchUserPasswordArgon2 argon2;
1820
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordMd5 {
13+
String hash; // the md5 hash in plaintext format, for example "68f724c9ad..."
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordPbkdf2 {
13+
byte[] hash; // the hash in raw bytes (base64 strings should be decoded first)
14+
byte[] salt; // the salt in raw bytes (base64 strings should be decoded first)
15+
int iterations; // the iterations cost value (usually in the thousands)
16+
String type; // the hash name (sha1, sha256, sha512)
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.descope.model.user.request;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Data
9+
@Builder
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class BatchUserPasswordPhpass {
13+
String hash; // the hash as base64 encoded string with . and / characters
14+
String salt; // the salt as base64 encoded string with . and / characters
15+
int iterations; // the iterations cost value (usually in the tens of thousands)
16+
String type; // the hash name (md5, sha512)
17+
}

0 commit comments

Comments
 (0)