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

[WIP] Make anitya use authlib instead of social_auth #1220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LenkaSeg
Copy link
Contributor

Allow authentication with Fedora, GitHub and Google.
This PR aims to get rid of the social_auth library and use authlib instead.

Related issue #1139

@LenkaSeg LenkaSeg requested a review from a team as a code owner November 12, 2021 08:10
@LenkaSeg LenkaSeg changed the title Migrate social_auth to authlib [WIP] Migrate social_auth to authlib Nov 12, 2021
@LenkaSeg
Copy link
Contributor Author

What is working so far: authentication with GitHub and Google.
What is needed: Fedora, create a new social table in models, do something with the next, so it does not redirect to main page, tests, documentation.

@softwarefactory-project-zuul
Copy link

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

@lgtm-com
Copy link

lgtm-com bot commented Nov 12, 2021

This pull request introduces 2 alerts when merging ffbba79 into b16ca5e - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

@Zlopez Zlopez linked an issue Nov 15, 2021 that may be closed by this pull request
requirements.txt Outdated
@@ -11,7 +11,6 @@ ordered-set>=3.1, <5.0.0
packaging>=20.0 # (no upper limit, this is a calendar-based version)
python-dateutil>=2.8.0, <3.0.0
semver>=2.8.1, <3.0.0
social-auth-app-flask>=1.0.0, <2.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add the authlib to requirements.txt as well.

@@ -42,6 +42,7 @@
fedora-messaging,
python3-alembic,
python3-arrow,
python-authlib,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice that the authlib is available in Fedora, one less package to download from PyPi.

SSE_FEED="http://firehose.libraries.io/events",
CRON_POOL=10, # Number of workers for check service
CHECK_TIMEOUT=600, # Timeout for check service
# When this number of failed checks is reached,
# project will be automatically removed, if no version was retrieved yet
CHECK_ERROR_THRESHOLD=100,
# Enabled authentication backends
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be also done in the example config and config for vagrant and container setup.

@@ -0,0 +1,59 @@
import flask
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file deserves some comments. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that the social_auth stuff was registered as flask blueprint in the app.py, so I was trying to make it similar.
The rest is from authlib examples. The def oauthlogin is usually named login in the authlib documentation. I renamed it because there already is login function in ui.py.
Then I created the tokens in github and google for the anitya app and since both parties send a different user_info, so it is processed differently.
I will add docstrings and comments.

@LenkaSeg LenkaSeg changed the title [WIP] Migrate social_auth to authlib [WIP] Make anitya use authlib instead of social_auth Nov 15, 2021
@romulasry
Copy link

This would be nice for https://rpmfusion.org/ next. Good job.

@Zlopez
Copy link
Contributor

Zlopez commented Apr 28, 2022

Because there is now initiative working on Flask OIDC to remove the deprecated parts, we should probably use it instead of using authlib directly.

@romulasry
Copy link

romulasry commented Jan 29, 2023

@Zlopez Zlopez mentioned this pull request Jul 11, 2024
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound

<<<<<<< HEAD

Check failure

Code scanning / CodeQL

Syntax error Error

Syntax Error (in Python 3).
Comment on lines +220 to +224
#if user.oauth.count() == 0:
# raise IntegrityError(
# "Missing authlib table",
# {"authlib": None, "email": user.email},
# None,

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Copy link

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/dc194463201c4311ac2115d0343ab20d

fi-tox-mypy FAILURE in 4m 09s
fi-tox-lint FAILURE in 4m 56s
fi-tox-format FAILURE in 5m 00s
fi-tox-python310 FAILURE in 5m 10s
fi-tox-python311 FAILURE in 5m 22s
fi-tox-python312 FAILURE in 5m 47s
fi-tox-docs FAILURE in 5m 03s
✔️ fi-tox-bandit SUCCESS in 4m 54s
fi-tox-diff-cover FAILURE in 6m 16s

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

Successfully merging this pull request may close these issues.

Migrate from social_auth to something else
3 participants