N-Coder / studip-fuse

Python FUSE drive for courses and files available through the Stud.IP University Access Portal
GNU General Public License v3.0
19 stars 2 forks source link

studip-fuse at Leibniz-Universität Hannover #21

Open NK308 opened 4 years ago

NK308 commented 4 years ago

I'm currently trying to use studip-fuse for the studip of the Leibniz-Universität Hannover and get problems during login. I'm trying to execute studip-fuse with theese arguments: studip-fuse -f --studip-url https://studip.uni-hannover.de/ --login-method shib --sso "https://studip.uni-hannover.de/Shibboleth.sso/Login?target=https%3A%2F%2Fstudip.uni-hannover.de%2F%3Fsso%3Dshib%26again%3Dyes%26cancel_login%3D1&entityID=https%3A%2F%2Fsso.idm.uni-hannover.de%2Fidp%2Fshibboleth" --pwfile - myUsername /path/to/mountpoint/ Might the error occur, because the login dialog of our webSSO is different from that of the university in Passau?

Starting Studip-Fuse 3.2 release (installed from revision 1e2a7b0) with FUSE 2.9 (libfuse.so.2) running via CPython 3.8.2 on Linux-4.15.0-96-generic-x86_64-with-glibc2.10
Password: 
Going to mount at /home/nk/studIP (uid=0, gid=0, pid=-1238159824, python pid=16658)
Initializing asyncio event loop...
Opening StudIP session...
Logging in via shib...
Initiating shut down sequence...
Event loop closed
Uncaught exception:
Traceback (most recent call last):
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/refuse/high.py", line 862, in _wrapper
    return func(*args, **kwargs) or 0
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/refuse/high.py", line 1121, in init
    return self.operations('init', '/')
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/studipfs/fuse_ops.py", line 104, in __call__
    ret = getattr(self, op)(path, *args)
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/studipfs/fuse_ops.py", line 122, in init
    self.loop_stop_fn, self.loop_run_fn, self.root_rp = self.loop_future.result()
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/launcher/aioimpl/asyncio/main_loop.py", line 63, in future_context
    yield future
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/launcher/aioimpl/asyncio/main_loop.py", line 31, in start
    root_rp = stack.enter_context(session_context_manager(args, loop, future))
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/contextlib.py", line 425, in enter_context
    result = _cm_type.__enter__(cm)
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/launcher/aioimpl/asyncio/main_loop.py", line 145, in session_context
    yield loop.run_until_complete(task)
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/launcher/aioimpl/asyncio/main_loop.py", line 126, in enter
    await http_client.shib_auth(start_url=args.shib_url, username=args.user, password=args.get_password())
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/studip_fuse/launcher/aioimpl/asyncio/aiohttp_client.py", line 92, in shib_auth
    resp.raise_for_status()
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 941, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='400', url=URL('https://sso.idm.uni-hannover.de/idp/profile/SAML2/Redirect/SSO?SAMLRequest=hZLRToMwgJ7EhfQeytjQ0QwS3C5cMh0Z6IU3ptAzaQIt9pSpby8fW92Y6HX/fv85X84Cedheoi1trXbw2gNa571tFLLTQ0x6o5jmKJEp3gIyW7E8vduwwP69gj6VlW6IkyKCsVKrpVbYt2ByMAdZwcNuE5Pa2g4ZpWh7ITuvV9KtuVL6AMYTQPNalqVuwNYeoqZHekCzbV4QZzWMIxU/gi8wqD0p2lg&f7q6TLSXDZwhOxDSQGVpnm%2BJs17F5PkhorivMJsG0V5AxOcAEFZlWFai9CfXpRhiiD2sFVqubEwCP/Bdf%2BYGfjEJWDhkzfREnOy8%2BI1UQqqXvy2VYwjZ659firrjYIxg8LTUESLI4umanYnNh/28s/1JOkn8E47fgbrhbtms7dj%2Bg16tMN7L6cNKm0WCTCaEJuOXnxeSfAI%3D&RelayState=ss:mem:b15895d7dcca0c937cb84186a4b45e3f69f99ba4d101afec03e22aabe950b9d2&SigAlg=http://www.w3.org/2001/04/xmldsig-more%23rsa-sha256&Signature=vxIhyAYle7zYYRo4RVX79IHYfNIksWKwI0%2BJBj1wf4ddGnVajd7U5WZd3mwxB7zH0NYQej9WORSki7TCDpwI2IaJRYYQ2cBJO%2BV/Io7akqMTIrXqc%2BA2eUnQrEr1OwCSgyyj2538RAuomuCUWnJcjRprG6vSzwwSDbZufTly9eJj8pwe9Y1H9KxFzJp46xTL3VXRkofgSxh6IsKE4/Ha0i/7lVoZ4IJItR5XOrzyFSnhBO/MF/%2B/Z6fwnz5EKpWqIDyUqaDkzOeO4t8IFzqUAoYFvEhGZzqfYymoJ5aqDPbsgZV67RhCU%2Bi/pulZLq%2BTYmKbYjTnMhH1l%2ByP1XroN2NiVKfdTsRinScF5W4EMLm1GKgdTFABkTVTTK%2BtFo/afuscUAW6GkfBm9BUaoDXm7jsPTw6CIXdxJck%29fx70LaTwFHLfX6JV3CmxtGVV%2BX/zzyGiEzmJgmHrcLyiw0LjPLu0HjGwcCm8/ftl6gqT48Z5HyNy4eGza3v3knaK6YCPcwf9NhwnYoC8ev1Y5vIqsCH8OmQWSnLZue821Upwd5uKAUA7ahicFdtL7TB9dBvbW9bFr0oH20mlMDk7ohlEsW6sRGpWkNaTsL5B8D5OCGByU1O131OoUd1q4sfiTEyHYesZu4Ia2SgI3SqErD0NbDlXMK5IaMgZqtjQ9hchEE%3D')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 237, in 'calling callback function'
  File "/home/nk/anaconda3/envs/studip/lib/python3.8/site-packages/refuse/high.py", line 888, in _wrapper
    self.__critical_exception = e
NameError: name 'self' is not defined
^CUnmounting from / (uid=0, gid=0, pid=0, python pid=16658)
Unmounting complete

The last two lines only appear after interrupting the program with ctrl-c. I changed some characters in the URL of the clientResponseError, because I'm not sure if my login credencials are encoded in there.

N-Coder commented 4 years ago

Differences in the SSO login flow are likely the cause of this. The POST data sent for Uni Passau can be found in the (possibly outdated) implementation of the flow here, the parse_ methods for reading data from the HTML responses can be found here. You could try tracking what actually happens when logging in via your browser using its network request debugging tool and then adapt the studip-fuse code accordingly until it works. I guess that I unfortunately can't help you much with that, as those requests all need login credentials.

As an alternative, the recommended way for accessing Stud.IP would be the OAuth API, which doesn't require handling user login credentials. Unfortunately, there's a catch: Using OAuth requires studip-fuse being registered as a client application with the respective Stud.IP instance by one of its administrators. For Passau, @thomashackl (who is also a core developer of Stud.IP) thankfully did exactly that. Maybe you could contact the administrators of your instance and ask whether they could do the same?