本文整理汇总了Java中com.auth0.jwt.interfaces.DecodedJWT.getClaims方法的典型用法代码示例。如果您正苦于以下问题:Java DecodedJWT.getClaims方法的具体用法?Java DecodedJWT.getClaims怎么用?Java DecodedJWT.getClaims使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.auth0.jwt.interfaces.DecodedJWT
的用法示例。
在下文中一共展示了DecodedJWT.getClaims方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExtendedJwtCreatorBase16Encoding
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testExtendedJwtCreatorBase16Encoding() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ExtendedJwtCreator.build()
.withNbf(nbf) //this must be called first since ExtendedJwtCreator.build() returns an instance of ExtendedJwtCreator
.withPicture(PICTURE)
.withEmail(EMAIL)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.withName(NAME)
.signBase16Encoding(algorithm);
GoogleVerification verification = ExtendedJWT.require(algorithm);
JWT verifier = verification.createVerifierForExtended(PICTURE, EMAIL, asList("issuer"), asList("audience"),
NAME, 1, 1, 1).build();
DecodedJWT jwt = verifier.decode16Bytes(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例2: testImplicitJwtCreatorNonStandardClaimDoubleValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testImplicitJwtCreatorNonStandardClaimDoubleValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ImplicitJwtCreator.build()
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withIat(TimeUtil.generateRandomIatDateInPast())
.withNonStandardClaim("nonStandardClaim", 9.99)
.sign(algorithm);
Verification verification = ImplicitJWT.require(algorithm);
JWT verifier = verification.createVerifierForImplicit(asList("issuer"), asList("audience"), 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims);
}
示例3: testRiscJwtCreatorNonStandardClaimLongValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testRiscJwtCreatorNonStandardClaimLongValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = RiscJwtCreator.build()
.withJWTId(jti)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withNonStandardClaim("nonStandardClaim", 999L)
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = RiscJWT.require(algorithm);
JWT verifier = verification.createVerifierForRisc(jti, asList("issuer"), asList("audience"), 1, 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例4: testGoogleJwtCreatorNonStandardClaimLong
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testGoogleJwtCreatorNonStandardClaimLong() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = GoogleJwtCreator.build()
.withPicture(PICTURE)
.withEmail(EMAIL)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.withName(NAME)
.withNonStandardClaim("nonStandardClaim", 999L)
.sign(algorithm);
GoogleVerification verification = GoogleJWT.require(algorithm);
JWT verifier = verification.createVerifierForGoogle(PICTURE, EMAIL, asList("issuer"), asList("audience"),
NAME, 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例5: testAccessJwtCreatorBase32Encoding
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testAccessJwtCreatorBase32Encoding() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = AccessJwtCreator.build()
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.signBase32Encoding(algorithm);
Verification verification = AccessJWT.require(algorithm);
JWT verifier = verification.createVerifierForAccess(asList("issuer"), asList("audience"), 1, 1).build();
DecodedJWT jwt = verifier.decode32Bytes(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例6: testFbJwtCreatorNoneAlgorithmAllowed
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testFbJwtCreatorNoneAlgorithmAllowed() throws Exception {
Algorithm algorithm = Algorithm.none();
String token = FbJwtCreator.build()
.withExp(exp)
.withIat(iat)
.withUserId(USER_ID)
.withAppId(APP_ID)
.setIsNoneAlgorithmAllowed(true)
.sign(algorithm);
Verification verification = FbJWT.require(algorithm);
JWT verifier = verification.createVerifierForFb(USER_ID, APP_ID).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims);
}
示例7: testImplicitJwtCreatorNonStandardClaimIntegerValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testImplicitJwtCreatorNonStandardClaimIntegerValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ImplicitJwtCreator.build()
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withIat(TimeUtil.generateRandomIatDateInPast())
.withNonStandardClaim("nonStandardClaim", 999)
.sign(algorithm);
Verification verification = ImplicitJWT.require(algorithm);
JWT verifier = verification.createVerifierForImplicit(asList("issuer"), asList("audience"), 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims);
}
示例8: testFbJwtCreatorNonStandardClaimStringValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testFbJwtCreatorNonStandardClaimStringValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = FbJwtCreator.build()
.withExp(exp)
.withIat(iat)
.withUserId(USER_ID)
.withAppId(APP_ID)
.setIsNoneAlgorithmAllowed(true)
.withNonStandardClaim("nonStandardClaim", "nonStandardClaimValue")
.sign(algorithm);
Verification verification = FbJWT.require(algorithm);
JWT verifier = verification.createVerifierForFb(USER_ID, APP_ID).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims);
}
示例9: testRiscJwtCreatorAllStandardClaimsMustBeRequired
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testRiscJwtCreatorAllStandardClaimsMustBeRequired() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = RiscJwtCreator.build()
.withJWTId(jti)
.withNbf(nbf)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = RiscJWT.require(algorithm);
JWT verifier = verification.createVerifierForRisc(jti, asList("issuer"), asList("audience"), 1, 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例10: testScopedJwtCreatorNonStandardClaimDoubleValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testScopedJwtCreatorNonStandardClaimDoubleValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ScopedJwtCreator.build()
.withScope("scope")
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withNonStandardClaim("nonStandardClaim", 9.99)
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = ScopedJWT.require(algorithm);
JWT verifier = verification.createVerifierForScoped("scope", asList("issuer"), asList("audience"), 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例11: testScopedJwtCreatorArrayClaim
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testScopedJwtCreatorArrayClaim() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ScopedJwtCreator.build()
.withScope("scope")
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withArrayClaim("arrayKey", "arrayValue1", "arrayValue2")
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = ScopedJWT.require(algorithm);
JWT verifier = verification.createVerifierForScoped("scope", asList("issuer"), asList("audience"), 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例12: testGoogleJwtCreatorNonStandardClaimDate
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testGoogleJwtCreatorNonStandardClaimDate() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = GoogleJwtCreator.build()
.withPicture(PICTURE)
.withEmail(EMAIL)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.withName(NAME)
.withNonStandardClaim("nonStandardClaim", new Date())
.sign(algorithm);
GoogleVerification verification = GoogleJWT.require(algorithm);
JWT verifier = verification.createVerifierForGoogle(PICTURE, EMAIL, asList("issuer"), asList("audience"),
NAME, 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例13: testScopedJwtCreatorAllStandardClaimsMustBeRequired
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testScopedJwtCreatorAllStandardClaimsMustBeRequired() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = ScopedJwtCreator.build()
.withScope("scope")
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = ScopedJWT.require(algorithm);
JWT verifier = verification.createVerifierForScoped("scope", asList("issuer"), asList("audience"), 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例14: testAccessJwtCreatorNonStandardClaimDoubleValue
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testAccessJwtCreatorNonStandardClaimDoubleValue() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = AccessJwtCreator.build()
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withNonStandardClaim("nonStandardClaim", 9.99)
.withExp(exp)
.withIat(iat)
.sign(algorithm);
Verification verification = AccessJWT.require(algorithm);
JWT verifier = verification.createVerifierForAccess(asList("issuer"), asList("audience"), 1, 1).build();
DecodedJWT jwt = verifier.decode(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}
示例15: testGoogleJwtCreatorBase32Encoding
import com.auth0.jwt.interfaces.DecodedJWT; //导入方法依赖的package包/类
@Test
public void testGoogleJwtCreatorBase32Encoding() throws Exception {
Algorithm algorithm = Algorithm.HMAC256("secret");
String token = GoogleJwtCreator.build()
.withPicture(PICTURE)
.withEmail(EMAIL)
.withIssuer("issuer")
.withSubject("subject")
.withAudience("audience")
.withExp(exp)
.withIat(iat)
.withName(NAME)
.signBase32Encoding(algorithm);
GoogleVerification verification = GoogleJWT.require(algorithm);
JWT verifier = verification.createVerifierForGoogle(PICTURE, EMAIL, asList("issuer"), asList("audience"),
NAME, 1, 1).build();
DecodedJWT jwt = verifier.decode32Bytes(token);
Map<String, Claim> claims = jwt.getClaims();
verifyClaims(claims, exp);
}