If registration is not allowed for a realm it should not be possible to login with social login unless the user already exists
This commit is contained in:
parent
0301094fc9
commit
a65c8695d7
1 changed files with 4 additions and 0 deletions
|
@ -144,6 +144,10 @@ public class SocialResource {
|
||||||
UserModel user = realm.getUser(provider.getId() + "." + socialUser.getId());
|
UserModel user = realm.getUser(provider.getId() + "." + socialUser.getId());
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
if (!realm.isRegistrationAllowed()) {
|
||||||
|
return oauth.forwardToSecurityFailure("Registration not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
user = realm.addUser(provider.getId() + "." + socialUser.getId());
|
user = realm.addUser(provider.getId() + "." + socialUser.getId());
|
||||||
user.setAttribute(provider.getId() + ".id", socialUser.getId());
|
user.setAttribute(provider.getId() + ".id", socialUser.getId());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue