Skip to content

Commit

Permalink
fix: #45 val of localPrimaryKey on Gluu is mapped with the primary ke…
Browse files Browse the repository at this point in the history
…y attr of the backend AD
  • Loading branch information
maduvena committed Feb 8, 2022
1 parent 952492e commit 3c4a856
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions casa/extras/Casa.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ def getLocalPrimaryKey(self):
config = GluuConfiguration()
config = entryManager.find(config.getClass(), "ou=configuration,o=jans")
#Pick (one) attribute where user id is stored (e.g. uid/mail)
uid_attr = config.getIdpAuthn().get(0).getConfig().findValue("primaryKey").asText()
# primaryKey is the primary key on the backend AD / LDAP Server
# localPrimaryKey is the primary key on Gluu. This attr value has been mapped with the primary key attr of the backend AD / LDAP when configuring cache refresh
uid_attr = config.getIdpAuthn().get(0).getConfig().findValue("localPrimaryKey").asText()
print "Casa. init. uid attribute is '%s'" % uid_attr
return uid_attr

Expand All @@ -309,7 +311,7 @@ def getSettings(self):
config = ApplicationConfiguration()
config = entryManager.find(config.getClass(), "ou=casa,ou=configuration,o=jans")
settings = config.getSettings()

if settings == None:
print "Casa. getSettings. Failed to parse casa settings from DB"
return settings
Expand Down Expand Up @@ -370,34 +372,34 @@ def getAvailMethodsUser(self, user, skip=None):


def prepareUIParams(self, identity):

print "Casa. prepareUIParams. Reading UI branding params"
cacheService = CdiUtil.bean(CacheService)
casaAssets = cacheService.get("casa_assets")

if casaAssets == None:
#This may happen when cache type is IN_MEMORY, where actual cache is merely a local variable
#This may happen when cache type is IN_MEMORY, where actual cache is merely a local variable
#(a expiring map) living inside Casa webapp, not oxAuth webapp

sets = self.getSettings()

custPrefix = "/custom"
logoUrl = "/images/logo.png"
faviconUrl = "/images/favicon.ico"
if (sets.getExtraCssSnippet() != None) or sets.isUseExternalBranding():
logoUrl = custPrefix + logoUrl
faviconUrl = custPrefix + faviconUrl

prefix = custPrefix if sets.isUseExternalBranding() else ""

casaAssets = {
"contextPath": "/casa",
"prefix" : prefix,
"faviconUrl" : faviconUrl,
"extraCss": sets.getExtraCssSnippet(),
"logoUrl": logoUrl
}

#Setting a single variable with the whole map does not work...
identity.setWorkingParameter("casa_contextPath", casaAssets['contextPath'])
identity.setWorkingParameter("casa_prefix", casaAssets['prefix'])
Expand Down Expand Up @@ -655,7 +657,7 @@ def getGeolocation(self, identity):

return None


def getLogoutExternalUrl(self, configurationAttributes, requestParameters):
print "Get external logout URL call"
return None

0 comments on commit 3c4a856

Please sign in to comment.