keycloak-service
公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.keycloak.truststore.JSSETruststoreConfigurator クラス
org.keycloak.truststore.JSSETruststoreConfigurator 連携図
Collaboration graph

公開メンバ関数

 JSSETruststoreConfigurator (KeycloakSession session)
 
 JSSETruststoreConfigurator (TruststoreProvider provider)
 
javax.net.ssl.SSLSocketFactory getSSLSocketFactory ()
 
TrustManager [] getTrustManagers ()
 
HostnameVerifier getHostnameVerifier ()
 
TruststoreProvider getProvider ()
 

非公開変数類

TruststoreProvider provider
 
volatile javax.net.ssl.SSLSocketFactory sslFactory
 
volatile TrustManager [] tm
 

詳解

著者
Marko Strukelj

構築子と解体子

◆ JSSETruststoreConfigurator() [1/2]

org.keycloak.truststore.JSSETruststoreConfigurator.JSSETruststoreConfigurator ( KeycloakSession  session)
inline
40  {
41  KeycloakSessionFactory factory = session.getKeycloakSessionFactory();
42  TruststoreProviderFactory truststoreFactory = (TruststoreProviderFactory) factory.getProviderFactory(TruststoreProvider.class, "file");
43 
44  provider = truststoreFactory.create(session);
45  if (provider != null && provider.getTruststore() == null) {
46  provider = null;
47  }
48  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36

◆ JSSETruststoreConfigurator() [2/2]

org.keycloak.truststore.JSSETruststoreConfigurator.JSSETruststoreConfigurator ( TruststoreProvider  provider)
inline
50  {
51  this.provider = provider;
52  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36

関数詳解

◆ getHostnameVerifier()

HostnameVerifier org.keycloak.truststore.JSSETruststoreConfigurator.getHostnameVerifier ( )
inline
97  {
98  if (provider == null) {
99  return null;
100  }
101 
102  HostnameVerificationPolicy policy = provider.getPolicy();
103  switch (policy) {
104  case ANY:
105  return new HostnameVerifier() {
106  @Override
107  public boolean verify(String s, SSLSession sslSession) {
108  return true;
109  }
110  };
111  case WILDCARD:
112  return new BrowserCompatHostnameVerifier();
113  case STRICT:
114  return new StrictHostnameVerifier();
115  default:
116  throw new IllegalStateException("Unknown policy: " + policy.name());
117  }
118  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36

◆ getProvider()

TruststoreProvider org.keycloak.truststore.JSSETruststoreConfigurator.getProvider ( )
inline
120  {
121  return provider;
122  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36

◆ getSSLSocketFactory()

javax.net.ssl.SSLSocketFactory org.keycloak.truststore.JSSETruststoreConfigurator.getSSLSocketFactory ( )
inline
54  {
55  if (provider == null) {
56  return null;
57  }
58 
59  if (sslFactory == null) {
60  synchronized(this) {
61  if (sslFactory == null) {
62  try {
63  SSLContext sslctx = SSLContext.getInstance("TLS");
64  sslctx.init(null, getTrustManagers(), null);
65  sslFactory = sslctx.getSocketFactory();
66  } catch (Exception e) {
67  throw new RuntimeException("Failed to initialize SSLContext: ", e);
68  }
69  }
70  }
71  }
72  return sslFactory;
73  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36
TrustManager [] getTrustManagers()
Definition: JSSETruststoreConfigurator.java:75
volatile javax.net.ssl.SSLSocketFactory sslFactory
Definition: JSSETruststoreConfigurator.java:37

◆ getTrustManagers()

TrustManager [] org.keycloak.truststore.JSSETruststoreConfigurator.getTrustManagers ( )
inline
75  {
76  if (provider == null) {
77  return null;
78  }
79 
80  if (tm == null) {
81  synchronized (this) {
82  if (tm == null) {
83  TrustManagerFactory tmf = null;
84  try {
85  tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
86  tmf.init(provider.getTruststore());
87  tm = tmf.getTrustManagers();
88  } catch (Exception e) {
89  throw new RuntimeException("Failed to initialize TrustManager: ", e);
90  }
91  }
92  }
93  }
94  return tm;
95  }
TruststoreProvider provider
Definition: JSSETruststoreConfigurator.java:36
volatile TrustManager [] tm
Definition: JSSETruststoreConfigurator.java:38

メンバ詳解

◆ provider

TruststoreProvider org.keycloak.truststore.JSSETruststoreConfigurator.provider
private

◆ sslFactory

volatile javax.net.ssl.SSLSocketFactory org.keycloak.truststore.JSSETruststoreConfigurator.sslFactory
private

◆ tm

volatile TrustManager [] org.keycloak.truststore.JSSETruststoreConfigurator.tm
private

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