JanssenProject / JanssenProject/jans
fix(docs): oidc-jans-script.py fails to find existing user during authentication and creates duplicate records.
- Dominant language
- Java
- Stars
- 648
- Forks
- 174
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 110
Description
I've recently setup the person_authentication oidc-jans-script.py custom script in my project and I found whenever reauthenticating a new user was being created even when the user record already existed.
I found through debugging that the user service fails to find the record, even though the value for `jansExtUid` is exactly the same as the existing record.
I believe the problem exists at the line of code below:
https://github.com/JanssenProject/jans/blob/7f82250ca36d05ae3c0ab8f5ea13ba0d0dc3f4b7/docs/script-catalog/person_authentication/oidc/oidc-jans-script.py#L282C48-L282C48
I'm not 100% familiar with this project, but I think this line of code:
```python
foundUser = userService.getUserByAttribute("jansExtUid", "oidc:"+userId)
```
should be:
```python
foundUser = userService.getUserByAttribute("jansExtUid", "oidc:"+userId, True)
```
After using the overloaded function and setting the `multiValued` paramater to `True` it solves the problem.
I think `jansExtUid` may have previously not have been multivalued but now is and the oidc script may be out of date.
Contributor guide
Assessment
This issue has not been assessed yet.