Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. diff --git a/web/cobbler_web/views.py b/web/cobbler_web/views.py
  2. index e44de8a..d9fec1b 100644
  3. --- a/web/cobbler_web/views.py
  4. +++ b/web/cobbler_web/views.py
  5. @@ -64,15 +64,25 @@ def check_auth(request):
  6. global token
  7. global username
  8. global url_cobbler_api
  9. - if request.META.has_key('REMOTE_USER') and username is None:
  10. +
  11. + if url_cobbler_api is None:
  12. + url_cobbler_api = utils.local_get_cobbler_api_url()
  13. +
  14. + remote = xmlrpclib.Server(url_cobbler_api, allow_none=True)
  15. +
  16. + if token is not None:
  17. + token_user = remote.get_user_from_token(token)
  18. + else:
  19. + token_user = None
  20. +
  21. + if request.META.has_key('REMOTE_USER'):
  22. + if token_user == request.META['REMOTE_USER']:
  23. + return
  24. username = request.META['REMOTE_USER']
  25. #REMOTE_USER is set, so no credentials are going to be available
  26. #So we get the shared secret and let authn_passthru authenticate us
  27. password = utils.get_shared_secret()
  28. # Load server ip and port from local config
  29. - if url_cobbler_api is None:
  30. - url_cobbler_api = utils.local_get_cobbler_api_url()
  31. - remote = xmlrpclib.Server(url_cobbler_api, allow_none=True)
  32. token = remote.login(username, password)
  33. remote.update(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement