keycloak
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.truststore.FileTruststoreProviderFactory クラス
org.keycloak.truststore.FileTruststoreProviderFactory の継承関係図
Inheritance graph
org.keycloak.truststore.FileTruststoreProviderFactory 連携図
Collaboration graph

公開メンバ関数

TruststoreProvider create (KeycloakSession session)
 
void init (Config.Scope config)
 
void postInit (KeycloakSessionFactory factory)
 
void close ()
 
String getId ()
 
default int order ()
 

非公開メンバ関数

KeyStore loadStore (String path, char[] password) throws Exception
 

非公開変数類

TruststoreProvider provider
 

静的非公開変数類

static final Logger log = Logger.getLogger(FileTruststoreProviderFactory.class)
 

詳解

著者
Marko Strukelj

関数詳解

◆ close()

void org.keycloak.truststore.FileTruststoreProviderFactory.close ( )
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

112  {
113  }

◆ create()

TruststoreProvider org.keycloak.truststore.FileTruststoreProviderFactory.create ( KeycloakSession  session)
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

41  {
42  return provider;
43  }
TruststoreProvider provider
Definition: FileTruststoreProviderFactory.java:38

◆ getId()

String org.keycloak.truststore.FileTruststoreProviderFactory.getId ( )
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

116  {
117  return "file";
118  }

◆ init()

void org.keycloak.truststore.FileTruststoreProviderFactory.init ( Config.Scope  config)
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

46  {
47 
48  String storepath = config.get("file");
49  String pass = config.get("password");
50  String policy = config.get("hostname-verification-policy");
51  Boolean disabled = config.getBoolean("disabled", null);
52 
53  // if "truststore" . "file" is not configured then it is disabled
54  if (storepath == null && pass == null && policy == null && disabled == null) {
55  return;
56  }
57 
58  // if explicitly disabled
59  if (disabled != null && disabled) {
60  return;
61  }
62 
63  HostnameVerificationPolicy verificationPolicy = null;
64  KeyStore truststore = null;
65 
66  if (storepath == null) {
67  throw new RuntimeException("Attribute 'file' missing in 'truststore':'file' configuration");
68  }
69  if (pass == null) {
70  throw new RuntimeException("Attribute 'password' missing in 'truststore':'file' configuration");
71  }
72 
73  try {
74  truststore = loadStore(storepath, pass == null ? null :pass.toCharArray());
75  } catch (Exception e) {
76  throw new RuntimeException("Failed to initialize TruststoreProviderFactory: " + new File(storepath).getAbsolutePath(), e);
77  }
78  if (policy == null) {
79  verificationPolicy = HostnameVerificationPolicy.WILDCARD;
80  } else {
81  try {
82  verificationPolicy = HostnameVerificationPolicy.valueOf(policy);
83  } catch (Exception e) {
84  throw new RuntimeException("Invalid value for 'hostname-verification-policy': " + policy + " (must be one of: ANY, WILDCARD, STRICT)");
85  }
86  }
87 
88  provider = new FileTruststoreProvider(truststore, verificationPolicy);
89  TruststoreProviderSingleton.set(provider);
90  log.debug("File trustore provider initialized: " + new File(storepath).getAbsolutePath());
91  }
TruststoreProvider provider
Definition: FileTruststoreProviderFactory.java:38
KeyStore loadStore(String path, char[] password)
Definition: FileTruststoreProviderFactory.java:93
static final Logger log
Definition: FileTruststoreProviderFactory.java:36

◆ loadStore()

KeyStore org.keycloak.truststore.FileTruststoreProviderFactory.loadStore ( String  path,
char []  password 
) throws Exception
inlineprivate
93  {
94  KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
95  InputStream is = new FileInputStream(path);
96  try {
97  ks.load(is, password);
98  return ks;
99  } finally {
100  try {
101  is.close();
102  } catch (IOException ignored) {
103  }
104  }
105  }

◆ order()

default int org.keycloak.provider.ProviderFactory< T extends Provider >.order ( )
inlineinherited

◆ postInit()

void org.keycloak.truststore.FileTruststoreProviderFactory.postInit ( KeycloakSessionFactory  factory)
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

108  {
109  }

メンバ詳解

◆ log

final Logger org.keycloak.truststore.FileTruststoreProviderFactory.log = Logger.getLogger(FileTruststoreProviderFactory.class)
staticprivate

◆ provider

TruststoreProvider org.keycloak.truststore.FileTruststoreProviderFactory.provider
private

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