Search in sources :

Example 1 with FederatedUserRequiredActionEntity

use of org.keycloak.storage.jpa.entity.FederatedUserRequiredActionEntity in project keycloak by keycloak.

the class JpaUserFederatedStorageProvider method addRequiredAction.

@Override
public void addRequiredAction(RealmModel realm, String userId, String action) {
    Key key = new FederatedUserRequiredActionEntity.Key(userId, action);
    if (em.find(FederatedUserRequiredActionEntity.class, key) == null) {
        createIndex(realm, userId);
        FederatedUserRequiredActionEntity entity = new FederatedUserRequiredActionEntity();
        entity.setUserId(userId);
        entity.setRealmId(realm.getId());
        entity.setStorageProviderId(new StorageId(userId).getProviderId());
        entity.setAction(action);
        em.persist(entity);
    }
}
Also used : FederatedUserRequiredActionEntity(org.keycloak.storage.jpa.entity.FederatedUserRequiredActionEntity) StorageId(org.keycloak.storage.StorageId) Key(org.keycloak.storage.jpa.entity.FederatedUserRequiredActionEntity.Key)

Aggregations

StorageId (org.keycloak.storage.StorageId)1 FederatedUserRequiredActionEntity (org.keycloak.storage.jpa.entity.FederatedUserRequiredActionEntity)1 Key (org.keycloak.storage.jpa.entity.FederatedUserRequiredActionEntity.Key)1