gluu
公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxd.server.service.PublicOpKeyService クラス
org.xdi.oxd.server.service.PublicOpKeyService 連携図
Collaboration graph

公開メンバ関数

 PublicOpKeyService (ConfigurationService configurationService)
 
RSAPublicKey getRSAPublicKey (String jwkSetUri, String keyId)
 
RSAPublicKey refetchKey (String jwkUrl, String kid)
 

非公開変数類

final Cache< Pair< String, String >, RSAPublicKeycache
 

静的非公開変数類

static final Logger LOG = LoggerFactory.getLogger(PublicOpKeyService.class)
 

詳解

著者
Yuriy Zabrovarnyy

構築子と解体子

◆ PublicOpKeyService()

org.xdi.oxd.server.service.PublicOpKeyService.PublicOpKeyService ( ConfigurationService  configurationService)
inline
29  {
30  this.cache = CacheBuilder.newBuilder()
31  .expireAfterWrite(configurationService.get().getPublicOpKeyCacheExpirationInMinutes(), TimeUnit.MINUTES)
32  .build();
33  }
final Cache< Pair< String, String >, RSAPublicKey > cache
Definition: PublicOpKeyService.java:26

関数詳解

◆ getRSAPublicKey()

RSAPublicKey org.xdi.oxd.server.service.PublicOpKeyService.getRSAPublicKey ( String  jwkSetUri,
String  keyId 
)
inline
36  {
37  try {
38  final Pair<String, String> mapKey = new Pair<>(jwkSetUri, keyId);
39 
40  RSAPublicKey cachedKey = cache.getIfPresent(mapKey);
41  if (cachedKey != null) {
42  LOG.debug("Taken public key from cache, mapKey: " + mapKey);
43  return cachedKey;
44  }
45 
46  RSAPublicKey publicKey = null;
47 
48  JwkClient jwkClient = new JwkClient(jwkSetUri);
49  jwkClient.setExecutor(new ApacheHttpClient4Executor(CoreUtils.createHttpClientTrustAll()));
50  JwkResponse jwkResponse = jwkClient.exec();
51  if (jwkResponse != null && jwkResponse.getStatus() == 200) {
52  PublicKey pk = jwkResponse.getPublicKey(keyId);
53  if (pk instanceof RSAPublicKey) {
54  publicKey = (RSAPublicKey) pk;
55  cache.put(mapKey, publicKey);
56  }
57  }
58 
59  return publicKey;
60  } catch (Exception e) {
61  LOG.error("Failed to fetch public key.", e);
62  throw new RuntimeException("Failed to fetch public key.", e);
63  }
64  }
final Cache< Pair< String, String >, RSAPublicKey > cache
Definition: PublicOpKeyService.java:26
static final Logger LOG
Definition: PublicOpKeyService.java:24

◆ refetchKey()

RSAPublicKey org.xdi.oxd.server.service.PublicOpKeyService.refetchKey ( String  jwkUrl,
String  kid 
)
inline
66  {
67  cache.invalidate(new Pair<>(jwkUrl, kid));
68  return getRSAPublicKey(jwkUrl, kid);
69  }
final Cache< Pair< String, String >, RSAPublicKey > cache
Definition: PublicOpKeyService.java:26
RSAPublicKey getRSAPublicKey(String jwkSetUri, String keyId)
Definition: PublicOpKeyService.java:36

メンバ詳解

◆ cache

final Cache<Pair<String, String>, RSAPublicKey> org.xdi.oxd.server.service.PublicOpKeyService.cache
private

◆ LOG

final Logger org.xdi.oxd.server.service.PublicOpKeyService.LOG = LoggerFactory.getLogger(PublicOpKeyService.class)
staticprivate

このクラス詳解は次のファイルから抽出されました: