内部服务器错误djangosaml2从React-Native Webview登录

时间:2018-04-03 14:12:22

标签: django react-native saml

错误消息:"内部服务器错误:/ saml2 / acs /"

使用React-Natives Webview组件连接到我的IdP。 登录后,我正在重定向到我的网站,djangosaml2库应该登录用户。在这里,我得到内部服务器错误。

使用chrome时登录正常,但React-Native应用程序无法登录。 (Android模拟器)

我正在使用react-native-cookies,并且在重定向到我的网站时似乎删除了所有cookie。

我尝试在SAML_CONFIG下设置allow_unsolicited:True,但它不起作用。

    'service': {
    # we are just a lonely SP
    'sp' : {
        "allow_unsolicited" : True,
         # Other stuff here
    }
}

非常感谢任何帮助:)

整个错误消息:

Internal Server Error: /saml2/acs/
Traceback (most recent call last):
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/django/views/decorators/http.py", line 45, in inner
    return func(request, *args, **kwargs)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/djangosaml2/views.py", line 253, in assertion_consumer_service
    outstanding_queries)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/saml2/client_base.py", line 597, in parse_authn_request_response
    binding, **kwargs)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/saml2/entity.py", line 1140, in _parse_response
    response = response.loads(xmlstr, False, origxml=origxml)
  File "/home/tpweb/webapps/dev_tpdjango/venv/lib/python3.5/site-packages/saml2/response.py", line 534, in loads
    "Unsolicited response: %s" % self.in_response_to)
saml2.response.UnsolicitedResponse: Unsolicited response: None

Request repr():
<WSGIRequest
path:/saml2/acs/,
GET:<QueryDict: {}>,
POST:{'RelayState': 'https://tptest.teknologiporten.no/',
 'S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czpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhzaTp0eXBlPSJ4czpzdHJpbmciPmhqZW5nc3RhQHN0dWQubnRudS5ubzwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJnaXZlbk5hbWUiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhzaTp0eXBlPSJ4czpzdHJpbmciPkhhbnMgSsO4cmdlbiBTdGVpbmtlbGxuZXI8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48L3NhbWw6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDpBc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4='},
COOKIES:{},
META:{'CONTENT_LENGTH': '6951',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'CONTEXT_DOCUMENT_ROOT': '/usr/local/apache2/htdocs',
 'CONTEXT_PREFIX': '',
 'CSRF_COOKIE': 'mzZklkdIAK6yok6KSBO0DOl2IVsWQ2Sl',
 'DOCUMENT_ROOT': '/usr/local/apache2/htdocs',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_CACHE_CONTROL': 'max-age=0',
 'HTTP_CONNECTION': 'close',
 'HTTP_FORWARDED_REQUEST_URI': '/saml2/acs/',
 'HTTP_HOST': 'tptest.teknologiporten.no',
 'HTTP_HTTPS': 'on',
 'HTTP_ORIGIN': 'https://idp-test.feide.no',
 'HTTP_REFERER': 'https://idp-test.feide.no/simplesaml/module.php/preprodwarning/showwarning.php?StateId=_a037e0ea1078b06b76e1f3b4d0af80da8487218584%3Ahttps%3A%2F%2Fidp-test.feide.no%2Fsimplesaml%2Fsaml2%2Fidp%2FSSOService.php%3Fspentityid%3Dhttps%253A%252F%252Ftptest.teknologiporten.no%252Fsaml2%252Fmetadata%252F%26cookieTime%3D1522761547%26RelayState%3Dhttps%253A%252F%252Ftptest.teknologiporten.no%252F&yes=',
 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Linux; Android 6.0; Android SDK built for '
                    'x86 Build/MASTER; wv) AppleWebKit/537.36 (KHTML, like '
                    'Gecko) Version/4.0 Chrome/44.0.2403.119 Mobile '
                    'Safari/537.36',
 'HTTP_X_FORWARDED_FOR': '109.189.22.180',
 'HTTP_X_FORWARDED_HOST': 'tptest.teknologiporten.no',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_FORWARDED_SERVER': 'tptest.teknologiporten.no',
 'HTTP_X_FORWARDED_SSL': 'on',
 'HTTP_X_REQUESTED_WITH': 'com.temp_tp',
 'LD_LIBRARY_PATH': '/home/tpweb/webapps/dev_tpdjango/apache2/lib:/home/tpweb/webapps/dev_tpdjango/lib',
 'PATH_INFO': '/saml2/acs/',
 'PATH_TRANSLATED': '/home/tpweb/webapps/dev_tpdjango/tp-django/teknologiporten/wsgi.py/saml2/acs/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_PORT': '43212',
 'REQUEST_METHOD': 'POST',
 'REQUEST_SCHEME': 'http',
 'REQUEST_URI': '/saml2/acs/',
 'SCRIPT_FILENAME': '/home/tpweb/webapps/dev_tpdjango/tp-django/teknologiporten/wsgi.py',
 'SCRIPT_NAME': '',
 'SERVER_ADDR': '127.0.0.1',
 'SERVER_ADMIN': '[no address given]',
 'SERVER_NAME': 'tptest.teknologiporten.no',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SIGNATURE': '',
 'SERVER_SOFTWARE': 'Apache/2.4.23 (Unix) mod_wsgi/4.5.9 Python/3.5',
 'apache.version': (2, 4, 23),
 'mod_wsgi.application_group': 'web570.webfaction.com|',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.daemon_connects': '1',
 'mod_wsgi.daemon_restarts': '0',
 'mod_wsgi.daemon_start': '1522761549597121',
 'mod_wsgi.enable_sendfile': '0',
 'mod_wsgi.handler_script': '',
 'mod_wsgi.ignore_activity': '0',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '22330',
 'mod_wsgi.path_info': '/saml2/acs/',
 'mod_wsgi.process_group': 'tpdjango',
 'mod_wsgi.queue_start': '1522761549596951',
 'mod_wsgi.request_handler': 'wsgi-script',
 'mod_wsgi.request_id': 'SMg9jZln+gE',
 'mod_wsgi.request_start': '1522761549596744',
 'mod_wsgi.script_name': '',
 'mod_wsgi.script_reloading': '1',
 'mod_wsgi.script_start': '1522761549597271',
 'mod_wsgi.thread_id': 1,
 'mod_wsgi.thread_requests': 26,
 'mod_wsgi.total_requests': 52,
 'mod_wsgi.version': (4, 5, 8),
 'wsgi.errors': <_io.TextIOWrapper encoding='utf-8'>,
 'wsgi.file_wrapper': <class 'mod_wsgi.FileWrapper'>,
 'wsgi.input': <mod_wsgi.Input object at 0x7fe8d4b48f10>,

0 个答案:

没有答案