OIDC handling and linking closes #171 #192
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
question
S
UX research
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: local-it/mitgliederverwaltung#192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/oidc_handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description of the implemented changes
The changes were:
#171
What has been changed?
See docs/oidc-account-linking.md
Definition of Done
Code Quality
Accessibility
Testing
WIP: OIDC handling and linkingto WIP: OIDC handling and linking closes #171a1b0318b1cto07cb1ab57cWIP: OIDC handling and linking closes #171to OIDC handling and linking closes #171@ -174,0 +188,4 @@new_email = Map.get(oidc_user_info, "preferred_username")changeset|> Ash.Changeset.change_attribute(:oidc_id, oidc_id)Does this do anything? it looks like
oidc_idis the same value we're getting out of the changeset a few lines above.On line 184, oidc_id is taken out of the changeset as an argument, but on line 191 it is set as an attribute. These are two different things in Ash:
Arguments are temporary values that are passed to the action
Attributes are the persisted fields in the data model So the code transforms the argument into an attribute that is stored in the database.
@ -174,0 +191,4 @@|> Ash.Changeset.change_attribute(:oidc_id, oidc_id)# Update email if it differs from OIDC provider|> then(fn cs ->if new_email && to_string(cs.data.email) != new_email doIs the equality check needed? From the ash docs:
@ -0,0 +84,4 @@endenddefp handle_existing_user(Removing this function and inlining its code instead would be shorter and could be more readable, even at the cost of an extra level of indentation above.
@ -0,0 +25,4 @@Map.get(session, "oidc_linking_user_info"),{:ok, user} <- Ash.get(Mv.Accounts.User, user_id) do# Check if user is passwordlessif passwordless?(user) doHmm, is there a valid case where a user does not have a password, and also does not have an OIDC id? Intuitively, I'd have assumed this case to result in an error.
It's an edge case but still possible. An admin creates a user without a password so the user can set the password. Then the user login via OIDC. Then the system would get stuck without catching this case.
82e2fbb109to55fb845855