use of org.keycloak.storage.jpa.entity.BrokerLinkEntity in project keycloak by keycloak.
the class JpaUserFederatedStorageProvider method addFederatedIdentity.
@Override
public void addFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel link) {
createIndex(realm, userId);
BrokerLinkEntity entity = new BrokerLinkEntity();
entity.setRealmId(realm.getId());
entity.setUserId(userId);
entity.setBrokerUserId(link.getUserId());
entity.setIdentityProvider(link.getIdentityProvider());
entity.setToken(link.getToken());
entity.setBrokerUserName(link.getUserName());
entity.setStorageProviderId(new StorageId(userId).getProviderId());
em.persist(entity);
}
use of org.keycloak.storage.jpa.entity.BrokerLinkEntity in project keycloak by keycloak.
the class JpaUserFederatedStorageProvider method updateFederatedIdentity.
@Override
public void updateFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel model) {
createIndex(realm, userId);
BrokerLinkEntity entity = getBrokerLinkEntity(realm, userId, model.getIdentityProvider());
if (entity == null)
return;
entity.setBrokerUserName(model.getUserName());
entity.setBrokerUserId(model.getUserId());
entity.setToken(model.getToken());
em.persist(entity);
em.flush();
}
use of org.keycloak.storage.jpa.entity.BrokerLinkEntity in project keycloak by keycloak.
the class JpaUserFederatedStorageProvider method removeFederatedIdentity.
@Override
public boolean removeFederatedIdentity(RealmModel realm, String userId, String socialProvider) {
BrokerLinkEntity entity = getBrokerLinkEntity(realm, userId, socialProvider);
if (entity == null)
return false;
em.remove(entity);
return true;
}
Aggregations