Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

OpenID login #716

Merged
merged 2 commits into from
Apr 20, 2020
Merged

OpenID login #716

merged 2 commits into from
Apr 20, 2020

Conversation

janno42
Copy link
Collaborator

@janno42 janno42 commented Mar 30, 2020

see e-valuation/EvaP#1366 for reference

@janno42 janno42 requested review from Bartzi and jeriox March 30, 2020 20:07
@janno42 janno42 force-pushed the openid branch 3 times, most recently from 409f3d9 to d9a9d18 Compare March 30, 2020 21:11
Copy link
Collaborator

@jeriox jeriox left a comment

Choose a reason for hiding this comment

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

Set up locally with the HPI OpenID provider, works flawlessly.

_1327/main/utils.py Outdated Show resolved Hide resolved
</a>
{% endbuttons %}
{% else %}
<form action="{% url 'login' %}" method="post" class="form-horizontal" role="form">
Copy link
Collaborator

Choose a reason for hiding this comment

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

as this posts to the plain login route, the user is shown the openid login screen instead of a form with errors after entering wrong user credentials

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, I can confirm that problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i can think of only one use case where this might be a problem: when the admin user wants to login on production and provides wrong credentials. all other users will use open id on production, and in development open id will be deactivated.
so i don't think we need to add additional code for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you might be right, but this is still some kind of a bug and it should be handled correctly. That means that even an admin user should see the login form and the system should tell him that has been a problem logging him in, because username and password did not match

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if anyone wants to look into this in the next days - feel welcome. it would require some logic to know which login was used and errors then need to be handled accordingly.
as this pr is blocking our much needed production update and i currently don't want to invest more time into the project than absolutely necessary, i won't implement it myself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see #721 for this issue

Bartzi
Bartzi previously requested changes Apr 5, 2020
Copy link
Collaborator

@Bartzi Bartzi left a comment

Choose a reason for hiding this comment

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

Works quite well ❤️
Please have a look at my comments and please, also add oidc to the forbidden URL list in settings.py.
It would also make sense to add some tests that test the following:

  1. If OpenID login is not enabled. The user should see the local login page and be able to log in through that page.
  2. If OpenID login is available. The user should be able to login via OpenID (only add this test if it is possible to somehow mock the OpenID procedure.
  3. If OpenID login is available and the user wants to login using a local user, he should see the local login page and if he makes a mistake during login, he should still the page, but with an error message instead of the openID login page.

_1327/settings.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
</a>
{% endbuttons %}
{% else %}
<form action="{% url 'login' %}" method="post" class="form-horizontal" role="form">
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, I can confirm that problem.

README.md Outdated Show resolved Hide resolved
@janno42
Copy link
Collaborator Author

janno42 commented Apr 6, 2020

about the tests:

  1. the local login form is tested in user_management.tests.UsecaseTests
  2. mocking the openid login is not in scope for this pr. if someone feels like this is really needed, we have to open an issue for that :)
  3. see the discussion in user_management/templates/login.html

@Bartzi
Copy link
Collaborator

Bartzi commented Apr 6, 2020

Yes, right 😅 the local login is already tested.
But it would make sense to check that changing the openid setting actually changes the behaviour of the page the way it is intended to be. This is just one small test 😉.
I think you are right about the OpenID mocking, please open a new issue for that.

@janno42 janno42 dismissed Bartzi’s stale review April 20, 2020 15:05

the remaining issue now lives in #721

@janno42 janno42 merged commit 3c84498 into fsr-de:master Apr 20, 2020
@janno42 janno42 deleted the openid branch April 20, 2020 15:15
janno42 added a commit that referenced this pull request Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants