Skip to content

Commit

Permalink
fix(SamlPassportScripts): handle preselectedExternalProvider automati…
Browse files Browse the repository at this point in the history
…c redirection problem

gluu-passport issue GluuFederation/gluu-passport#398
  • Loading branch information
kdhttps committed Jan 6, 2022
1 parent a01eab4 commit 21e3a32
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ def prepareForStep(self, configurationAttributes, requestParameters, step):
print "Passport. prepareForStep called %s" % str(step)
identity = CdiUtil.bean(Identity)

facesContext = CdiUtil.bean(FacesContext)
requestParameters = facesContext.getExternalContext().getRequestParameterMap()

passportStrategyFailed = None
try:
passportStrategyFailed = requestParameters['failure']
print "Passport. failure return from passport: %s, Check Passport logs " % passportStrategyFailed
except:
pass

if step == 1:
#re-read the strategies config (for instance to know which strategies have enabled the email account linking)
self.parseProviderConfigs()
Expand Down Expand Up @@ -193,6 +203,8 @@ def prepareForStep(self, configurationAttributes, requestParameters, step):
print "Passport. prepareForStep. A provider value could not be extracted from custom authorization request parameter"
elif not provider in self.registeredProviders:
print "Passport. prepareForStep. Provider '%s' not part of known configured IDPs/OPs" % provider
elif passportStrategyFailed != None:
print "Passport. passport strategy failed : %s, Check Passport logs" % passportStrategyFailed
else:
url = self.getPassportRedirectUrl(provider)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ def prepareForStep(self, configurationAttributes, requestParameters, step):
print "Passport. prepareForStep called %s" % str(step)
identity = CdiUtil.bean(Identity)

facesContext = CdiUtil.bean(FacesContext)
requestParameters = facesContext.getExternalContext().getRequestParameterMap()

passportStrategyFailed = None
try:
passportStrategyFailed = requestParameters['failure']
print "Passport. failure return from passport: %s, Check Passport logs " % passportStrategyFailed
except:
pass

if step == 1:
#re-read the strategies config (for instance to know which strategies have enabled the email account linking)
self.parseProviderConfigs()
Expand Down Expand Up @@ -240,6 +250,8 @@ def prepareForStep(self, configurationAttributes, requestParameters, step):
print "Passport. prepareForStep. A provider value could not be extracted from custom authorization request parameter"
elif not provider in self.registeredProviders:
print "Passport. prepareForStep. Provider '%s' not part of known configured IDPs/OPs" % provider
elif passportStrategyFailed != None:
print "Passport. passport strategy failed : %s, Check Passport logs" % passportStrategyFailed
else:
url = self.getPassportRedirectUrl(provider)

Expand Down Expand Up @@ -824,4 +836,3 @@ def isInboundJwt(self, value):
def getLogoutExternalUrl(self, configurationAttributes, requestParameters):
print "Get external logout URL call"
return None

0 comments on commit 21e3a32

Please sign in to comment.