fedora-infra / anitya

A cross-distribution upstream release monitoring project
https://release-monitoring.org
GNU General Public License v2.0
236 stars 104 forks source link

Fix AttributeError and HTTP Configuration for Fedora Login Authentication #1725

Closed NyuydineBill closed 4 months ago

NyuydineBill commented 4 months ago

Description:

Changes Made:

  1. Replaced the usage of the deprecated base64.encodestring with base64.encodebytes to resolve the AttributeError encountered during authentication with Fedora login in the Flask application.
  2. Updated the Flask application configuration to use HTTP instead of HTTPS to resolve server errors encountered during login.

Details:

Replacement of encodestring:

The AttributeError was raised due to the usage of the deprecated encodestring attribute of the base64 module. In Python 3, encodestring has been deprecated and replaced with encodebytes. This change ensures compatibility with Python 3 and resolves the error.

HTTP Configuration Update:

The Flask application was configured to run over HTTPS by default, causing server errors when logging in due to mismatched protocols. To address this issue, the SERVER_NAME configuration variable in the wsgi.py file was modified to use HTTP instead of HTTPS.

Steps Taken:

  1. Located the file causing the AttributeError (storage.py within the social_sqlalchemy package).
  2. Opened the storage.py file in a text editor.
  3. Replaced instances of base64.encodestring with base64.encodebytes.
  4. Modified the wsgi.py file to set the SERVER_NAME configuration variable to use HTTP (http://localhost:5000).
  5. Tested the changes locally to ensure successful authentication with Fedora login and resolved server errors during login.
  6. Created this pull request to contribute the fixes back to the original repository.

Additionally I have created a file named Auth_ERROR_README.md where you can see full steps to resolve this

softwarefactory-project-zuul[bot] commented 4 months ago

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/e7a03a80d7394f14a3eb4a6598f18958

:heavy_check_mark: fi-tox-mypy SUCCESS in 6m 38s :heavy_check_mark: fi-tox-lint SUCCESS in 6m 44s :x: fi-tox-format FAILURE in 4m 51s :heavy_check_mark: fi-tox-python38 SUCCESS in 10m 34s :heavy_check_mark: fi-tox-python39 SUCCESS in 8m 49s :heavy_check_mark: fi-tox-python310 SUCCESS in 10m 46s :heavy_check_mark: fi-tox-python311 SUCCESS in 10m 00s :heavy_check_mark: fi-tox-docs SUCCESS in 6m 25s :heavy_check_mark: fi-tox-bandit SUCCESS in 5m 57s :heavy_check_mark: fi-tox-diff-cover SUCCESS in 11m 44s

softwarefactory-project-zuul[bot] commented 4 months ago

Build succeeded. https://fedora.softwarefactory-project.io/zuul/buildset/af862d59781e48d68aa6bbf4aec06431

:heavy_check_mark: fi-tox-mypy SUCCESS in 5m 44s :heavy_check_mark: fi-tox-lint SUCCESS in 7m 47s :heavy_check_mark: fi-tox-format SUCCESS in 4m 55s :heavy_check_mark: fi-tox-python38 SUCCESS in 11m 21s :heavy_check_mark: fi-tox-python39 SUCCESS in 11m 18s :heavy_check_mark: fi-tox-python310 SUCCESS in 9m 23s :heavy_check_mark: fi-tox-python311 SUCCESS in 9m 08s :heavy_check_mark: fi-tox-docs SUCCESS in 6m 26s :heavy_check_mark: fi-tox-bandit SUCCESS in 7m 17s :heavy_check_mark: fi-tox-diff-cover SUCCESS in 9m 49s

Zlopez commented 4 months ago

I think we can close it as there are no files added, but you can write your solution to issue you created so it's documented.