Пример #1
0
 protected UserFederationProvider getFederationLink(RealmModel realm, UserModel user) {
   if (user.getFederationLink() == null) return null;
   for (UserFederationProviderModel fed : realm.getUserFederationProviders()) {
     if (fed.getId().equals(user.getFederationLink())) {
       return getFederationProvider(fed);
     }
   }
   return null;
 }
Пример #2
0
 protected UserModel registerWithFederation(RealmModel realm, UserModel user) {
   for (UserFederationProviderModel federation : realm.getUserFederationProviders()) {
     UserFederationProvider fed = getFederationProvider(federation);
     if (fed.synchronizeRegistrations()) {
       user.setFederationLink(federation.getId());
       UserModel registered = fed.register(realm, user);
       managedUsers.put(registered.getId(), registered);
       return registered;
     }
   }
   return user;
 }