예제 #1
0
 def post(self):
     req = prepare_request_for_saml_toolkit(self.request)
     auth = authenticate_saml(
         req, custom_base_path=Settings['saml_config_folder'])
     auth.process_response()
     errors = auth.get_errors()
     if not errors:
         if auth.is_authenticated():
             login(self, auth.get_attributes()["User.Username"][0], "/")
         else:
             self.render(
                 'Not authenticated'
             )  # TODO: Promote these to HTTP status codes with responses
     else:
         self.render("Error when processing SAML Response: %s %s" %
                     (', '.join(errors), auth.get_last_error_reason()))
예제 #2
0
 def post(self):
     req = prepare_request_for_saml_toolkit(self.request)
     auth = authenticate_saml(req, custom_base_path=Settings['saml_config_folder'])
     auth.process_response()
     errors = auth.get_errors()
     if not errors:
         if auth.is_authenticated():
             login(self, auth.get_attributes()["User.Username"][0], "/")
         else:
             # TODO: Promote these to HTTP status codes with responses
             self.render('Not authenticated')
     else:
         self.render(
             "Error when processing SAML Response: %s %s" % (
                 ', '.join(errors),
                 auth.get_last_error_reason()
             )
         )
 def _saml_login(self):
     req = prepare_request_for_saml_toolkit(self.request)
     auth = authenticate_saml(req, custom_base_path=Settings['saml_config_folder'])
     return self.redirect(auth.login())