By: Vitalii Bendyna user 23 Jun 2017 at 9:41 a.m. CDT

5 Responses
Vitalii Bendyna gravatar
Hello! I've configured Cash Refresh with Active Directory as was described in your 3 videos. For the beginning I received this error: ``` ERROR [qtp274064559-17] [org.gluu.oxtrust.action.ConfigureCacheRefreshAction] (ConfigureCacheRefreshAction.java:398) - Can't load Cache Refresh scripts. Using default script ``` I've fixed it, enabled "Cache Refresh" in custom scripts. Here's a script: ``` # oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. # Copyright (c) 2016, Gluu # # Author: Yuriy Movchan # from org.xdi.model.custom.script.type.user import CacheRefreshType from org.xdi.util import StringHelper, ArrayHelper from java.util import Arrays, ArrayList from org.gluu.oxtrust.model import GluuCustomAttribute import java class CacheRefresh(CacheRefreshType): def __init__(self, currentTimeMillis): self.currentTimeMillis = currentTimeMillis def init(self, configurationAttributes): print "Cache refresh. Initialization" print "Cache refresh. Initialized successfully" return True def destroy(self, configurationAttributes): print "Cache refresh. Destroy" print "Cache refresh. Destroyed successfully" return True # Update user entry before persist it # user is org.gluu.oxtrust.model.GluuCustomPerson # configurationAttributes is java.util.Map<String, SimpleCustomProperty> def updateUser(self, user, configurationAttributes): print "Cache refresh. UpdateUser method" attributes = user.getCustomAttributes() # Add new attribute preferredLanguage attrPrefferedLanguage = GluuCustomAttribute("preferredLanguage", "en-us") attributes.add(attrPrefferedLanguage) # Add new attribute userPassword attrUserPassword = GluuCustomAttribute("userPassword", "test") attributes.add(attrUserPassword) # Update givenName attribute for attribute in attributes: attrName = attribute.getName() if (("givenname" == StringHelper.toLowerCase(attrName)) and StringHelper.isNotEmpty(attribute.getValue())): attribute.setValue(StringHelper.removeMultipleSpaces(attribute.getValue()) + " (updated)") return True def getApiVersion(self): return 1 ``` And even after it cache_refresh doesn't work. It is enabled (Configuration -> Cache Refresh), pooling interval - 5 minutes. And it doesn't show any result about cache refresh: Last run, updates and problems are empty. Could I ask you please to help me? I suppose that I have to change custom script... P.S. Connection is NOT encrypted, port 389, ldapsearch works perfectly.

By Sahil Arora user 23 Jun 2017 at 5:51 p.m. CDT

Sahil Arora gravatar
Please check errors in cache refresh logs `/opt/gluu/jetty/identity/logs/oxtrust_cache_refresh.log`

By Vitalii Bendyna user 26 Jun 2017 at 2:04 a.m. CDT

Vitalii Bendyna gravatar
The thing is that there are no errors: ``` 2017-06-23 14:14:47,352 INFO [qtp274064559-16] [org.gluu.oxtrust.action.ConfigureCacheRefreshAction] (ConfigureCacheRefreshAction.java:451) - Script has been executed successfully. Sample source entry is: ' mail: 'Test value' sAMAccountName: 'Test value' givenName: 'Test value' sn: 'Test value''. Sample result entry is: 'dn: 'inum=@!5897.2951.E842.CEE3!0001!8786.3CB0!0000!5845.CDE7,ou=people,o=@!5897.2951.E842.CEE3!0001!8786.3CB0,o=gluu' inum: '@!5897.2951.E842.CEE3!0001!8786.3CB0!0000!5845.CDE7', gluuStatus: 'active' inum: '@!5897.2951.E842.CEE3!0001!8786.3CB0!0000!5845.CDE7' gluuStatus: 'active' uid: 'Test value' mail: 'Test value' givenName: 'Test value (updated)' sn: 'Test value' preferredLanguage: 'en-us' userPassword: 'test'' ```

By Mohib Zico staff 26 Jun 2017 at 2:06 a.m. CDT

Mohib Zico gravatar
Hi Vitalii, I can give a quick hint... please search for 'Cache Refresh' in this knowledge base; I am sure you will get idea what might go wrong ( some other people faced exactly same issue and it turned out that it was some permission in their backend AD/LDAP server ).

By Vitalii Bendyna user 26 Jun 2017 at 2:18 a.m. CDT

Vitalii Bendyna gravatar
Before writing a support request, I was trying to found the same issue - but didn't found. The one helpful thing was to enable cache refresh in custom scripts, it solved this error: ``` Can't load Cache Refresh scripts. Using default script ``` About AD permissions: in case it is lack of permissions - I'll receive an error. But I don't have any errors! It might be a custom script, as there is fields like "test", and the same I'm receiving in log files...

By Mohib Zico staff 26 Jun 2017 at 3:08 a.m. CDT

Mohib Zico gravatar
Here are some from KB: 1. https://support.gluu.org/identity-management/4141/cant-load-cache-refresh-scripts-using-default-script/ 2. https://support.gluu.org/identity-management/3905/unable-to-get-cache-refresh-to-work/ Please check these and others and open a new ticket if required.