当前位置: 首页>>代码示例>>Java>>正文


Java DecodedJWT.getClaims方法代码示例

本文整理汇总了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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:22,代码来源:ExtendedJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:17,代码来源:ImplicitJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:19,代码来源:RiscJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:22,代码来源:GoogleJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:17,代码来源:AccessJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:17,代码来源:FbJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:17,代码来源:ImplicitJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:18,代码来源:FbJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:19,代码来源:RiscJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:19,代码来源:ScopedJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:19,代码来源:ScopedJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:22,代码来源:GoogleJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:18,代码来源:ScopedJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:18,代码来源:AccessJwtCreatorTest.java

示例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);
}
 
开发者ID:GJWT,项目名称:javaOIDCMsg,代码行数:21,代码来源:GoogleJwtCreatorTest.java


注:本文中的com.auth0.jwt.interfaces.DecodedJWT.getClaims方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。