Skip to content

Commit d54ae9d

Browse files
committed
fix: adjust python's lib path ref #104
1 parent dcfcb86 commit d54ae9d

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

casa/app/src/main/java/org/gluu/casa/core/PersistenceService.java

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class PersistenceService implements IPersistenceService {
5757
private LdapOperationService ldapOperationService;
5858

5959
private String rootDn;
60+
private String pythonLibLocation;
6061

6162
private JsonNode dynamicConfig;
6263

@@ -265,6 +266,10 @@ public StringEncrypter getStringEncrypter() {
265266
return stringEncrypter;
266267
}
267268

269+
public String getPythonLibLocation() {
270+
return pythonLibLocation;
271+
}
272+
268273
public CacheConfiguration getCacheConfiguration() {
269274
return cacheConfiguration;
270275
}
@@ -342,6 +347,7 @@ private boolean loadApplianceSettings(Properties properties) {
342347
boolean success = false;
343348
try {
344349
loadASSettings(properties.getProperty("jansAuth_ConfigurationEntryDN"), properties.getProperty("persistence.type"));
350+
pythonLibLocation = properties.getProperty("pythonModulesDir");
345351
rootDn = "o=jans";
346352
success = true;
347353

casa/app/src/main/java/org/gluu/casa/timer/AuthnScriptsReloader.java

+3-10
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class AuthnScriptsReloader extends JobListenerSupport {
5656

5757
private String scriptsJobName;
5858
private Map<String, Long> scriptFingerPrints;
59-
private String pythonLibLocation;
6059

6160
public void init(int gap) {
6261
try {
@@ -87,7 +86,7 @@ public void jobToBeExecuted(JobExecutionContext context) {
8786

8887
logger.debug("AuthnScriptsReloader. Running timer job for acrs: {}", acrs.toString());
8988
//In Gluu, every time a single script is changed via oxTrust, all custom scripts are reloaded. This is
90-
//not the case when for instance, the oxRevision attribute of a cust script is altered manually (as when developing)
89+
//not the case when for instance, the jansRevision attribute of a cust script is altered manually (as when developing)
9190
//In the future, oxTrust should only reload the script that has changed for performance reasons.
9291
for (String acr : acrs) {
9392
script = persistenceService.getScript(acr);
@@ -169,7 +168,7 @@ public void jobToBeExecuted(JobExecutionContext context) {
169168
long rev = Optional.ofNullable(script.getRevision()).map(r -> r == Long.MAX_VALUE ? 0 : r).orElse(0L);
170169
script.setRevision(rev + 1);
171170
if (persistenceService.modify(script)) {
172-
logger.debug("oxRevision updated for script '{}'", script.getDisplayName());
171+
logger.debug("jansRevision updated for script '{}'", script.getDisplayName());
173172
}
174173
break;
175174
default:
@@ -186,14 +185,8 @@ public void jobToBeExecuted(JobExecutionContext context) {
186185

187186
@PostConstruct
188187
private void inited() {
189-
190188
scriptsJobName = getClass().getSimpleName() + "_scripts";
191189
scriptFingerPrints = new HashMap<>();
192-
193-
//the following works fine in both windows dev environment, and linux VMs
194-
pythonLibLocation = Utils.onWindows() ? System.getenv("PYTHON_HOME") + File.separator + "Lib" : "/opt/gluu/python/libs";
195-
logger.info("Using {} as python's lib path", pythonLibLocation);
196-
197190
}
198191

199192
private void copyToLibsDir(CustomScript script) {
@@ -203,7 +196,7 @@ private void copyToLibsDir(CustomScript script) {
203196
byte[] contents = getScriptContents(script);
204197

205198
if (contents != null) {
206-
Path destPath = Paths.get(pythonLibLocation, MessageFormat.format(FILENAME_TEMPLATE, acr));
199+
Path destPath = Paths.get(persistenceService.getPythonLibLocation(), MessageFormat.format(FILENAME_TEMPLATE, acr));
207200
Files.write(destPath, contents);
208201
logger.trace("The script for acr '{}' has been copied to {}", acr, destPath.toString());
209202
} else {

casa/app/src/main/resources/labels/admin.properties

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ adm.cors_origin_placeholder=https://myapp.acme.co
3030
amd.cors_invalid_origin={0} is not a valid domain
3131

3232
adm.passreset_title=Password reset availability
33-
adm.passreset_text={
34-
Activate/Deactivate the password reset functionality for users. This feature can be enabled only if
35-
your Gluu Server installation is not using a backend LDAP for identities synchronization.
36-
}
33+
adm.passreset_text=Activate/Deactivate the password reset functionality for users.
3734

3835
adm.methods_title=Enabled authentication methods
3936
adm.methods_text={

0 commit comments

Comments
 (0)