Skip to content

LDAP login: Python package jose missing, Python syntax error during login #416

@SethosII

Description

@SethosII

Describe the bug

I try to setup LDAP login with Active Directory. There is the Beep Boop, Error! page after I enter my credentials and click on login. The logs show this:

uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/social_core/backends/open_id_connect.py", line 5, in <module>
uwsgi_1      |     from jose import jwk, jwt
uwsgi_1      | ModuleNotFoundError: No module named 'jose'

Therefore I added jose to the requirements.txt and rebuilt the image. Now I still get the Beep Boop, Error! page after I enter me credentials and click on login, but the logs show this:

uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/social_core/backends/open_id_connect.py", line 5, in <module>
uwsgi_1      |     from jose import jwk, jwt
uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/jose.py", line 546
uwsgi_1      |     print decrypt(deserialize_compact(jwt), {'k':key},
uwsgi_1      |           ^
uwsgi_1      | SyntaxError: invalid syntax**

So this seeams to be a Python error not a configuration error. Also, jose seems to be outdated (last release on pypi 2015) so probably it doesn't work with Python 3. Do you have any ideas how to fix this?

To Reproduce

Setup sregsitry for LDAP login and try to login.

I followed these steps:

sudo apt install docker.io docker-compose
git clone https://github.com/singularityhub/sregistry
cd sregistry/
cp shub/dummy-settings.yaml settings.yaml
vi settings.yaml (I modified SECRET_KEY, DOMAIN_NAME, DOMAIN_NAME_HTTP, REGISTRY_NAME, REGISTRY_URI, AUTH_LDAP_SERVER_URI, AUTH_LDAP_BIND_DN, AUTH_LDAP_BIND_PASSWORD, AUTH_LDAP_USER_SEARCH, AUTH_LDAP_GROUP_SEARCH, AUTH_LDAP_SUPERUSER_GROUP_FLAGS
vi Dockerfile (I modified ARG ENABLE_LDAP)
vi shub/settings.py (I modified ldap_auth)
sudo docker build --build-arg ENABLE_LDAP=true -t quay.io/vanessa/sregistry .
sudo docker-compose up
# during LDAP login:
uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/social_core/backends/open_id_connect.py", line 5, in <module>
uwsgi_1      |     from jose import jwk, jwt
uwsgi_1      | ModuleNotFoundError: No module named 'jose'
vi requirements.txt (I added jose)
# afterwards during LDAP login:
uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/social_core/backends/open_id_connect.py", line 5, in <module>
uwsgi_1      |     from jose import jwk, jwt
uwsgi_1      |   File "/usr/local/lib/python3.9/site-packages/jose.py", line 546
uwsgi_1      |     print decrypt(deserialize_compact(jwt), {'k':key},
uwsgi_1      |           ^
uwsgi_1      | SyntaxError: invalid syntax**

Expected behavior

Login should work.

If applicable, add versions and screenshots to help explain your problem.

I used a git clone of the master branch to setup sregistry on a fresh installation of Ubuntu 22.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions