keycloak
クラス | 公開メンバ関数 | 静的公開メンバ関数 | 非公開メンバ関数 | 静的非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.storage.ldap.LDAPIdentityStoreRegistry クラス
org.keycloak.storage.ldap.LDAPIdentityStoreRegistry 連携図
Collaboration graph

クラス

class  LDAPIdentityStoreContext
 

公開メンバ関数

LDAPIdentityStore getLdapStore (KeycloakSession session, ComponentModel ldapModel, Map< ComponentModel, LDAPConfigDecorator > configDecorators)
 

静的公開メンバ関数

static LDAPIdentityStore createLdapIdentityStore (LDAPConfig cfg)
 

非公開メンバ関数

void logLDAPConfig (KeycloakSession session, ComponentModel ldapModel, LDAPConfig ldapConfig)
 

静的非公開メンバ関数

static void checkSystemProperty (String name, String cfgValue, String defaultValue)
 

非公開変数類

Map< String, LDAPIdentityStoreContextldapStores = new ConcurrentHashMap<>()
 

静的非公開変数類

static final Logger logger = Logger.getLogger(LDAPIdentityStoreRegistry.class)
 

詳解

著者
Marek Posolda

関数詳解

◆ checkSystemProperty()

static void org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.checkSystemProperty ( String  name,
String  cfgValue,
String  defaultValue 
)
inlinestaticprivate
95  {
96  String value = System.getProperty(name);
97  if(cfgValue != null) {
98  value = cfgValue;
99  }
100  if(value == null) {
101  value = defaultValue;
102  }
103  System.setProperty(name, value);
104  }

◆ createLdapIdentityStore()

static LDAPIdentityStore org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.createLdapIdentityStore ( LDAPConfig  cfg)
inlinestatic

Create LDAPIdentityStore to be cached in the local registry

83  {
84  checkSystemProperty("com.sun.jndi.ldap.connect.pool.authentication", cfg.getConnectionPoolingAuthentication(), "none simple");
85  checkSystemProperty("com.sun.jndi.ldap.connect.pool.initsize", cfg.getConnectionPoolingInitSize(), "1");
86  checkSystemProperty("com.sun.jndi.ldap.connect.pool.maxsize", cfg.getConnectionPoolingMaxSize(), "1000");
87  checkSystemProperty("com.sun.jndi.ldap.connect.pool.prefsize", cfg.getConnectionPoolingPrefSize(), "5");
88  checkSystemProperty("com.sun.jndi.ldap.connect.pool.timeout", cfg.getConnectionPoolingTimeout(), "300000");
89  checkSystemProperty("com.sun.jndi.ldap.connect.pool.protocol", cfg.getConnectionPoolingProtocol(), "plain");
90  checkSystemProperty("com.sun.jndi.ldap.connect.pool.debug", cfg.getConnectionPoolingDebug(), "off");
91 
92  return new LDAPIdentityStore(cfg);
93  }
static void checkSystemProperty(String name, String cfgValue, String defaultValue)
Definition: LDAPIdentityStoreRegistry.java:95

◆ getLdapStore()

LDAPIdentityStore org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.getLdapStore ( KeycloakSession  session,
ComponentModel  ldapModel,
Map< ComponentModel, LDAPConfigDecorator configDecorators 
)
inline
42  {
43  LDAPIdentityStoreContext context = ldapStores.get(ldapModel.getId());
44 
45  // Ldap config might have changed for the realm. In this case, we must re-initialize
46  MultivaluedHashMap<String, String> configModel = ldapModel.getConfig();
47  LDAPConfig ldapConfig = new LDAPConfig(configModel);
48  for (Map.Entry<ComponentModel, LDAPConfigDecorator> entry : configDecorators.entrySet()) {
49  ComponentModel mapperModel = entry.getKey();
50  LDAPConfigDecorator decorator = entry.getValue();
51 
52  decorator.updateLDAPConfig(ldapConfig, mapperModel);
53  }
54 
55  if (context == null || !ldapConfig.equals(context.config)) {
56  logLDAPConfig(session, ldapModel, ldapConfig);
57 
58  LDAPIdentityStore store = createLdapIdentityStore(ldapConfig);
59  context = new LDAPIdentityStoreContext(ldapConfig, store);
60  ldapStores.put(ldapModel.getId(), context);
61  }
62  return context.store;
63  }
static LDAPIdentityStore createLdapIdentityStore(LDAPConfig cfg)
Definition: LDAPIdentityStoreRegistry.java:83
void logLDAPConfig(KeycloakSession session, ComponentModel ldapModel, LDAPConfig ldapConfig)
Definition: LDAPIdentityStoreRegistry.java:66
Map< String, LDAPIdentityStoreContext > ldapStores
Definition: LDAPIdentityStoreRegistry.java:40

◆ logLDAPConfig()

void org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.logLDAPConfig ( KeycloakSession  session,
ComponentModel  ldapModel,
LDAPConfig  ldapConfig 
)
inlineprivate
66  {
67  logger.infof("Creating new LDAP Store for the LDAP storage provider: '%s', LDAP Configuration: %s", ldapModel.getName(), ldapConfig.toString());
68 
69  if (logger.isDebugEnabled()) {
70  RealmModel realm = session.realms().getRealm(ldapModel.getParentId());
71  List<ComponentModel> mappers = realm.getComponents(ldapModel.getId());
72  mappers.stream().forEach((ComponentModel c) -> {
73 
74  logger.debugf("Mapper for provider: %s, Mapper name: %s, Provider: %s, Mapper configuration: %s", ldapModel.getName(), c.getName(), c.getProviderId(), c.getConfig().toString());
75 
76  });
77  }
78  }
static final Logger logger
Definition: LDAPIdentityStoreRegistry.java:38

メンバ詳解

◆ ldapStores

Map<String, LDAPIdentityStoreContext> org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.ldapStores = new ConcurrentHashMap<>()
private

◆ logger

final Logger org.keycloak.storage.ldap.LDAPIdentityStoreRegistry.logger = Logger.getLogger(LDAPIdentityStoreRegistry.class)
staticprivate

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