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

UnknownSystemEntity exception #143

Open
shivshankardayal opened this issue Jul 15, 2022 · 4 comments
Open

UnknownSystemEntity exception #143

shivshankardayal opened this issue Jul 15, 2022 · 4 comments

Comments

@shivshankardayal
Copy link

I am trying to implement SAML auth with Mautic(https://docs.mautic.org/en) as SP and my django app as IDP. I have added SP information using admin panel of Django app. However, when I try to login using IDP initiated login it gives me UnknownSystemEntity exception. How toresolve this? Given below is the stacktarce:

Traceback (most recent call last):
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/djangosaml2idp/views.py", line 299, in get
    binding_out, destination = idp_server.pick_binding(
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/saml2/entity.py", line 349, in pick_binding
    srvs = sfunc(entity_id, binding, descr_type)
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/saml2/mdstore.py", line 1311, in assertion_consumer_service
    return self.service(entity_id, "spsso_descriptor",
  File "/home/shiv/upwork/ryan/marketing-automation/mautic_dashboard/venv/lib/python3.10/site-packages/saml2/mdstore.py", line 1204, in service
    raise UnknownSystemEntity(entity_id)
saml2.s_utils.UnknownSystemEntity: http://127.0.0.1:81
[15/Jul/2022 09:14:28] "GET /idp/sso/init/?sp=http%3A%2F%2F127.0.0.1%3A81&RelayState=%2F HTTP/1.1" 500 109227
@shivshankardayal shivshankardayal changed the title Unknown system entiry UnknownSystemEntiry exception Jul 15, 2022
@lgarvey
Copy link
Contributor

lgarvey commented Jul 15, 2022

It looks like it's not finding idp config for an idp with entity id: http://127.0.0.1:81/

@shivshankardayal
Copy link
Author

shivshankardayal commented Jul 15, 2022

Given below is the IDP config:

'idp': {
            'name': 'Django localhost IdP',
            'endpoints': {
                'single_sign_on_service': [
                    ('http://localhost:8000/idp/sso/post/', saml2.BINDING_HTTP_POST),
                    ('http://localhost:8000/idp/sso/redirect/', saml2.BINDING_HTTP_REDIRECT),
                ],
                "single_logout_service": [
                    ("http://localhost:8000/idp/slo/post/", saml2.BINDING_HTTP_POST),
                    ("http://localhost:8000/idp/slo/redirect/", saml2.BINDING_HTTP_REDIRECT)
                ],
            },
            'name_id_format': [NAMEID_FORMAT_EMAILADDRESS, NAMEID_FORMAT_UNSPECIFIED],
            'sign_response': True,
            'sign_assertion': True,
            'want_authn_requests_signed': True,
        },

IDP has no field for Entity ID. The entity ID https://127.0.0.1:81 is being fetched from DB which belong to SP i.e. Mautic.

djangosmal2idp does not create any db tables for IDPs .

@shivshankardayal shivshankardayal changed the title UnknownSystemEntiry exception UnknownSystemEntity exception Jul 15, 2022
@yuyan075500
Copy link

I'm sorry to bother you, but I have also encountered the same problem as you. I don't know if you have solved it, and if so, how did you solve it?

@abybaddi009
Copy link

@yuyan075500 : I have resolved the error and published a sample django project here. The root cause is that the entity id definition should be valid and should be configured using the Service Providers in the admin panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants