Open Maarten28 opened 7 years ago
I had to clear out the API_ssoaccesslist table in the database otherwise the celery job for update_char_location broke as data was expecting was missing:
[2016-12-24 18:57:36,973: ERROR/MainProcess] Task API.tasks.update_char_location[1d8452a7-63e9-4c9f-8be1-ccfcf8041fce] raised unexpected: AttributeError("'NoneType' object has no attribute 'access_token'",)
Traceback (most recent call last):
File "/home/maptool/eve-wspace/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/maptool/eve-wspace/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
return self.run(*args, **kwargs)
File "/home/maptool/eve-wspace/evewspace/API/tasks.py", line 52, in update_char_location
response = esi_access_data(token,url)
File "/home/maptool/eve-wspace/evewspace/API/utils.py", line 122, in esi_access_data
authorization = token.access_token
AttributeError: 'NoneType' object has no attribute 'access_token'
Additionally I turned on the SSO login and deleted the user account I was using for testing. When I try and sign up with the account via SSO I get a 403 forbidden error.
The first is odd and I do not actually know what could cause it. The only change I made there is that a few columns can now be blank/nullable.
Your second point is due to no access list has been setup. You need to add the char or corp to the access list in the SSO settings.
I'll blame the database issue on switching git branches.
I added my corp to the access list and I got this error on first login after the CCP signon page:
Environment:
Request Method: GET
Request URL: http://penguin-wspace.duckdns.org/api/sso/login/?code=tyVQaOcjfaI2ZuUpbutll6ZQ9ARsRNNCA8fOROHCMR5FL_INrb3KqJNjPXZbdViA0&state=login
Django Version: 1.8.15
Python Version: 2.7.12
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'core',
'account',
'search',
'Map',
'POS',
'SiteTracker',
'API',
'Alerts',
'Jabber',
'Slack',
'eveigb',
'djcelery')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'eveigb.middleware.IGBMiddleware')
Traceback:
File "/home/maptool/eve-wspace/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/maptool/eve-wspace/evewspace/API/views.py" in sso_login
148. token = sso_util_login(request, code)
File "/home/maptool/eve-wspace/evewspace/API/utils.py" in sso_util_login
202. group = Group.objects.get(name=get_config("SSO_DEFAULT_GROUP", None).value)
File "/home/maptool/eve-wspace/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
127. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/maptool/eve-wspace/local/lib/python2.7/site-packages/django/db/models/query.py" in get
334. self.model._meta.object_name
Exception Type: DoesNotExist at /api/sso/login/
Exception Value: Group matching query does not exist.
Trying a second time the site logged me in correctly with my new user account.
Did you set a default group for new users to end up in?
No, I've set that option and the error doesn't happen now. :D
I'll add some additional security measures in the next 30 minutes to avoid this stuff :).
Both were actually bugs:
Pulled this to the develop branch.
Damn. I was delayed few months due to real life stuff. I had SSO login done with adarnauth-eve-sso. I had plan to offload the auth stuff to it and location to another project so it could be used elsewhere. Just for reference, here was the sso work: https://github.com/raphendyr/eve-wspace/tree/feature/crest_wip2 (that uses adarnauth-eve-sso version from https://github.com/evewspace/adarnauth-eve-sso/tree/develop)
I'll take a look what @Maarten28 has done when ever I can allocate the time...
Last year I wrote a basic implementation as well and since nobody seemed to have worked on it in the past 2 months I'd thought to just get it over with ;). Feel free to change things around, I already know stuff can be optimized.
In the CREST branch another update has been put:
Please help with testing and report any issues.