Commit 84d020d6 authored by michael.simon's avatar michael.simon
Browse files

Merge branch 'branch-2.6' into eval-oidc

parents 3e2d9bad c8088bae
......@@ -22,26 +22,26 @@
<parent>
<groupId>edu.kit.scc</groupId>
<artifactId>bwreg</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</parent>
<dependencies>
<dependency>
<groupId>edu.kit.scc</groupId>
<artifactId>bwreg-jpa</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>edu.kit.scc</groupId>
<artifactId>bwreg-service</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>edu.kit.scc</groupId>
<artifactId>bwreg-webapp</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
<type>war</type>
</dependency>
......
......@@ -17,7 +17,7 @@
<parent>
<groupId>edu.kit.scc</groupId>
<artifactId>bwreg</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</parent>
<dependencyManagement>
......
/*******************************************************************************
* 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;
import edu.kit.scc.webreg.entity.SamlAssertionEntity;
public interface SamlAssertionDao extends BaseDao<SamlAssertionEntity, Long> {
}
/*******************************************************************************
* 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;
import edu.kit.scc.webreg.entity.SamlAuthnRequestEntity;
public interface SamlAuthnRequestDao extends BaseDao<SamlAuthnRequestEntity, Long> {
}
/*******************************************************************************
* 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;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
public interface SamlIdpConfigurationDao extends BaseDao<SamlIdpConfigurationEntity, Long> {
SamlIdpConfigurationEntity findByHostname(String hostname);
SamlIdpConfigurationEntity findByEntityId(String entityId);
}
......@@ -18,4 +18,5 @@ public interface SamlUserDao extends BaseDao<SamlUserEntity, Long> {
String persistentId);
SamlUserEntity findByEppn(String eppn);
SamlUserEntity findByIdWithStore(Long id);
SamlUserEntity findByPersistent(String spId, String idpId, String persistentId);
}
/*******************************************************************************
* 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;
import java.util.List;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceSamlSpEntity;
public interface ServiceSamlSpDao extends BaseDao<ServiceSamlSpEntity, Long> {
List<ServiceSamlSpEntity> findByService(ServiceEntity service);
List<ServiceSamlSpEntity> findBySamlSp(SamlSpMetadataEntity sp);
}
/*******************************************************************************
* 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;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import edu.kit.scc.webreg.dao.SamlAssertionDao;
import edu.kit.scc.webreg.entity.SamlAssertionEntity;
import edu.kit.scc.webreg.entity.SamlUserEntity;
@Named
@ApplicationScoped
public class JpaSamlAssertionDao extends JpaBaseDao<SamlAssertionEntity, Long> implements SamlAssertionDao, Serializable {
private static final long serialVersionUID = 1L;
@Override
public Class<SamlAssertionEntity> getEntityClass() {
return SamlAssertionEntity.class;
}
}
/*******************************************************************************
* 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;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import edu.kit.scc.webreg.dao.SamlAuthnRequestDao;
import edu.kit.scc.webreg.entity.SamlAuthnRequestEntity;
@Named
@ApplicationScoped
public class JpaSamlAuthnRequestDao extends JpaBaseDao<SamlAuthnRequestEntity, Long> implements SamlAuthnRequestDao, Serializable {
private static final long serialVersionUID = 1L;
@Override
public Class<SamlAuthnRequestEntity> getEntityClass() {
return SamlAuthnRequestEntity.class;
}
}
/*******************************************************************************
* 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;
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.ListJoin;
import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.SamlIdpConfigurationDao;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
@Named
@ApplicationScoped
public class JpaSamlIdpConfigurationDao extends JpaBaseDao<SamlIdpConfigurationEntity, Long> implements SamlIdpConfigurationDao {
@Override
public SamlIdpConfigurationEntity findByEntityId(String entityId) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SamlIdpConfigurationEntity> criteria = builder.createQuery(SamlIdpConfigurationEntity.class);
Root<SamlIdpConfigurationEntity> root = criteria.from(SamlIdpConfigurationEntity.class);
criteria.where(
builder.equal(root.get("entityId"), entityId));
criteria.select(root);
try {
return em.createQuery(criteria).getSingleResult();
}
catch (NoResultException e) {
return null;
}
}
@Override
public SamlIdpConfigurationEntity findByHostname(String hostname) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SamlIdpConfigurationEntity> criteria = builder.createQuery(SamlIdpConfigurationEntity.class);
Root<SamlIdpConfigurationEntity> root = criteria.from(SamlIdpConfigurationEntity.class);
ListJoin<SamlIdpConfigurationEntity, String> elementJoin = root.joinList("hostNameList");
criteria.select(root);
criteria.where(
builder.equal(elementJoin.as(String.class), hostname));
try {
return em.createQuery(criteria).getSingleResult();
}
catch (NoResultException e) {
return null;
}
}
@Override
public Class<SamlIdpConfigurationEntity> getEntityClass() {
return SamlIdpConfigurationEntity.class;
}
}
......@@ -54,6 +54,26 @@ public class JpaSamlUserDao extends JpaBaseDao<SamlUserEntity, Long> implements
}
}
@Override
public SamlUserEntity findByPersistent(String spId, String idpId, String persistentId) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SamlUserEntity> criteria = builder.createQuery(SamlUserEntity.class);
Root<SamlUserEntity> user = criteria.from(SamlUserEntity.class);
criteria.where(builder.and(
builder.equal(user.get("persistentSpId"), spId),
builder.equal(user.get("persistentIdpId"), idpId),
builder.equal(user.get("persistentId"), persistentId)
));
criteria.select(user);
try {
return em.createQuery(criteria).getSingleResult();
}
catch (NoResultException e) {
return null;
}
}
@Override
public SamlUserEntity findByEppn(String eppn) {
CriteriaBuilder builder = em.getCriteriaBuilder();
......
/*******************************************************************************
* 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;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.ServiceSamlSpDao;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceSamlSpEntity;
@Named
@ApplicationScoped
public class JpaServiceSamlSpDao extends JpaBaseDao<ServiceSamlSpEntity, Long> implements ServiceSamlSpDao {
@Override
public List<ServiceSamlSpEntity> findByService(ServiceEntity service) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<ServiceSamlSpEntity> criteria = builder.createQuery(ServiceSamlSpEntity.class);
Root<ServiceSamlSpEntity> root = criteria.from(ServiceSamlSpEntity.class);
criteria.where(
builder.equal(root.get("service"), service));
criteria.select(root);
return em.createQuery(criteria).getResultList();
}
@Override
public List<ServiceSamlSpEntity> findBySamlSp(SamlSpMetadataEntity sp) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<ServiceSamlSpEntity> criteria = builder.createQuery(ServiceSamlSpEntity.class);
Root<ServiceSamlSpEntity> root = criteria.from(ServiceSamlSpEntity.class);
criteria.where(
builder.equal(root.get("sp"), sp));
criteria.select(root);
return em.createQuery(criteria).getResultList();
}
@Override
public Class<ServiceSamlSpEntity> getEntityClass() {
return ServiceSamlSpEntity.class;
}
}
package edu.kit.scc.webreg.entity;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Type;
@Entity(name = "SamlAssertionEntity")
@Table(name = "samlassertion")
public class SamlAssertionEntity extends AbstractBaseEntity {
private static final long serialVersionUID = 1L;
@Column(name = "assertion_data")
@Basic(fetch = FetchType.LAZY)
@Lob
@Type(type = "org.hibernate.type.TextType")
private String assertionData;
@Column(name = "valid_until")
private Date validUntil;
@ManyToOne(targetEntity = SamlUserEntity.class)
private SamlUserEntity user;
public String getAssertionData() {
return assertionData;
}
public void setAssertionData(String assertionData) {
this.assertionData = assertionData;
}
public Date getValidUntil() {
return validUntil;
}
public void setValidUntil(Date validUntil) {
this.validUntil = validUntil;
}
public SamlUserEntity getUser() {
return user;
}
public void setUser(SamlUserEntity user) {
this.user = user;
}
}
package edu.kit.scc.webreg.entity;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SamlAssertionEntity.class)
public abstract class SamlAssertionEntity_ extends edu.kit.scc.webreg.entity.AbstractBaseEntity_ {
public static volatile SingularAttribute<SamlMetadataEntity, String> assertionData;
public static volatile SingularAttribute<SamlMetadataEntity, Date> validUntil;
public static volatile SingularAttribute<SamlMetadataEntity, SamlUserEntity> user;
}
package edu.kit.scc.webreg.entity;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.hibernate.annotations.Type;
@Entity(name = "SamlAuthnRequestEntity")
@Table(name = "samlauthnrequest")
public class SamlAuthnRequestEntity extends AbstractBaseEntity {
private static final long serialVersionUID = 1L;
@Column(name = "authnrequest_data")
@Basic(fetch = FetchType.LAZY)
@Lob
@Type(type = "org.hibernate.type.TextType")
private String authnrequestData;
@Column(name = "valid_until")
private Date validUntil;
public Date getValidUntil() {
return validUntil;
}
public void setValidUntil(Date validUntil) {
this.validUntil = validUntil;
}
public String getAuthnrequestData() {
return authnrequestData;
}
public void setAuthnrequestData(String authnrequestData) {
this.authnrequestData = authnrequestData;
}
}
package edu.kit.scc.webreg.entity;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SamlAssertionEntity.class)
public abstract class SamlAuthnRequestEntity_ extends edu.kit.scc.webreg.entity.AbstractBaseEntity_ {
public static volatile SingularAttribute<SamlMetadataEntity, String> authnrequestData;
public static volatile SingularAttribute<SamlMetadataEntity, Date> validUntil;
}
/*******************************************************************************
* 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.entity;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "idpconfig")
public class SamlIdpConfigurationEntity extends SamlConfigurationEntity {
private static final long serialVersionUID = 1L;
@Column(name = "redirect", length = 2048)
private String redirect;
@ElementCollection
private List<String> hostNameList = new ArrayList<String>();
public List<String> getHostNameList() {
return hostNameList;
}
public void setHostNameList(List<String> hostNameList) {
this.hostNameList = hostNameList;
}
public String getRedirect() {
return redirect;
}
public void setRedirect(String redirect) {
this.redirect = redirect;
}
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SamlIdpConfigurationEntity.class)
public abstract