-
Notifications
You must be signed in to change notification settings - Fork 26
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
[management-api] User registration fails #1209
Comments
brasseld
changed the title
User registration fails
[management-api] User registration fails
Apr 13, 2018
DaspawnW
pushed a commit
to DaspawnW/gravitee-management-rest-api
that referenced
this issue
Apr 13, 2018
There are two ideas how to handle it. |
DaspawnW
pushed a commit
to DaspawnW/gravitee-management-rest-api
that referenced
this issue
May 3, 2018
aelamrani
pushed a commit
to gravitee-io/gravitee-management-rest-api
that referenced
this issue
May 3, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Registration of a new user fails with
No User Found with Username
.As I can see in the Sourcecode you are looking for a user by username:
https://github.com/gravitee-io/gravitee-management-rest-api/blob/b70f0b4777936446a9cf069506506a970ef3e6c0/gravitee-management-api-service/src/main/java/io/gravitee/management/service/impl/UserServiceImpl.java#L250
Then you are creating a new user with a new user id:
https://github.com/gravitee-io/gravitee-management-rest-api/blob/b70f0b4777936446a9cf069506506a970ef3e6c0/gravitee-management-api-service/src/main/java/io/gravitee/management/service/impl/UserServiceImpl.java#L256
Then you are saving the new user with an update on the userRepository:
https://github.com/gravitee-io/gravitee-management-rest-api/blob/b70f0b4777936446a9cf069506506a970ef3e6c0/gravitee-management-api-service/src/main/java/io/gravitee/management/service/impl/UserServiceImpl.java#L265
And the update calls the MongoUserRepository in my case. There you are looking for an already existing user, as you see from the previous steps you are overwriting the UUID by a new one. So the find will fail and throw an exception.
https://github.com/gravitee-io/gravitee-repository-mongodb/blob/fbc2aacae118fe53100204181547bfc896bf3aae/src/main/java/io/gravitee/repository/mongodb/management/MongoUserRepository.java#L114
Expected Behavior
Registration will be finished with new user
Current Behavior
Login fails with described exception.
Possible Solution
Remove the line 256 from the UserServiceImpl.java class or check if it has already an id then call update otherwise create on the userRepository.
Not really nice, but I think this will work:
Steps to Reproduce (for bugs)
Context
No possibility to register
Your Environment
The text was updated successfully, but these errors were encountered: