[keycloak-user] Exception with User Storage SPI priority configuration

Bill Burke bburke at redhat.com
Thu Nov 3 17:02:49 EDT 2016


Yeah, I have this fixed on my local repo.  Move initialization of 
cachePolicy in users.js

function initUserStorageSettings() {
     if ($scope.create) {
         instance.name =providerFactory.id;
         instance.providerId =providerFactory.id;
         instance.providerType ='org.keycloak.storage.UserStorageProvider';
         instance.parentId = realm.id;
         instance.config = {

         };
         instance.config['priority'] = ["0"];

         $scope.fullSyncEnabled =false;
         $scope.changedSyncEnabled =false;
         if (providerFactory.metadata.synchronizable) {
             instance.config['fullSyncPeriod'] = ['-1'];
             instance.config['changedSyncPeriod'] = ['-1'];

         }
         instance.config['cachePolicy'] = ['DEFAULT'];
         instance.config['evictionDay'] = [''];
         instance.config['evictionHour'] = [''];
         instance.config['evictionMinute'] = [''];
         instance.config['maxLifespan'] = [''];
         if (providerFactory.properties) {

             for (var i =0;i <providerFactory.properties.length;i++) {
                 var configProperty =providerFactory.properties[i];
                 if (configProperty.defaultValue) {
                     instance.config[configProperty.name] = [configProperty.defaultValue];
                 }else {
                     instance.config[configProperty.name] = [''];
                 }

             }
         }

     }else {
         $scope.fullSyncEnabled = (instance.config['fullSyncPeriod'] &&instance.config['fullSyncPeriod'][0] >0);
         $scope.changedSyncEnabled = (instance.config['changedSyncPeriod'] &&instance.config['changedSyncPeriod'][0]>0);
         if (providerFactory.metadata.synchronizable) {
             if (!instance.config['fullSyncPeriod']) {
                 console.log('setting to -1');
                 instance.config['fullSyncPeriod'] = ['-1'];

             }
             if (!instance.config['changedSyncPeriod']) {
                 console.log('setting to -1');
                 instance.config['changedSyncPeriod'] = ['-1'];

             }
         }
         if (!instance.config['cachePolicy']) {
             instance.config['cachePolicy'] = ['DEFAULT'];

         }
         if (!instance.config['evictionDay']) {
             instance.config['evictionDay'] = [''];

         }
         if (!instance.config['evictionHour']) {
             instance.config['evictionHour'] = [''];

         }
         if (!instance.config['evictionMinute']) {
             instance.config['evictionMinute'] = [''];

         }
         if (!instance.config['maxLifespan']) {
             instance.config['maxLifespan'] = [''];

         }
         if (!instance.config['priority']) {
             instance.config['priority'] = ['0'];
         }

     }



On 11/3/16 3:10 PM, Thomas Darimont wrote:
> I just tried it with a private window in chrome (53.0.2785.143 Built 
> on Ubuntu) as well as firefox (49.0.2).
> The following seems to work in current master (2.4.0.CR-1 c3f3c5c)
> Steps:
> 1) User Federation -> add provider -> example-user-storage-jpa
> 2) click save (note the cache policy stays empty NOT default -> which 
> changes to DEFAULT after save)
> -> Success message -> now I can edit the storage provider without 
> problems.
> The following does not work
> Steps:
> 1) User Federation -> add provider -> example-user-storage-jpa
> 2) select CachePolicy: Default
> 3) click save
> -> Error message...
> Same in firefox and chrome.
> With the latest keycloak release 2.3.0.Final I can also reproduce the 
> problem in chrome and firefox
> Steps:
> 1) User Federation -> add provider -> example-user-storage-jpa
> 2) click save
> -> Success message
> Priority is empty after save...
> 3) changing priority to 10
> 4) save
> -> Error message


More information about the keycloak-user mailing list