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:
Stian Thorgersen 2013-08-15 16:34:44 +01:00
parent 0301094fc9
commit a65c8695d7

View file

@ -144,6 +144,10 @@ public class SocialResource {
UserModel user = realm.getUser(provider.getId() + "." + socialUser.getId());
if (user == null) {
if (!realm.isRegistrationAllowed()) {
return oauth.forwardToSecurityFailure("Registration not allowed");
}
user = realm.addUser(provider.getId() + "." + socialUser.getId());
user.setAttribute(provider.getId() + ".id", socialUser.getId());