Skip to content

Commit 2ec1fad

Browse files
author
Justin Dahmubed
committed
Extended jwt
1 parent 7dcea42 commit 2ec1fad

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.auth0.jwt;
2+
3+
import com.auth0.jwt.algorithms.Algorithm;
4+
import com.auth0.jwt.interfaces.GoogleVerification;
5+
import com.auth0.jwt.interfaces.Verification;
6+
7+
import java.util.Date;
8+
import java.util.List;
9+
10+
public class ExtendedJWT extends GoogleJWT implements GoogleVerification{
11+
12+
ExtendedJWT(Algorithm algorithm) throws IllegalArgumentException {
13+
super(algorithm);
14+
}
15+
16+
17+
public Verification createVerifierForExtended(String picture, String email, List<String> issuer,
18+
List<String> audience, String name, long nbf, long expLeeway, long iatLeeway) {
19+
Verification verification = createVerifierForGoogle(picture, email, issuer, audience, name, expLeeway, iatLeeway);
20+
return verification.withNbf(nbf);
21+
}
22+
23+
public static GoogleVerification require(Algorithm algorithm) {
24+
return ExtendedJWT.init(algorithm);
25+
}
26+
27+
static GoogleVerification init(Algorithm algorithm) throws IllegalArgumentException {
28+
return new ExtendedJWT(algorithm);
29+
}
30+
31+
/**
32+
* Require a specific Not Before ("nbf") claim.
33+
*
34+
* @param nbf the required Not Before value
35+
* @return this same Verification instance.
36+
*/
37+
@Override
38+
public Verification withNbf(long nbf) {
39+
requireClaim("nbf", nbf);
40+
return this;
41+
}
42+
43+
}

0 commit comments

Comments
 (0)