With django_auth_adfs enabled trying to manipulate the auth_group table in any way will error, saying it it unable to find the table. The table however exists, and doing the same manipulations with the module disabled (adding users and groups) will work fine.
website.com and db are placeholders.
Environment:
Request Method: GET
Request URL: http://website.com:8090/oauth2/callback?code=iGSphxaiNECS46oNq94OUA.Dz4A-ntm1ggIAOhiFot6zkGSYv8.f_IUukDnfSynaji5Br3YLHcx9Eq_7Wa6DW3ujG56R1qKgpNrwXuCMhRMzz4B9B5rxrvj1krZeyleaO7wlBVtTEixtaMTo3KhseX-myd3iITe_AWDSvllckGD_88dXj8r_QXlylkdeRi0CLMptwOomkwO6oqm5fOnVdyLKMby3G3rUnwlzysmcI7Se_zdUnTBcVQc5ecDzNmtLuN8zfzMKFzUsxpZ5la4nDav0PhfAXFXqhsCfiwWqphZKGamxdD4SOlgOjwYnTXp-J7Cyf588oemdy95u1NC528GykBpdEO99yvxGAT81Kg5O1sZ8G5AngOfg59Q6JdRCmBDvV3wMQ&state=Lw==
Django Version: 2.0.4
Python Version: 3.6.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'console',
'django_celery_results',
'corsheaders',
'django_filters',
'django_extensions',
'widget_tweaks',
'django_tables2',
'haystack',
'rangefilter',
'storages',
'django_auth_adfs']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_auth_adfs.middleware.LoginRequiredMiddleware']
Traceback:
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in execute
247. res = self._query(query)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in _query
412. rowcount = self._do_query(q)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in _do_query
375. db.query(q)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/connections.py" in query
276. _mysql.connection.query(self, query)
The above exception ((1146, "Table 'db.auth_group' doesn't exist")) was the direct cause of the following exception:
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/views/generic/base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
89. return handler(request, *args, **kwargs)
File "/home/watson/.local/lib/python3.6/site-packages/django_auth_adfs/views.py" in get
34. user = authenticate(request, authorization_code=code)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in authenticate
70. user = _authenticate_with_backend(backend, backend_path, request, credentials)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in _authenticate_with_backend
116. return backend.authenticate(*args, **credentials)
File "/home/watson/.local/lib/python3.6/site-packages/django_auth_adfs/backend.py" in authenticate
266. user = self.process_access_token(access_token, adfs_response)
File "/home/watson/.local/lib/python3.6/site-packages/django_auth_adfs/backend.py" in process_access_token
96. self.update_user_groups(user, claims)
File "/home/watson/.local/lib/python3.6/site-packages/django_auth_adfs/backend.py" in update_user_groups
170. django_groups = [group.name for group in user.groups.all()]
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py" in __iter__
272. self._fetch_all()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py" in _fetch_all
1179. self._result_cache = list(self._iterable_class(self))
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py" in __iter__
53. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
1067. cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in execute
247. res = self._query(query)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in _query
412. rowcount = self._do_query(q)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/cursors.py" in _do_query
375. db.query(q)
File "/home/watson/.local/lib/python3.6/site-packages/MySQLdb/connections.py" in query
276. _mysql.connection.query(self, query)
Exception Type: ProgrammingError at /oauth2/callback
Exception Value: (1146, "Table 'db.auth_group' doesn't exist")