Skip to content

Commit

Permalink
fix: align script wrt latest AS consent updates #10766
Browse files Browse the repository at this point in the history
Signed-off-by: jgomer2001 <[email protected]>
  • Loading branch information
jgomer2001 committed Jan 31, 2025
1 parent b8240bd commit 1aa17e9
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions docs/script-catalog/consent_gathering/AgamaConsentGathering.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,20 @@ def prepareForStep(self, step, context):
print "Agama-Consent. Failed to retrieve session_id"
return False

cesar = session.getSessionAttributes()
param = cesar.get("agama_flow")
sessionId = session.getId()
# print "Session id is %s" % sessionId
param = context.getSessionAttributes().get("consent_flow")

if not param:
param = self.extractAgamaFlow(cesar.get("acr_values"))
print "Agama-Consent. 'consent_flow' session attribute missing"
return False

if not param:
print "Agama-Consent. Unable to determine the Agama flow to launch. Check the docs"
return False

(qn, ins) = self.extractParams(param)
if qn == None:
print "Agama-Consent. Unable to determine the Agama flow to launch. Check the docs"
return False

try:
sessionId = session.getId()
# print "==================================== %s" % sessionId

bridge = CdiUtil.bean(NativeJansFlowBridge)
running = bridge.prepareFlow(sessionId, qn, ins, False, self.enterUrl)

Expand All @@ -120,13 +115,7 @@ def getPageForStep(self, step, context):
return "/" + self.enterUrl

# Misc routines

def extractAgamaFlow(self, acr):
prefix = "agama_"
if acr and acr.startswith(prefix):
return acr[len(prefix):]
return None


def extractParams(self, param):

# param must be of the form QN-INPUT where QN is the qualified name of the flow to launch
Expand Down

0 comments on commit 1aa17e9

Please sign in to comment.