Commit d5b7cf78 authored by michael.simon's avatar michael.simon
Browse files

Merge remote-tracking branch 'origin/branch-2.7' into new-kit-layout

Conflicts:
	bwreg-webapp/src/main/webapp/welcome/index.xhtml
parents 94d5ce86 551f83b9
image: maven:latest
variables:
MAVEN_CLI_OPTS: "-s maven/settings.xml --batch-mode"
cache:
paths:
- .m2/
- target/
build:
stage: build
script:
mvn $MAVEN_CLI_OPTS compile
......@@ -18,6 +18,7 @@ import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.entity.RegistryStatus;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
......@@ -28,8 +29,7 @@ public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
List<RegistryEntity> findByServiceAndStatus(ServiceEntity service,
RegistryStatus status);
List<RegistryEntity> findByUserAndStatus(UserEntity user,
RegistryStatus... status);
List<RegistryEntity> findByIdentityAndStatus(IdentityEntity identity, RegistryStatus... status);
List<RegistryEntity> findByServiceAndUser(ServiceEntity service, UserEntity user);
......@@ -53,12 +53,9 @@ public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
List<RegistryEntity> findByServiceAndStatus(String serviceShortName,
RegistryStatus status, Date date, int limit);
List<RegistryEntity> findByServiceAndUserAndNotStatus(ServiceEntity service,
UserEntity user, RegistryStatus... status);
List<RegistryEntity> findRegistriesForDepro(String serviceShortName);
List<RegistryEntity> findByUserAndNotStatusAndNotHidden(UserEntity user,
List<RegistryEntity> findByIdentityAndNotStatusAndNotHidden(IdentityEntity identity,
RegistryStatus... status);
List<RegistryEntity> findByServiceAndNotStatus(ServiceEntity service,
......@@ -75,4 +72,14 @@ public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
RegistryStatus status);
List<RegistryEntity> findMissingIdentity();
List<RegistryEntity> findByServiceAndIdentityAndNotStatus(ServiceEntity service, IdentityEntity identity,
RegistryStatus... status);
List<RegistryEntity> findByIdentity(IdentityEntity identity);
List<RegistryEntity> findByUserAndStatus(UserEntity user, RegistryStatus... status);
RegistryEntity findByServiceAndIdentityAndStatus(ServiceEntity service, IdentityEntity identity,
RegistryStatus status);
}
......@@ -54,5 +54,9 @@ public interface RoleDao extends BaseDao<RoleEntity, Long> {
List<UserEntity> findUsersForRole(RoleEntity role);
List<GroupEntity> findGroupsForRole(RoleEntity role);
List<RoleEntity> findByUserIdList(List<Long> userIdList);
List<RoleEntity> findByIdentityId(Long identityId);
}
......@@ -10,11 +10,13 @@
******************************************************************************/
package edu.kit.scc.webreg.dao;
import java.util.List;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
public interface SamlIdpConfigurationDao extends BaseDao<SamlIdpConfigurationEntity, Long> {
SamlIdpConfigurationEntity findByHostname(String hostname);
List<SamlIdpConfigurationEntity> findByHostname(String hostname);
SamlIdpConfigurationEntity findByEntityId(String entityId);
......
......@@ -12,6 +12,7 @@ package edu.kit.scc.webreg.dao;
import java.util.List;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceSamlSpEntity;
......@@ -21,5 +22,7 @@ public interface ServiceSamlSpDao extends BaseDao<ServiceSamlSpEntity, Long> {
List<ServiceSamlSpEntity> findByService(ServiceEntity service);
List<ServiceSamlSpEntity> findBySamlSp(SamlSpMetadataEntity sp);
List<ServiceSamlSpEntity> findBySamlSpAndIdp(SamlIdpConfigurationEntity idp, SamlSpMetadataEntity sp);
}
......@@ -17,14 +17,16 @@ import edu.kit.scc.webreg.entity.SshPubKeyStatus;
public interface SshPubKeyDao extends BaseDao<SshPubKeyEntity, Long> {
List<SshPubKeyEntity> findByUser(Long userId);
List<SshPubKeyEntity> findByKey(String encodedKey);
List<SshPubKeyEntity> findByUserAndStatus(Long userId, SshPubKeyStatus keyStatus);
List<SshPubKeyEntity> findMissingIdentity();
List<SshPubKeyEntity> findByUserAndKey(Long userId, String encodedKey);
List<SshPubKeyEntity> findByIdentityAndKey(Long identityId, String encodedKey);
List<SshPubKeyEntity> findByUserAndStatusWithRegs(Long userId, SshPubKeyStatus keyStatus);
List<SshPubKeyEntity> findByIdentityAndStatusWithRegs(Long identityId, SshPubKeyStatus keyStatus);
List<SshPubKeyEntity> findByKey(String encodedKey);
List<SshPubKeyEntity> findByIdentityAndStatus(Long identityId, SshPubKeyStatus keyStatus);
List<SshPubKeyEntity> findByIdentity(Long identityId);
}
......@@ -16,6 +16,7 @@ import java.util.List;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserStatus;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
public interface UserDao extends BaseDao<UserEntity, Long> {
......@@ -31,4 +32,5 @@ public interface UserDao extends BaseDao<UserEntity, Long> {
List<UserEntity> findByStatus(UserStatus status);
UserEntity findByUidNumber(Long uidNumber);
List<UserEntity> findMissingIdentity();
List<UserEntity> findByIdentity(IdentityEntity identity);
}
......@@ -10,6 +10,8 @@
******************************************************************************/
package edu.kit.scc.webreg.dao.identity;
import java.util.List;
import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
......@@ -17,4 +19,6 @@ public interface IdentityDao extends BaseDao<IdentityEntity, Long> {
IdentityEntity findByUserId(Long userId);
List<IdentityEntity> findMissingTwoFaUserId();
}
......@@ -10,6 +10,8 @@
******************************************************************************/
package edu.kit.scc.webreg.dao.identity;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
......@@ -34,6 +36,12 @@ public class JpaIdentityDao extends JpaBaseDao<IdentityEntity, Long> implements
else
return user.getIdentity();
}
@Override
@SuppressWarnings({"unchecked"})
public List<IdentityEntity> findMissingTwoFaUserId() {
return em.createQuery("select e from IdentityEntity e where e.twoFaUserId is null or e.twoFaUserName is null").getResultList();
}
@Override
public Class<IdentityEntity> getEntityClass() {
......
......@@ -33,7 +33,9 @@ import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.GenericSortOrder;
import edu.kit.scc.webreg.dao.ops.AndPredicate;
import edu.kit.scc.webreg.dao.ops.MultipathOrPredicate;
import edu.kit.scc.webreg.dao.ops.OrPredicate;
import edu.kit.scc.webreg.dao.ops.PathObjectValue;
import edu.kit.scc.webreg.ds.DefaultDatasource;
import edu.kit.scc.webreg.entity.BaseEntity;
......@@ -197,7 +199,16 @@ public abstract class JpaBaseDao<T extends BaseEntity<PK>, PK extends Serializab
}
protected Predicate predicateFromObject(CriteriaBuilder builder, Root<T> root, String path, Object o) {
if (o instanceof OrPredicate) {
if (o instanceof MultipathOrPredicate) {
MultipathOrPredicate p = (MultipathOrPredicate) o;
List<Predicate> pList = new ArrayList<Predicate>();
for (Object object : p.getOperandList()) {
PathObjectValue pov = (PathObjectValue) object;
pList.add(predicateFromObject(builder, root, pov.getPath(), pov.getValue()));
}
return builder.or(pList.toArray(new Predicate[pList.size()]));
}
else if (o instanceof OrPredicate) {
OrPredicate p = (OrPredicate) o;
List<Predicate> pList = new ArrayList<Predicate>();
for (Object object : p.getOperandList()) {
......@@ -214,7 +225,10 @@ public abstract class JpaBaseDao<T extends BaseEntity<PK>, PK extends Serializab
return builder.and(pList.toArray(new Predicate[pList.size()]));
}
else if (o instanceof String) {
return builder.like(this.<String>resolvePath(root, path), "%" + o + "%");
String s = (String) o;
return builder.like(
builder.lower(this.<String>resolvePath(root, path)),
"%" + s.toLowerCase() + "%");
}
else {
return builder.equal(resolvePath(root, path), o);
......
......@@ -35,6 +35,7 @@ import edu.kit.scc.webreg.entity.SamlIdpMetadataEntityStatus;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceEntity_;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
@Named
@ApplicationScoped
......@@ -268,16 +269,34 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
return null;
}
}
@Override
public RegistryEntity findByServiceAndIdentityAndStatus(ServiceEntity service, IdentityEntity identity, RegistryStatus status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
criteria.where(builder.and(
builder.equal(root.get("service"), service),
builder.equal(root.get("identity"), identity),
builder.equal(root.get("registryStatus"), status)));
criteria.select(root);
try {
return em.createQuery(criteria).getSingleResult();
} catch (NoResultException e) {
return null;
}
}
@Override
public List<RegistryEntity> findByServiceAndUserAndNotStatus(ServiceEntity service, UserEntity user, RegistryStatus... status) {
public List<RegistryEntity> findByServiceAndIdentityAndNotStatus(ServiceEntity service, IdentityEntity identity, RegistryStatus... status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
List<Predicate> predList = new ArrayList<Predicate>();
predList.add(builder.equal(root.get("service"), service));
predList.add(builder.equal(root.get("user"), user));
predList.add(builder.equal(root.get("identity"), identity));
for (RegistryStatus s : status)
predList.add(builder.notEqual(root.get("registryStatus"), s));
......@@ -287,6 +306,27 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
return em.createQuery(criteria).getResultList();
}
@Override
public List<RegistryEntity> findByIdentityAndStatus(IdentityEntity identity, RegistryStatus... status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
List<Predicate> predList = new ArrayList<Predicate>();
for (RegistryStatus s : status)
predList.add(builder.equal(root.get("registryStatus"), s));
criteria.where(builder.and(
builder.equal(root.get(RegistryEntity_.identity), identity),
builder.or(predList.toArray(new Predicate[]{}))));
criteria.select(root);
criteria.distinct(true);
criteria.orderBy(builder.asc(root.get("id")));
return em.createQuery(criteria).getResultList();
}
@Override
public List<RegistryEntity> findByUserAndStatus(UserEntity user, RegistryStatus... status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
......@@ -307,9 +347,9 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
return em.createQuery(criteria).getResultList();
}
@Override
public List<RegistryEntity> findByUserAndNotStatusAndNotHidden(UserEntity user, RegistryStatus... status) {
public List<RegistryEntity> findByIdentityAndNotStatusAndNotHidden(IdentityEntity identity, RegistryStatus... status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
......@@ -321,7 +361,7 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
builder.isNull(serviceJoin.get(ServiceEntity_.hidden)),
builder.equal(serviceJoin.get(ServiceEntity_.hidden), false)));
predList.add(builder.equal(root.get(RegistryEntity_.user), user));
predList.add(builder.equal(root.get(RegistryEntity_.identity), identity));
for (RegistryStatus s : status)
predList.add(builder.notEqual(root.get("registryStatus"), s));
......@@ -346,6 +386,20 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
return em.createQuery(criteria).getResultList();
}
@Override
public List<RegistryEntity> findByIdentity(IdentityEntity identity) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
criteria.where(
builder.equal(root.get("identity"), identity));
criteria.select(root);
criteria.distinct(true);
criteria.orderBy(builder.asc(root.get("id")));
return em.createQuery(criteria).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<RegistryEntity> findMissingIdentity() {
......
......@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Set;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -23,16 +24,21 @@ import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.RoleDao;
import edu.kit.scc.webreg.dao.identity.IdentityDao;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.RoleEntity;
import edu.kit.scc.webreg.entity.RoleGroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserRoleEntity;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
@Named
@ApplicationScoped
public class JpaRoleDao extends JpaBaseDao<RoleEntity, Long> implements RoleDao {
@Inject
private IdentityDao identityDao;
@Override
public UserRoleEntity createNewUserRole() {
return new UserRoleEntity();
......@@ -116,6 +122,26 @@ public class JpaRoleDao extends JpaBaseDao<RoleEntity, Long> implements RoleDao
.setParameter("userId", userId).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<RoleEntity> findByIdentityId(Long identityId) {
List<RoleEntity> roleList = em.createQuery("select r.role from IdentityRoleEntity r where r.identity.id = :identityId")
.setParameter("identityId", identityId).getResultList();
IdentityEntity identity = identityDao.findById(identityId);
roleList.addAll(em.createQuery("select r.role from UserRoleEntity r where r.user in :userIdList")
.setParameter("userIdList", identity.getUsers()).getResultList());
return roleList;
}
@SuppressWarnings("unchecked")
@Override
public List<RoleEntity> findByUserIdList(List<Long> userIdList) {
return em.createQuery("select r.role from UserRoleEntity r where r.user.id in :userIdList")
.setParameter("userIdList", userIdList).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<UserEntity> findUsersForRole(RoleEntity role) {
......
......@@ -10,6 +10,8 @@
******************************************************************************/
package edu.kit.scc.webreg.dao.jpa;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import javax.persistence.NoResultException;
......@@ -43,7 +45,7 @@ public class JpaSamlIdpConfigurationDao extends JpaBaseDao<SamlIdpConfigurationE
}
@Override
public SamlIdpConfigurationEntity findByHostname(String hostname) {
public List<SamlIdpConfigurationEntity> findByHostname(String hostname) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SamlIdpConfigurationEntity> criteria = builder.createQuery(SamlIdpConfigurationEntity.class);
Root<SamlIdpConfigurationEntity> root = criteria.from(SamlIdpConfigurationEntity.class);
......@@ -54,7 +56,7 @@ public class JpaSamlIdpConfigurationDao extends JpaBaseDao<SamlIdpConfigurationE
builder.equal(elementJoin.as(String.class), hostname));
try {
return em.createQuery(criteria).getSingleResult();
return em.createQuery(criteria).getResultList();
}
catch (NoResultException e) {
return null;
......
......@@ -19,6 +19,7 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.ServiceSamlSpDao;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceSamlSpEntity;
......@@ -38,6 +39,20 @@ public class JpaServiceSamlSpDao extends JpaBaseDao<ServiceSamlSpEntity, Long> i
return em.createQuery(criteria).getResultList();
}
@Override
public List<ServiceSamlSpEntity> findBySamlSpAndIdp(SamlIdpConfigurationEntity idp, SamlSpMetadataEntity sp) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<ServiceSamlSpEntity> criteria = builder.createQuery(ServiceSamlSpEntity.class);
Root<ServiceSamlSpEntity> root = criteria.from(ServiceSamlSpEntity.class);
criteria.where(
builder.and(
builder.equal(root.get("sp"), sp),
builder.equal(root.get("idp"), idp)
));
criteria.select(root);
return em.createQuery(criteria).getResultList();
}
@Override
public List<ServiceSamlSpEntity> findBySamlSp(SamlSpMetadataEntity sp) {
CriteriaBuilder builder = em.getCriteriaBuilder();
......
......@@ -25,36 +25,43 @@ public class JpaSshPubKeyDao extends JpaBaseDao<SshPubKeyEntity, Long> implement
@Override
@SuppressWarnings("unchecked")
public List<SshPubKeyEntity> findByUser(Long userId) {
return em.createQuery("select e from SshPubKeyEntity e where e.user.id = :userId")
.setParameter("userId", userId).getResultList();
public List<SshPubKeyEntity> findByIdentity(Long identityId) {
return em.createQuery("select e from SshPubKeyEntity e where e.identity.id = :identityId")
.setParameter("identityId", identityId).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<SshPubKeyEntity> findMissingIdentity() {
return em.createQuery("select r from SshPubKeyEntity r where r.identity is null")
.getResultList();
}
@Override
@SuppressWarnings("unchecked")
public List<SshPubKeyEntity> findByUserAndStatus(Long userId, SshPubKeyStatus keyStatus) {
return em.createQuery("select e from SshPubKeyEntity e where e.user.id = :userId and e.keyStatus = :keyStatus")
.setParameter("userId", userId)
public List<SshPubKeyEntity> findByIdentityAndStatus(Long identityId, SshPubKeyStatus keyStatus) {
return em.createQuery("select e from SshPubKeyEntity e where e.identity.id = :identityId and e.keyStatus = :keyStatus")
.setParameter("identityId", identityId)
.setParameter("keyStatus", keyStatus)
.getResultList();
}
@Override
@SuppressWarnings("unchecked")
public List<SshPubKeyEntity> findByUserAndStatusWithRegs(Long userId, SshPubKeyStatus keyStatus) {
public List<SshPubKeyEntity> findByIdentityAndStatusWithRegs(Long identityId, SshPubKeyStatus keyStatus) {
return em.createQuery("select distinct e from SshPubKeyEntity e "
+ "left join fetch e.sshPubKeyRegistries "
+ "where e.user.id = :userId and e.keyStatus = :keyStatus")
.setParameter("userId", userId)
+ "where e.identity.id = :identityId and e.keyStatus = :keyStatus")
.setParameter("identityId", identityId)
.setParameter("keyStatus", keyStatus)
.getResultList();
}
@Override
@SuppressWarnings("unchecked")
public List<SshPubKeyEntity> findByUserAndKey(Long userId, String encodedKey) {
return em.createQuery("select e from SshPubKeyEntity e where e.user.id = :userId and e.encodedKey = :encodedKey")
.setParameter("userId", userId)
public List<SshPubKeyEntity> findByIdentityAndKey(Long identityId, String encodedKey) {
return em.createQuery("select e from SshPubKeyEntity e where e.identity.id = :userId and e.encodedKey = :encodedKey")
.setParameter("identityId", identityId)
.setParameter("encodedKey", encodedKey)
.getResultList();
}
......
......@@ -27,6 +27,7 @@ import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserEntity_;
import edu.kit.scc.webreg.entity.UserStatus;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
@Named
@ApplicationScoped
......@@ -41,6 +42,13 @@ public class JpaUserDao extends JpaBaseDao<UserEntity, Long> implements UserDao,
.setParameter("primaryGroup", group).getResultList();
}
@Override
@SuppressWarnings({"unchecked"})
public List<UserEntity> findByIdentity(IdentityEntity identity) {
return em.createQuery("select e from UserEntity e where e.identity = :identity")
.setParameter("identity", identity).getResultList();
}
@Override
@SuppressWarnings({"unchecked"})
public List<UserEntity> findOrderByUpdatedWithLimit(Date date, Integer limit) {
......
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.dao.jpa.oidc;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.jpa.JpaBaseDao;
import edu.kit.scc.webreg.dao.oidc.OidcUserDao;
import edu.kit.scc.webreg.entity.oidc.OidcRpConfigurationEntity;
import edu.kit.scc.webreg.entity.oidc.OidcUserEntity;
import edu.kit.scc.webreg.entity.oidc.OidcUserEntity_;
@Named
@ApplicationScoped
public class JpaOidcUserDao extends JpaBaseDao<OidcUserEntity, Long> implements OidcUserDao, Serializable {
private static final long serialVersionUID = 1L;
@Override
public OidcUserEntity findByIssuerAndSub(OidcRpConfigurationEntity issuer, String subjectId) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<OidcUserEntity> criteria = builder.createQuery(OidcUserEntity.class);
Root<OidcUserEntity> user = criteria.from(OidcUserEntity.class);
criteria.where(builder.and(
builder.equal(user.get(OidcUserEntity_.issuer), issuer),
builder.equal(user.get(OidcUserEntity_.subjectId), subjectId)
));
criteria.select(user);
criteria.distinct(true);
try {