From 26fc964947fa1685a1a7c75de74a1111dbb1f15e Mon Sep 17 00:00:00 2001 From: Mauro Mugnaini Date: Fri, 18 Feb 2022 16:38:28 +0100 Subject: [PATCH] Default avatar folder now is a sub-folder of the `user.home` directory if the `jboss.server.data.dir` property is not set (or the runtime env. is not JBoss/WildFly) --- .../storage/file/FileAvatarStorageProviderFactory.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/avatar-realm-resource/src/main/java/org/gcube/keycloak/avatar/storage/file/FileAvatarStorageProviderFactory.java b/avatar-realm-resource/src/main/java/org/gcube/keycloak/avatar/storage/file/FileAvatarStorageProviderFactory.java index b54ebde..091a81e 100644 --- a/avatar-realm-resource/src/main/java/org/gcube/keycloak/avatar/storage/file/FileAvatarStorageProviderFactory.java +++ b/avatar-realm-resource/src/main/java/org/gcube/keycloak/avatar/storage/file/FileAvatarStorageProviderFactory.java @@ -8,7 +8,12 @@ import org.keycloak.models.KeycloakSessionFactory; public class FileAvatarStorageProviderFactory implements AvatarStorageProviderFactory { - public static final String DEFAULT_AVATAR_FOLDER = System.getProperty("jboss.server.data.dir") + "/avatar"; + public static final String DEFAULT_AVATAR_FOLDER = ( + System.getProperty("jboss.server.data.dir") != null + ? System.getProperty("jboss.server.data.dir") + : System.getProperty("user.home") + ) + "/avatar"; + public static final Boolean USE_EMAIL_AS_FILENAME_DEFAULT = Boolean.FALSE; private String avatarFolder;