本文整理汇总了Java中com.nimbusds.jwt.proc.ConfigurableJWTProcessor类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableJWTProcessor类的具体用法?Java ConfigurableJWTProcessor怎么用?Java ConfigurableJWTProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableJWTProcessor类属于com.nimbusds.jwt.proc包,在下文中一共展示了ConfigurableJWTProcessor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAadJwtTokenValidator
import com.nimbusds.jwt.proc.ConfigurableJWTProcessor; //导入依赖的package包/类
private ConfigurableJWTProcessor<SecurityContext> getAadJwtTokenValidator()
throws MalformedURLException {
final ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>();
final JWKSource<SecurityContext> keySource = new RemoteJWKSet<>(
new URL(KEY_DISCOVERY_URI));
final JWSAlgorithm expectedJWSAlg = JWSAlgorithm.RS256;
final JWSKeySelector<SecurityContext> keySelector = new JWSVerificationKeySelector<>(expectedJWSAlg, keySource);
jwtProcessor.setJWSKeySelector(keySelector);
jwtProcessor.setJWTClaimsSetVerifier(new DefaultJWTClaimsVerifier<SecurityContext>() {
@Override
public void verify(JWTClaimsSet claimsSet, SecurityContext ctx) throws BadJWTException {
super.verify(claimsSet, ctx);
final String issuer = claimsSet.getIssuer();
if (issuer == null || !issuer.contains("https://sts.windows.net/")) {
throw new BadJWTException("Invalid token issuer");
}
}
});
return jwtProcessor;
}
开发者ID:Microsoft,项目名称:azure-spring-boot,代码行数:22,代码来源:UserPrincipal.java
示例2: UserPrincipal
import com.nimbusds.jwt.proc.ConfigurableJWTProcessor; //导入依赖的package包/类
public UserPrincipal(String idToken) throws MalformedURLException, ParseException,
BadJOSEException, JOSEException {
final ConfigurableJWTProcessor<SecurityContext> validator = getAadJwtTokenValidator();
jwtClaimsSet = validator.process(idToken, null);
final JWTClaimsSetVerifier<SecurityContext> verifier = validator
.getJWTClaimsSetVerifier();
verifier.verify(jwtClaimsSet, null);
jwsObject = JWSObject.parse(idToken);
userGroups = null;
}
开发者ID:Microsoft,项目名称:azure-spring-boot,代码行数:11,代码来源:UserPrincipal.java
示例3: configurableJWTProcessor
import com.nimbusds.jwt.proc.ConfigurableJWTProcessor; //导入依赖的package包/类
@Bean
public ConfigurableJWTProcessor configurableJWTProcessor() throws MalformedURLException {
ResourceRetriever resourceRetriever = new DefaultResourceRetriever(jwtConfiguration.getConnectionTimeout(), jwtConfiguration.getReadTimeout());
URL jwkSetURL = new URL(jwtConfiguration.getJwkUrl());
JWKSource keySource = new RemoteJWKSet(jwkSetURL, resourceRetriever);
ConfigurableJWTProcessor jwtProcessor = new DefaultJWTProcessor();
JWSKeySelector keySelector = new JWSVerificationKeySelector(RS256, keySource);
jwtProcessor.setJWSKeySelector(keySelector);
return jwtProcessor;
}
开发者ID:IxorTalk,项目名称:ixortalk.aws.cognito.jwt.security.filter,代码行数:11,代码来源:JwtAutoConfiguration.java
注:本文中的com.nimbusds.jwt.proc.ConfigurableJWTProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论