Java源码示例:org.keycloak.provider.Provider
示例1
@SuppressWarnings("unchecked")
public <T extends Provider> T getProvider(Class<T> clazz, String id) {
Integer hash = clazz.hashCode() + id.hashCode();
T provider = (T) providers.get(hash);
// KEYCLOAK-11890 - Avoid using HashMap.computeIfAbsent() to implement logic in outer if() block below,
// since per JDK-8071667 the remapping function should not modify the map during computation. While
// allowed on JDK 1.8, attempt of such a modification throws ConcurrentModificationException with JDK 9+
if (provider == null) {
ProviderFactory<T> providerFactory = factory.getProviderFactory(clazz, id);
if (providerFactory != null) {
provider = providerFactory.create(DefaultKeycloakSession.this);
providers.put(hash, provider);
}
}
return provider;
}
示例2
@SuppressWarnings("unchecked")
public <T extends Provider> T getProvider(Class<T> clazz) {
Integer hash = clazz.hashCode();
T provider = (T) providers.get(hash);
// KEYCLOAK-11890 - Avoid using HashMap.computeIfAbsent() to implement logic in outer if() block below,
// since per JDK-8071667 the remapping function should not modify the map during computation. While
// allowed on JDK 1.8, attempt of such a modification throws ConcurrentModificationException with JDK 9+
if (provider == null) {
ProviderFactory<T> providerFactory = factory.getProviderFactory(clazz);
if (providerFactory != null) {
provider = providerFactory.create(DefaultKeycloakSession.this);
providers.put(hash, provider);
}
}
return provider;
}
示例3
@Override
public <T extends Provider> T getProvider(Class<T> clazz, ComponentModel componentModel) {
String modelId = componentModel.getId();
Object found = getAttribute(modelId);
if (found != null) {
return clazz.cast(found);
}
ProviderFactory<T> providerFactory = factory.getProviderFactory(clazz, componentModel.getProviderId());
if (providerFactory == null) {
return null;
}
@SuppressWarnings("unchecked")
ComponentFactory<T, T> componentFactory = (ComponentFactory<T, T>) providerFactory;
T provider = componentFactory.create(this, componentModel);
enlistForClose(provider);
setAttribute(modelId, provider);
return provider;
}
示例4
private static ComponentFactory getComponentFactory(KeycloakSession session, String providerType, String providerId) {
Class<? extends Provider> provider = session.getProviderClass(providerType);
if (provider == null) {
throw new IllegalArgumentException("Invalid provider type '" + providerType + "'");
}
ProviderFactory<? extends Provider> f = session.getKeycloakSessionFactory().getProviderFactory(provider, providerId);
if (f == null) {
throw new IllegalArgumentException("No such provider '" + providerId + "'");
}
ComponentFactory cf = (ComponentFactory) f;
return cf;
}
示例5
Class<? extends Provider> getProviderClass(String providerClassName) {
for (Class<? extends Provider> clazz : factoriesMap.keySet()) {
if (clazz.getName().equals(providerClassName)) {
return clazz;
}
}
return null;
}
示例6
protected Map<Class<? extends Provider>, Map<String, ProviderFactory>> getFactoriesCopy() {
Map<Class<? extends Provider>, Map<String, ProviderFactory>> copy = new HashMap<>();
for (Map.Entry<Class<? extends Provider>, Map<String, ProviderFactory>> entry : factoriesMap.entrySet()) {
Map<String, ProviderFactory> valCopy = new HashMap<>();
valCopy.putAll(entry.getValue());
copy.put(entry.getKey(), valCopy);
}
return copy;
}
示例7
@Override
public Class<? extends Provider> getProviderClass() {
return MetricsEventListener.class;
}
示例8
@Override
public Class<? extends Provider> getProviderClass() {
return HealthIndicator.class;
}
示例9
@Override
public Class<? extends Provider> getProviderClass() {
return ClientValidationProvider.class;
}
示例10
@Override
public Class<? extends Provider> getProviderClass() {
return EmailTemplateProvider.class;
}
示例11
@Override
public <T extends Provider> ProviderFactory<T> getProviderFactory(Class<T> clazz) {
return getProviderFactory(clazz, provider.get(clazz));
}
示例12
@Override
public <T extends Provider> Set<T> getAllProviders(Class<T> clazz) {
return listProviderIds(clazz).stream()
.map(id -> getProvider(clazz, id))
.collect(Collectors.toSet());
}
示例13
@Override
public Class<? extends Provider> getProviderClass() {
return TokenIntrospectionProvider.class;
}
示例14
@Override
public Class<? extends Provider> getProviderClass() {
return ProtocolMapper.class;
}
示例15
@Override
public Class<? extends Provider> getProviderClass() {
return LoginProtocol.class;
}
示例16
@Override
public Class<? extends Provider> getProviderClass() {
return ClientInstallationProvider.class;
}
示例17
@Override
public Class<? extends Provider> getProviderClass() {
return ScriptingProvider.class;
}
示例18
@Override
public Class<? extends Provider> getProviderClass() {
return AccountProvider.class;
}
示例19
@Override
public Class<? extends Provider> getProviderClass() {
return HttpClientProvider.class;
}
示例20
@Override
public Class<? extends Provider> getProviderClass() {
return FormAuthenticator.class;
}
示例21
@Override
public Class<? extends Provider> getProviderClass() {
return FormAction.class;
}
示例22
@Override
public Class<? extends Provider> getProviderClass() {
return Authenticator.class;
}
示例23
@Override
public Class<? extends Provider> getProviderClass() {
return RequiredActionProvider.class;
}
示例24
@Override
public Class<? extends Provider> getProviderClass() {
return ClientAuthenticator.class;
}
示例25
@Override
public Class<? extends Provider> getProviderClass() {
return WellKnownProvider.class;
}
示例26
@Override
public void enlistForClose(Provider provider) {
closable.add(provider);
}
示例27
@Override
public Class<? extends Provider> getProviderClass() {
return AuthenticationSessionProvider.class;
}
示例28
@Override
public Class<? extends Provider> getProviderClass() {
return VaultProvider.class;
}
示例29
@Override
public Class<? extends Provider> getProviderClass() {
return ClientDescriptionConverter.class;
}
示例30
@Override
public Class<? extends Provider> getProviderClass() {
return UserSessionProvider.class;
}