Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate SAMLRequst URL query parameter for unsigned SP-initiated login #67

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor
  • Loading branch information
tomcatling committed Jan 29, 2022

Verified

This commit was signed with the committer’s verified signature.
rubvs Ruben van Staden
commit a5949ddbd8c542252eeed466004af5f74cebf7bb
8 changes: 3 additions & 5 deletions samlauthenticator/samlauthenticator.py
Original file line number Diff line number Diff line change
@@ -719,23 +719,21 @@ def _get_redirect_from_metadata(authenticator_self, element_name, handler_self):
handler_self.log.debug('Got valid metadata etree')

xpath_with_namespaces = authenticator_self._make_xpath_builder()

binding = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
final_xpath = '//' + element_name + '[@Binding=\'' + binding + '\']/@Location'

handler_self.log.debug('Final xpath is: ' + final_xpath)

redirect_link_getter = xpath_with_namespaces(final_xpath)
sso_login_url = redirect_link_getter(saml_metadata_etree)[0]

return sso_login_url

return redirect_link_getter(saml_metadata_etree)[0]

def _get_redirect_from_metadata_and_redirect(authenticator_self, element_name, handler_self, add_authn_request=False):

redirect_url = authenticator_self._get_redirect_from_metadata(element_name, handler_self)

# Here permanent MUST BE False - otherwise the /hub/logout GET will not be fired
# by the user's browser.

if add_authn_request:
authn_requst = quote_plus(b64encode(zlib.compress(
authenticator_self._make_authn_request(element_name, handler_self).encode('utf8')