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

Handle errors from grouper server #18

Open
dleehr opened this issue Jul 21, 2017 · 3 comments
Open

Handle errors from grouper server #18

dleehr opened this issue Jul 21, 2017 · 3 comments

Comments

@dleehr
Copy link
Member

dleehr commented Jul 21, 2017

Currently, the grouper server is returning 500 Internal server error, which prevents auth from working:

 ERROR:django.request:Internal Server Error: /auth/code_callback
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner
     response = get_response(request)
   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
     response = self.process_exception_by_middleware(e, request)
   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
     response = wrapped_callback(request, *callback_args, **callback_kwargs)
   File "/app/data/views.py", line 25, in authorize_callback
     user = authenticate(service=service, token_dict=token_dict)
   File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 74, in authenticate
     user = backend.authenticate(**credentials)
   File "/usr/local/lib/python2.7/site-packages/gcb_web_auth/backends/oauth.py", line 37, in authenticate
     self.check_user_details(details)
   File "/app/bespin/backend.py", line 13, in check_user_details
     self.verify_user_belongs_to_group(duke_unique_id, BESPIN_USER_GROUP)
   File "/usr/local/lib/python2.7/site-packages/gcb_web_auth/backends/oauth.py", line 69, in verify_user_belongs_to_group
     if not user_belongs_to_group(group_manager_connection, duke_unique_id, group_name):
   File "/usr/local/lib/python2.7/site-packages/gcb_web_auth/groupmanager.py", line 13, in user_belongs_to_group
     return group_name in get_users_group_names(group_manager_connection, duke_unique_id)
   File "/usr/local/lib/python2.7/site-packages/gcb_web_auth/groupmanager.py", line 23, in get_users_group_names
     response_payload = _fetch_users_groups(group_manager_connection, duke_unique_id)
   File "/usr/local/lib/python2.7/site-packages/gcb_web_auth/groupmanager.py", line 32, in _fetch_users_groups
     resp.raise_for_status()
   File "/usr/local/lib/python2.7/site-packages/requests/models.py", line 862, in raise_for_status
     raise HTTPError(http_error_msg, response=self)
 HTTPError: 500 Server Error: Internal Server Error for url: https://grouper-server/grouper-ws/servicesRest/json/v2_1_500/subjects/xxxxx/groups
@dleehr
Copy link
Member Author

dleehr commented Jul 21, 2017

Oddly, I can curl the server from my local machine:

$ curl -u <account_id> https://grouper-server/grouper-ws/servicesRest/json/v2_1_500/subjects/my-id/groups

Enter host password for user '<account_id>':
{"WsGetGroupsLiteResult":{"responseMetadata":{"millis":"115",...

@dleehr
Copy link
Member Author

dleehr commented Jul 21, 2017

And requests.get works. so it's not a content type thing.

@dleehr
Copy link
Member Author

dleehr commented Jul 21, 2017

Started debugging from the server in a django shell. This worked just fine and now the website is working too.

But we should capture errors from the grouper web service better

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

1 participant