本文整理汇总了Java中com.nimbusds.jose.proc.BadJOSEException类的典型用法代码示例。如果您正苦于以下问题:Java BadJOSEException类的具体用法?Java BadJOSEException怎么用?Java BadJOSEException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BadJOSEException类属于com.nimbusds.jose.proc包,在下文中一共展示了BadJOSEException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validate
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的package包/类
@Override
public IDTokenClaimsSet validate(final JWT idToken, final Nonce expectedNonce) throws BadJOSEException, JOSEException {
try {
if (originalIssuer.contains("%7Btenantid%7D")) {
Object tid = idToken.getJWTClaimsSet().getClaim("tid");
if (tid == null) {
throw new BadJWTException("ID token does not contain the 'tid' claim");
}
base = new IDTokenValidator(new Issuer(originalIssuer.replace("%7Btenantid%7D", tid.toString())),
base.getClientID(), base.getJWSKeySelector(), base.getJWEKeySelector());
base.setMaxClockSkew(getMaxClockSkew());
}
} catch (ParseException e) {
throw new BadJWTException(e.getMessage(), e);
}
return base.validate(idToken, expectedNonce);
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:AzureAdIdTokenValidator.java
示例2: UserPrincipal
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的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: validateToken
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的package包/类
private IDTokenClaimsSet validateToken(OAuthProvider provider, OAuthLoginRequestDTO oAuthLoginRequestDTO) throws MalformedURLException, ParseException, BadJOSEException, JOSEException {
Issuer iss = new Issuer(provider.getIssuer());
ClientID clientID = new ClientID(provider.getClientID());
Nonce nonce = new Nonce(oAuthLoginRequestDTO.getNonce());
URL jwkSetURL = new URL(provider.getJwkSetURL());
JWSAlgorithm jwsAlg = JWSAlgorithm.parse(provider.getJwsAlgorithm());
IDTokenValidator validator = new IDTokenValidator(iss, clientID, jwsAlg, jwkSetURL);
JWT idToken = JWTParser.parse(oAuthLoginRequestDTO.getIdToken());
return validator.validate(idToken, nonce);
}
开发者ID:polarsys,项目名称:eplmp,代码行数:11,代码来源:AuthResource.java
示例4: process
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的package包/类
@Override
public JsonObject process(String jwt) throws JWTException {
try {
String rawJwt = delegate.process(jwt, null).toString();
return Json.createReader(new StringReader(rawJwt)).readObject();
} catch (ParseException | BadJOSEException | JOSEException e) {
throw new JWTException("Unable to parse jwt", e);
}
}
开发者ID:hammock-project,项目名称:hammock,代码行数:10,代码来源:DefaultValidatingJWTProcessor.java
示例5: whenSignedJWTWithoutMatchingKeyInAuthorizationHeaderProvidedParseExceptionOccurs
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的package包/类
@Test(expected = BadJOSEException.class)
public void whenSignedJWTWithoutMatchingKeyInAuthorizationHeaderProvidedParseExceptionOccurs() throws Exception {
request.addHeader("Authorization", newJwtToken(UNKNOWN_KID,"role1").serialize());
assertThat(awsCognitoIdTokenProcessor.getAuthentication(request)).isNull();
}
开发者ID:IxorTalk,项目名称:ixortalk.aws.cognito.jwt.security.filter,代码行数:6,代码来源:AwsCognitoIdTokenProcessorTest.java
示例6: create
import com.nimbusds.jose.proc.BadJOSEException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public U create(final OidcCredentials credentials, final WebContext context) throws HttpAction {
init(context);
final AccessToken accessToken = credentials.getAccessToken();
// Create profile
final U profile = getProfileFactory().get();
profile.setAccessToken(accessToken);
final JWT idToken = credentials.getIdToken();
profile.setIdTokenString(idToken.getParsedString());
// Check if there is a refresh token
final RefreshToken refreshToken = credentials.getRefreshToken();
if (refreshToken != null && !refreshToken.getValue().isEmpty()) {
profile.setRefreshToken(refreshToken);
logger.debug("Refresh Token successful retrieved");
}
try {
// check idToken
final Nonce nonce;
if (configuration.isUseNonce()) {
nonce = new Nonce((String) context.getSessionAttribute(OidcConfiguration.NONCE_SESSION_ATTRIBUTE));
} else {
nonce = null;
}
// Check ID Token
final IDTokenClaimsSet claimsSet = this.idTokenValidator.validate(idToken, nonce);
assertNotNull("claimsSet", claimsSet);
profile.setId(claimsSet.getSubject());
// User Info request
if (configuration.getProviderMetadata().getUserInfoEndpointURI() != null && accessToken != null) {
final UserInfoRequest userInfoRequest = new UserInfoRequest(configuration.getProviderMetadata().getUserInfoEndpointURI(), (BearerAccessToken) accessToken);
final HTTPRequest userInfoHttpRequest = userInfoRequest.toHTTPRequest();
userInfoHttpRequest.setConnectTimeout(configuration.getConnectTimeout());
userInfoHttpRequest.setReadTimeout(configuration.getReadTimeout());
final HTTPResponse httpResponse = userInfoHttpRequest.send();
logger.debug("Token response: status={}, content={}", httpResponse.getStatusCode(),
httpResponse.getContent());
final UserInfoResponse userInfoResponse = UserInfoResponse.parse(httpResponse);
if (userInfoResponse instanceof UserInfoErrorResponse) {
logger.error("Bad User Info response, error={}",
((UserInfoErrorResponse) userInfoResponse).getErrorObject());
} else {
final UserInfoSuccessResponse userInfoSuccessResponse = (UserInfoSuccessResponse) userInfoResponse;
final UserInfo userInfo = userInfoSuccessResponse.getUserInfo();
if (userInfo != null) {
profile.addAttributes(userInfo.toJWTClaimsSet().getClaims());
}
}
}
// add attributes of the ID token if they don't already exist
for (final Map.Entry<String, Object> entry : idToken.getJWTClaimsSet().getClaims().entrySet()) {
final String key = entry.getKey();
final Object value = entry.getValue();
if (profile.getAttribute(key) == null) {
profile.addAttribute(key, value);
}
}
return profile;
} catch (final IOException | ParseException | JOSEException | BadJOSEException | java.text.ParseException e) {
throw new TechnicalException(e);
}
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:72,代码来源:OidcProfileCreator.java
注:本文中的com.nimbusds.jose.proc.BadJOSEException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论