parent
ce80c2b4f4
commit
fc9e9e6fda
6 changed files with 74 additions and 29 deletions
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.keycloak.config;
|
package org.keycloak.config;
|
||||||
|
|
||||||
|
import static java.util.function.Predicate.not;
|
||||||
|
|
||||||
import org.keycloak.models.map.storage.hotRod.common.AutogeneratedHotRodDescriptors;
|
import org.keycloak.models.map.storage.hotRod.common.AutogeneratedHotRodDescriptors;
|
||||||
import org.keycloak.models.map.storage.hotRod.common.HotRodEntityDescriptor;
|
import org.keycloak.models.map.storage.hotRod.common.HotRodEntityDescriptor;
|
||||||
|
|
||||||
|
@ -32,7 +34,8 @@ public class StorageOptions {
|
||||||
|
|
||||||
jpa("jpa"),
|
jpa("jpa"),
|
||||||
chm("concurrenthashmap"),
|
chm("concurrenthashmap"),
|
||||||
hotrod("hotrod");
|
hotrod("hotrod"),
|
||||||
|
file("file");
|
||||||
|
|
||||||
private final String provider;
|
private final String provider;
|
||||||
|
|
||||||
|
@ -263,6 +266,7 @@ public class StorageOptions {
|
||||||
.category(OptionCategory.STORAGE)
|
.category(OptionCategory.STORAGE)
|
||||||
.description(descriptionForStorageAreas("single use objects"))
|
.description(descriptionForStorageAreas("single use objects"))
|
||||||
.buildTime(true)
|
.buildTime(true)
|
||||||
|
.expectedValues(Stream.of(StorageType.values()).filter(not(StorageType.file::equals)).toArray(StorageType[]::new))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Option<String> STORAGE_PUBLIC_KEY_STORAGE_STORE = new OptionBuilder<>("storage-public-key-storage", String.class)
|
public static final Option<String> STORAGE_PUBLIC_KEY_STORAGE_STORE = new OptionBuilder<>("storage-public-key-storage", String.class)
|
||||||
|
@ -324,6 +328,11 @@ public class StorageOptions {
|
||||||
.hidden()
|
.hidden()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
public static final Option<String> STORAGE_FILE_DIR= new OptionBuilder<>("storage-file-dir", String.class)
|
||||||
|
.category(OptionCategory.STORAGE)
|
||||||
|
.description("Root directory for file map store.")
|
||||||
|
.build();
|
||||||
|
|
||||||
private static String descriptionForStorageAreas(String areaAsText) {
|
private static String descriptionForStorageAreas(String areaAsText) {
|
||||||
return "Sets a storage mechanism for " + areaAsText + ".";
|
return "Sets a storage mechanism for " + areaAsText + ".";
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,6 +528,16 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.snakeyaml</groupId>
|
||||||
|
<artifactId>snakeyaml-engine</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>*</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.zxing</groupId>
|
<groupId>com.google.zxing</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
|
|
|
@ -230,7 +230,7 @@ final class StoragePropertyMappers {
|
||||||
fromOption(StorageOptions.STORAGE_SINGLE_USE_OBJECT_STORE)
|
fromOption(StorageOptions.STORAGE_SINGLE_USE_OBJECT_STORE)
|
||||||
.to("kc.spi-single-use-object-map-storage-provider")
|
.to("kc.spi-single-use-object-map-storage-provider")
|
||||||
.mapFrom("storage")
|
.mapFrom("storage")
|
||||||
.transformer(StoragePropertyMappers::resolveMapStorageProvider)
|
.transformer(StoragePropertyMappers::resolveMapStorageProviderSingleUseObjects)
|
||||||
.paramLabel("type")
|
.paramLabel("type")
|
||||||
.build(),
|
.build(),
|
||||||
fromOption(StorageOptions.STORAGE_PUBLIC_KEY_STORAGE_STORE)
|
fromOption(StorageOptions.STORAGE_PUBLIC_KEY_STORAGE_STORE)
|
||||||
|
@ -298,6 +298,11 @@ final class StoragePropertyMappers {
|
||||||
fromOption(StorageOptions.STORAGE_HOTROD_CACHE_REINDEX)
|
fromOption(StorageOptions.STORAGE_HOTROD_CACHE_REINDEX)
|
||||||
.to("kc.spi-connections-hot-rod-default-reindex-caches")
|
.to("kc.spi-connections-hot-rod-default-reindex-caches")
|
||||||
.paramLabel("[cache1,cache2,...]|all")
|
.paramLabel("[cache1,cache2,...]|all")
|
||||||
|
.build(),
|
||||||
|
fromOption(StorageOptions.STORAGE_FILE_DIR)
|
||||||
|
.to("kc.spi-map-storage-file-dir")
|
||||||
|
.mapFrom("storage")
|
||||||
|
.paramLabel("dir")
|
||||||
.build()
|
.build()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -366,6 +371,21 @@ final class StoragePropertyMappers {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Optional<String> resolveMapStorageProviderSingleUseObjects(Optional<String> value, ConfigSourceInterceptorContext context) {
|
||||||
|
try {
|
||||||
|
if (value.isPresent()) {
|
||||||
|
return of(value.map(StorageType::valueOf)
|
||||||
|
.filter(not(StorageType.file::equals))
|
||||||
|
.map(StorageType::getProvider)
|
||||||
|
.orElse(StorageType.chm.getProvider()));
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
throw new IllegalArgumentException("Invalid storage provider: " + value.orElse(null), iae);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
private static Optional<String> resolveMapStorageProviderPublicKeyStorage(Optional<String> value, ConfigSourceInterceptorContext context) {
|
private static Optional<String> resolveMapStorageProviderPublicKeyStorage(Optional<String> value, ConfigSourceInterceptorContext context) {
|
||||||
try {
|
try {
|
||||||
if (value.isPresent()) {
|
if (value.isPresent()) {
|
||||||
|
|
|
@ -31,52 +31,54 @@ Cache:
|
||||||
Storage (Experimental):
|
Storage (Experimental):
|
||||||
|
|
||||||
--storage <type> Experimental: Sets the default storage mechanism for all areas. Possible
|
--storage <type> Experimental: Sets the default storage mechanism for all areas. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-auth-session <type>
|
--storage-area-auth-session <type>
|
||||||
Experimental: Sets a storage mechanism for authentication sessions. Possible
|
Experimental: Sets a storage mechanism for authentication sessions. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-authorization <type>
|
--storage-area-authorization <type>
|
||||||
Experimental: Sets a storage mechanism for authorizations. Possible values
|
Experimental: Sets a storage mechanism for authorizations. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod, file.
|
||||||
--storage-area-client <type>
|
--storage-area-client <type>
|
||||||
Experimental: Sets a storage mechanism for clients. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for clients. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-client-scope <type>
|
--storage-area-client-scope <type>
|
||||||
Experimental: Sets a storage mechanism for client scopes. Possible values are:
|
Experimental: Sets a storage mechanism for client scopes. Possible values are:
|
||||||
jpa, chm, hotrod.
|
jpa, chm, hotrod, file.
|
||||||
--storage-area-event-admin <type>
|
--storage-area-event-admin <type>
|
||||||
Experimental: Sets a storage mechanism for admin events. Possible values are:
|
Experimental: Sets a storage mechanism for admin events. Possible values are:
|
||||||
jpa, chm, hotrod.
|
jpa, chm, hotrod, file.
|
||||||
--storage-area-event-auth <type>
|
--storage-area-event-auth <type>
|
||||||
Experimental: Sets a storage mechanism for authentication and authorization
|
Experimental: Sets a storage mechanism for authentication and authorization
|
||||||
events. Possible values are: jpa, chm, hotrod.
|
events. Possible values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-group <type>
|
--storage-area-group <type>
|
||||||
Experimental: Sets a storage mechanism for groups. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for groups. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-login-failure <type>
|
--storage-area-login-failure <type>
|
||||||
Experimental: Sets a storage mechanism for login failures. Possible values
|
Experimental: Sets a storage mechanism for login failures. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod, file.
|
||||||
--storage-area-realm <type>
|
--storage-area-realm <type>
|
||||||
Experimental: Sets a storage mechanism for realms. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for realms. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-role <type>
|
--storage-area-role <type>
|
||||||
Experimental: Sets a storage mechanism for roles. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for roles. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-single-use-object <type>
|
--storage-area-single-use-object <type>
|
||||||
Experimental: Sets a storage mechanism for single use objects. Possible values
|
Experimental: Sets a storage mechanism for single use objects. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod.
|
||||||
--storage-area-user <type>
|
--storage-area-user <type>
|
||||||
Experimental: Sets a storage mechanism for users. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for users. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-user-session <type>
|
--storage-area-user-session <type>
|
||||||
Experimental: Sets a storage mechanism for user and client sessions. Possible
|
Experimental: Sets a storage mechanism for user and client sessions. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-deployment-state-version-seed <type>
|
--storage-deployment-state-version-seed <type>
|
||||||
Experimental: Secret that serves as a seed to mask the version number of
|
Experimental: Secret that serves as a seed to mask the version number of
|
||||||
Keycloak in URLs. Need to be identical across all servers in the cluster.
|
Keycloak in URLs. Need to be identical across all servers in the cluster.
|
||||||
Will default to a random number generated when starting the server which is
|
Will default to a random number generated when starting the server which is
|
||||||
secure but will lead to problems when a loadbalancer without sticky sessions
|
secure but will lead to problems when a loadbalancer without sticky sessions
|
||||||
is used or nodes are restarted.
|
is used or nodes are restarted.
|
||||||
|
--storage-file-dir <dir>
|
||||||
|
Experimental: Root directory for file map store.
|
||||||
--storage-hotrod-host <host>
|
--storage-hotrod-host <host>
|
||||||
Experimental: Sets the host of the Infinispan server.
|
Experimental: Sets the host of the Infinispan server.
|
||||||
--storage-hotrod-password <password>
|
--storage-hotrod-password <password>
|
||||||
|
|
|
@ -37,52 +37,54 @@ Cache:
|
||||||
Storage (Experimental):
|
Storage (Experimental):
|
||||||
|
|
||||||
--storage <type> Experimental: Sets the default storage mechanism for all areas. Possible
|
--storage <type> Experimental: Sets the default storage mechanism for all areas. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-auth-session <type>
|
--storage-area-auth-session <type>
|
||||||
Experimental: Sets a storage mechanism for authentication sessions. Possible
|
Experimental: Sets a storage mechanism for authentication sessions. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-authorization <type>
|
--storage-area-authorization <type>
|
||||||
Experimental: Sets a storage mechanism for authorizations. Possible values
|
Experimental: Sets a storage mechanism for authorizations. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod, file.
|
||||||
--storage-area-client <type>
|
--storage-area-client <type>
|
||||||
Experimental: Sets a storage mechanism for clients. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for clients. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-client-scope <type>
|
--storage-area-client-scope <type>
|
||||||
Experimental: Sets a storage mechanism for client scopes. Possible values are:
|
Experimental: Sets a storage mechanism for client scopes. Possible values are:
|
||||||
jpa, chm, hotrod.
|
jpa, chm, hotrod, file.
|
||||||
--storage-area-event-admin <type>
|
--storage-area-event-admin <type>
|
||||||
Experimental: Sets a storage mechanism for admin events. Possible values are:
|
Experimental: Sets a storage mechanism for admin events. Possible values are:
|
||||||
jpa, chm, hotrod.
|
jpa, chm, hotrod, file.
|
||||||
--storage-area-event-auth <type>
|
--storage-area-event-auth <type>
|
||||||
Experimental: Sets a storage mechanism for authentication and authorization
|
Experimental: Sets a storage mechanism for authentication and authorization
|
||||||
events. Possible values are: jpa, chm, hotrod.
|
events. Possible values are: jpa, chm, hotrod, file.
|
||||||
--storage-area-group <type>
|
--storage-area-group <type>
|
||||||
Experimental: Sets a storage mechanism for groups. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for groups. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-login-failure <type>
|
--storage-area-login-failure <type>
|
||||||
Experimental: Sets a storage mechanism for login failures. Possible values
|
Experimental: Sets a storage mechanism for login failures. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod, file.
|
||||||
--storage-area-realm <type>
|
--storage-area-realm <type>
|
||||||
Experimental: Sets a storage mechanism for realms. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for realms. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-role <type>
|
--storage-area-role <type>
|
||||||
Experimental: Sets a storage mechanism for roles. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for roles. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-single-use-object <type>
|
--storage-area-single-use-object <type>
|
||||||
Experimental: Sets a storage mechanism for single use objects. Possible values
|
Experimental: Sets a storage mechanism for single use objects. Possible values
|
||||||
are: jpa, chm, hotrod.
|
are: jpa, chm, hotrod.
|
||||||
--storage-area-user <type>
|
--storage-area-user <type>
|
||||||
Experimental: Sets a storage mechanism for users. Possible values are: jpa,
|
Experimental: Sets a storage mechanism for users. Possible values are: jpa,
|
||||||
chm, hotrod.
|
chm, hotrod, file.
|
||||||
--storage-area-user-session <type>
|
--storage-area-user-session <type>
|
||||||
Experimental: Sets a storage mechanism for user and client sessions. Possible
|
Experimental: Sets a storage mechanism for user and client sessions. Possible
|
||||||
values are: jpa, chm, hotrod.
|
values are: jpa, chm, hotrod, file.
|
||||||
--storage-deployment-state-version-seed <type>
|
--storage-deployment-state-version-seed <type>
|
||||||
Experimental: Secret that serves as a seed to mask the version number of
|
Experimental: Secret that serves as a seed to mask the version number of
|
||||||
Keycloak in URLs. Need to be identical across all servers in the cluster.
|
Keycloak in URLs. Need to be identical across all servers in the cluster.
|
||||||
Will default to a random number generated when starting the server which is
|
Will default to a random number generated when starting the server which is
|
||||||
secure but will lead to problems when a loadbalancer without sticky sessions
|
secure but will lead to problems when a loadbalancer without sticky sessions
|
||||||
is used or nodes are restarted.
|
is used or nodes are restarted.
|
||||||
|
--storage-file-dir <dir>
|
||||||
|
Experimental: Root directory for file map store.
|
||||||
--storage-hotrod-host <host>
|
--storage-hotrod-host <host>
|
||||||
Experimental: Sets the host of the Infinispan server.
|
Experimental: Sets the host of the Infinispan server.
|
||||||
--storage-hotrod-password <password>
|
--storage-hotrod-password <password>
|
||||||
|
|
|
@ -28,6 +28,8 @@ Storage (Experimental):
|
||||||
Will default to a random number generated when starting the server which is
|
Will default to a random number generated when starting the server which is
|
||||||
secure but will lead to problems when a loadbalancer without sticky sessions
|
secure but will lead to problems when a loadbalancer without sticky sessions
|
||||||
is used or nodes are restarted.
|
is used or nodes are restarted.
|
||||||
|
--storage-file-dir <dir>
|
||||||
|
Experimental: Root directory for file map store.
|
||||||
--storage-hotrod-host <host>
|
--storage-hotrod-host <host>
|
||||||
Experimental: Sets the host of the Infinispan server.
|
Experimental: Sets the host of the Infinispan server.
|
||||||
--storage-hotrod-password <password>
|
--storage-hotrod-password <password>
|
||||||
|
|
Loading…
Reference in a new issue