ansible / django-ansible-base

Apache License 2.0
13 stars 43 forks source link

Can't log into test_app as a non-staff user #111

Open AlanCoding opened 8 months ago

AlanCoding commented 8 months ago

runserver

GET http://127.0.0.1:8000/api/social/login/ansible_base-authentication-authenticator_plugins-local__local-database-authenticator/

Internal Server Error: /api/social/login/ansible_base-authentication-authenticator_plugins-local__local-database-authenticator/
Traceback (most recent call last):
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/social_django/utils.py", line 63, in wrapper
    return func(request, backend, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/social_django/utils.py", line 44, in wrapper
    request.backend = load_backend(
                      ^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/env/lib64/python3.11/site-packages/social_django/utils.py", line 27, in load_backend
    return strategy.get_backend(name, redirect_uri=redirect_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alancoding/repos/awx/testing/django-ansible-base/ansible_base/authentication/social_auth.py", line 96, in get_backend
    return Backend(
           ^^^^^^^^
TypeError: AuthenticatorPlugin.__init__() got multiple values for argument 'database_instance'
AlanCoding commented 8 months ago

Local variables in ansible_base/authentication/social_auth.py

args
(<ansible_base.authentication.social_auth.AuthenticatorStrategy object at 0x7f9e9c38bd90>,)
kwargs
{'database_instance': <Authenticator: Local Database Authenticator>, 'redirect_uri': '/api/social/complete/ansible_base-authentication-authenticator_plugins-local__local-database-authenticator/'}

The Backend is

<class 'ansible_base.authentication.authenticator_plugins.local.AuthenticatorPlugin'>
AlanCoding commented 8 months ago

it looks like there's a strategy object and a database object. The single strategy object is in args and the database is passed as a kwarg, but the kwarg comes before the args and it treats the strategy as a database, thus the error message.

AlanCoding commented 7 months ago

@fosterseth is developing a solution via API browser

AlanCoding commented 6 months ago

This is still an issue.

2024-04-04 17:03:31,668 INFO     ansible_base.authentication.backend User angry_spud logged in from authenticator with ID "1"
[04/Apr/2024 17:03:31] "POST /admin/login/?next=/admin/ HTTP/1.1" 200 13748

It no longer gives the server error, but it still won't load the admin page.