use of org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer in project cxf by apache.
the class DefaultEHCacheOAuthDataProvider method getAccessToken.
@Override
public ServerAccessToken getAccessToken(String accessToken) throws OAuthServiceException {
ServerAccessToken at = null;
if (isUseJwtFormatForAccessTokens() && isStoreJwtTokenKeyOnly()) {
String jose = getCacheValue(accessTokenCache, accessToken, String.class);
if (jose != null) {
JoseJwtConsumer theConsumer = jwtTokenConsumer == null ? new JoseJwtConsumer() : jwtTokenConsumer;
at = JwtTokenUtils.createAccessTokenFromJwt(theConsumer, jose, this, super.getJwtAccessTokenClaimMap());
}
} else {
at = getCacheValue(accessTokenCache, accessToken, ServerAccessToken.class);
}
return at;
}
use of org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer in project cxf by apache.
the class JCacheOAuthDataProvider method getJwtAccessTokens.
protected List<ServerAccessToken> getJwtAccessTokens(Client client, UserSubject sub) {
final Set<String> toRemove = new HashSet<>();
final List<ServerAccessToken> tokens = new ArrayList<>();
for (Iterator<Cache.Entry<String, String>> it = jwtAccessTokenCache.iterator(); it.hasNext(); ) {
Cache.Entry<String, String> entry = it.next();
String jose = entry.getValue();
JoseJwtConsumer theConsumer = jwtTokenConsumer == null ? new JoseJwtConsumer() : jwtTokenConsumer;
ServerAccessToken token = JwtTokenUtils.createAccessTokenFromJwt(theConsumer, jose, this, super.getJwtAccessTokenClaimMap());
if (isExpired(token)) {
toRemove.add(entry.getKey());
} else if (isTokenMatched(token, client, sub)) {
tokens.add(token);
}
}
jwtAccessTokenCache.removeAll(toRemove);
return tokens;
}
use of org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer in project cxf by apache.
the class JCacheOAuthDataProvider method getJwtAccessToken.
protected ServerAccessToken getJwtAccessToken(String key) {
String jose = jwtAccessTokenCache.get(key);
ServerAccessToken token = null;
if (jose != null) {
JoseJwtConsumer theConsumer = jwtTokenConsumer == null ? new JoseJwtConsumer() : jwtTokenConsumer;
token = JwtTokenUtils.createAccessTokenFromJwt(theConsumer, jose, this, super.getJwtAccessTokenClaimMap());
if (isExpired(token)) {
jwtAccessTokenCache.remove(key);
token = null;
}
}
return token;
}
Aggregations