You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/01/27 11:22:45 UTC

[02/19] cxf-fediz git commit: FEDIZ-155 - Move .java components out of idp webapp and into a separate JAR

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java
deleted file mode 100644
index 5603e39..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPAImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.service.EntitlementDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Repository
-@Transactional
-public class EntitlementDAOJPAImpl implements EntitlementDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(EntitlementDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<Entitlement> getEntitlements(int start, int size) {
-        List<Entitlement> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select e from Entitlement e");
-        
-        //@SuppressWarnings("rawtypes")
-        List<?> entitlementEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-
-        for (Object obj : entitlementEntities) {
-            EntitlementEntity entity = (EntitlementEntity) obj;
-            list.add(entity2domain(entity));
-        }
-        
-        return list;
-    }
-    
-    @Override
-    public Entitlement addEntitlement(Entitlement entitlement) {
-        EntitlementEntity entity = new EntitlementEntity();
-        domain2entity(entitlement, entity);
-        em.persist(entity);
-        
-        LOG.debug("Entitlement '{}' added", entitlement.getName());
-        return entity2domain(entity);
-    }
-
-    @Override
-    public Entitlement getEntitlement(String name) {
-        return entity2domain(getEntitlementEntity(name, em));
-    }
-
-    @Override
-    public void updateEntitlement(String name, Entitlement entitlement) {
-        Query query = null;
-        query = em.createQuery("select e from Entitlement e where e.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        EntitlementEntity entitlementEntity = (EntitlementEntity)query.getSingleResult();
-        
-        domain2entity(entitlement, entitlementEntity);
-        
-        LOG.debug("Entitlement '{}' added", entitlement.getName());
-        em.persist(entitlementEntity);
-    }
-
-    @Override
-    public void deleteEntitlement(String name) {
-        Query query = null;
-        query = em.createQuery("select e from Entitlement e where e.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        Object entitlementObj = query.getSingleResult();
-        em.remove(entitlementObj);
-        
-        LOG.debug("Entitlement '{}' deleted", name);
-    }
-    
-    static EntitlementEntity getEntitlementEntity(String name, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select e from Entitlement e where e.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        return (EntitlementEntity)query.getSingleResult();
-    }
-    
-    public static void domain2entity(Entitlement entitlement, EntitlementEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (entitlement.getId() > 0) {
-            entity.setId(entitlement.getId());
-        }
-        //property 'internal' can't be changed, default is false
-        entity.setName(entitlement.getName());
-        entity.setDescription(entitlement.getDescription());
-    }
-    
-    public static Entitlement entity2domain(EntitlementEntity entity) {
-        Entitlement entitlement = new Entitlement();
-        entitlement.setId(entity.getId());
-        entitlement.setName(entity.getName());
-        entitlement.setDescription(entity.getDescription());
-        entitlement.setInternal(entity.isInternal());
-        return entitlement;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
deleted file mode 100644
index aec6b91..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-
-import org.apache.openjpa.persistence.jdbc.Index;
-
-@Entity(name = "Entitlement")
-public class EntitlementEntity {
-    
-    @Id
-    private int id;
-    
-    @Index
-    private String name;
-    
-    private String description;
-    
-    //Internal entities can't be updated, changed and deleted
-    //Default: false
-    private boolean internal;
-        
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-    
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public boolean isInternal() {
-        return internal;
-    }
-
-    public void setInternal(boolean internal) {
-        this.internal = internal;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java
deleted file mode 100644
index 5025a25..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityNotFoundException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-import org.apache.cxf.fediz.service.idp.service.IdpDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-@Repository
-@Transactional
-public class IdpDAOJPAImpl implements IdpDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(IdpDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<Idp> getIdps(int start, int size, List<String> expandList) {
-        List<Idp> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select i from IDP i");
-        
-        /*List serviceEntities = query.setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();*/
-        
-        //@SuppressWarnings("rawtypes")
-        List<?> idpEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-    
-        for (Object obj : idpEntities) {
-            IdpEntity entity = (IdpEntity) obj;
-            list.add(entity2domain(entity, expandList));
-        }
-        return list;
-    }
-    
-    @Override
-    public Idp getIdp(String realm, List<String> expandList) {
-        Query query = null;
-        query = em.createQuery("select i from IDP i where i.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        Object idpObj = query.getSingleResult();
-        return entity2domain((IdpEntity)idpObj, expandList);
-    }
-    
-    @Override
-    public Idp addIdp(Idp idp) {
-        IdpEntity entity = new IdpEntity();
-        domain2entity(idp, entity);
-        em.persist(entity);
-        
-        LOG.debug("IDP '{}' added", idp.getRealm());
-        return entity2domain(entity, Arrays.asList("all"));
-    }
-
-    @Override
-    public void updateIdp(String realm, Idp idp) {
-        Query query = null;
-        query = em.createQuery("select i from IDP i where i.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        IdpEntity idpEntity = (IdpEntity)query.getSingleResult();
-        
-        domain2entity(idp, idpEntity);
-        
-        em.persist(idpEntity);
-        
-        LOG.debug("IDP '{}' updated", idp.getRealm());
-    }
-
-    @Override
-    public void deleteIdp(String realm) {
-        Query query = null;
-        query = em.createQuery("select i from IDP i where i.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        Object idpObj = query.getSingleResult();
-        em.remove(idpObj);
-        
-        LOG.debug("IDP '{}' deleted", realm);
-    }
-    
-    @Override
-    public void addApplicationToIdp(Idp idp, Application application) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        
-        ApplicationEntity applicationEntity = null;
-        if (application.getId() != 0) {
-            applicationEntity = em.find(ApplicationEntity.class, application.getId());
-        } else {
-            applicationEntity = ApplicationDAOJPAImpl.getApplicationEntity(application.getRealm(), em);
-        }
-        
-        idpEntity.getApplications().add(applicationEntity);
-        
-        LOG.debug("Application '{}' added to IDP '{}'", application.getRealm(), idp.getRealm());
-    }
-    
-    @Override
-    public void removeApplicationFromIdp(Idp idp, Application application) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        
-        ApplicationEntity applicationEntity = null;
-        if (application.getId() != 0) {
-            applicationEntity = em.find(ApplicationEntity.class, application.getId());
-        } else {
-            applicationEntity = ApplicationDAOJPAImpl.getApplicationEntity(application.getRealm(), em);
-        }
-        
-        if (applicationEntity == null) {
-            throw new EntityNotFoundException("ApplicationEntity not found");
-        }
-        
-        if (!idpEntity.getApplications().remove(applicationEntity)) {
-            throw new EntityNotFoundException("ApplicationEntity not assigned to IdpEntity");
-        }
-                
-        LOG.debug("Application '{}' removed from IDP '{}'", application.getRealm(), idp.getRealm());
-    }
-    
-    @Override
-    public void addTrustedIdpToIdp(Idp idp, TrustedIdp trustedIdp) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        
-        TrustedIdpEntity trustedIdpEntity = null;
-        if (trustedIdp.getId() != 0) {
-            trustedIdpEntity = em.find(TrustedIdpEntity.class, trustedIdp.getId());
-        } else {
-            trustedIdpEntity = TrustedIdpDAOJPAImpl.getTrustedIdpEntity(trustedIdp.getRealm(), em);
-        }
-        
-        idpEntity.getTrustedIdps().add(trustedIdpEntity);
-        
-        LOG.debug("Trusted IDP '{}' added to IDP '{}'", trustedIdp.getRealm(), idp.getRealm());
-    }
-    
-    @Override
-    public void removeTrustedIdpFromIdp(Idp idp, TrustedIdp trustedIdp) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        
-        TrustedIdpEntity trustedIdpEntity = null;
-        if (trustedIdp.getId() != 0) {
-            trustedIdpEntity = em.find(TrustedIdpEntity.class, trustedIdp.getId());
-        } else {
-            trustedIdpEntity = TrustedIdpDAOJPAImpl.getTrustedIdpEntity(trustedIdp.getRealm(), em);
-        }
-        
-        idpEntity.getTrustedIdps().remove(trustedIdpEntity);
-        
-        LOG.debug("Trusted IDP '{}' removed from IDP '{}'", trustedIdp.getRealm(), idp.getRealm());
-    }
-        
-    @Override
-    public void addClaimToIdp(Idp idp, Claim claim) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        
-        ClaimEntity claimEntity = null;
-        if (claim.getId() != 0) {
-            claimEntity = em.find(ClaimEntity.class, claim.getId());
-        } else {
-            claimEntity = ClaimDAOJPAImpl.getClaimEntity(claim.getClaimType().toString(), em);
-        }
-        
-        idpEntity.getClaimTypesOffered().add(claimEntity);
-        
-        LOG.debug("Claim '{}' added to IDP '{}'", claim.getClaimType(), idp.getRealm());
-    }
-    
-    @Override
-    public void removeClaimFromIdp(Idp idp, Claim claim) {
-        IdpEntity idpEntity = null;
-        if (idp.getId() != 0) {
-            idpEntity = em.find(IdpEntity.class, idp.getId());
-        } else {
-            idpEntity = getIdpEntity(idp.getRealm(), em);
-        }
-        if (idpEntity == null) {
-            throw new EntityNotFoundException("IdpEntity not found");
-        }
-        
-        ClaimEntity claimEntity = null;
-        if (claim.getId() != 0) {
-            claimEntity = em.find(ClaimEntity.class, claim.getId());
-        } else {
-            claimEntity = ClaimDAOJPAImpl.getClaimEntity(claim.getClaimType().toString(), em);
-        }
-        if (claimEntity == null) {
-            throw new EntityNotFoundException("ClaimEntity not found");
-        }
-        
-        if (!idpEntity.getClaimTypesOffered().remove(claimEntity)) {
-            throw new EntityNotFoundException("ClaimEntity not assigned to IdpEntity");
-        }
-        
-        LOG.debug("Claim '{}' removed from IDP '{}'", claim.getClaimType(), idp.getRealm());
-    }
-    
-    static IdpEntity getIdpEntity(String realm, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select i from IDP i where i.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        return (IdpEntity)query.getSingleResult();
-    }
-    
-    public static void domain2entity(Idp idp, IdpEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (idp.getId() > 0) {
-            entity.setId(idp.getId());
-        }
-        
-        entity.setCertificate(idp.getCertificate());
-        entity.setCertificatePassword(idp.getCertificatePassword());
-        entity.setRealm(idp.getRealm());
-        entity.setServiceDescription(idp.getServiceDescription());
-        entity.setServiceDisplayName(idp.getServiceDisplayName());
-        entity.setHrds(idp.getHrds());
-        entity.setIdpUrl(idp.getIdpUrl());
-        entity.setProvideIdpList(idp.isProvideIdpList());
-        entity.setStsUrl(idp.getStsUrl());
-        entity.setUri(idp.getUri());
-        entity.setUseCurrentIdp(idp.isUseCurrentIdp());
-        entity.setRpSingleSignOutConfirmation(idp.isRpSingleSignOutConfirmation());
-        entity.setRpSingleSignOutCleanupConfirmation(idp.isRpSingleSignOutCleanupConfirmation());
-        
-        entity.getAuthenticationURIs().clear();
-        for (Map.Entry<String, String> item : idp.getAuthenticationURIs().entrySet()) {
-            entity.getAuthenticationURIs().put(item.getKey(), item.getValue());
-        }
-        
-        entity.getTokenTypesOffered().clear();
-        for (String item : idp.getTokenTypesOffered()) {
-            entity.getTokenTypesOffered().add(item);
-        }
-        
-        entity.getSupportedProtocols().clear();
-        for (String item : idp.getSupportedProtocols()) {
-            entity.getSupportedProtocols().add(item);
-        }        
-    }
-
-    
-    public static Idp entity2domain(IdpEntity entity, List<String> expandList) {
-        Idp idp = new Idp();
-        idp.setId(entity.getId());
-        idp.setCertificate(entity.getCertificate());
-        idp.setCertificatePassword(entity.getCertificatePassword());
-        idp.setRealm(entity.getRealm());
-        idp.setServiceDescription(entity.getServiceDescription());
-        idp.setServiceDisplayName(entity.getServiceDisplayName());
-        idp.setHrds(entity.getHrds());
-        idp.setIdpUrl(entity.getIdpUrl());
-        idp.setProvideIdpList(entity.isProvideIdpList());
-        idp.setStsUrl(entity.getStsUrl());
-        idp.setUri(entity.getUri());
-        idp.setUseCurrentIdp(entity.isUseCurrentIdp());
-        idp.setRpSingleSignOutConfirmation(entity.isRpSingleSignOutConfirmation());
-        idp.setRpSingleSignOutCleanupConfirmation(entity.isRpSingleSignOutCleanupConfirmation());
-        
-        if (expandList != null && (expandList.contains("all") || expandList.contains("applications"))) {
-            for (ApplicationEntity item : entity.getApplications()) {
-                Application application = ApplicationDAOJPAImpl.entity2domain(item, expandList);
-                idp.getApplications().add(application);
-            }
-        }
-        
-        if (expandList != null && (expandList.contains("all") || expandList.contains("trusted-idps"))) {
-            for (TrustedIdpEntity item : entity.getTrustedIdps()) {
-                TrustedIdp trustedIdp = TrustedIdpDAOJPAImpl.entity2domain(item);
-                idp.getTrustedIdps().add(trustedIdp);
-            }
-        }
-        
-        for (Map.Entry<String, String> item : entity.getAuthenticationURIs().entrySet()) {
-            idp.getAuthenticationURIs().put(item.getKey(), item.getValue());
-        }
-        
-        for (String item : entity.getTokenTypesOffered()) {
-            idp.getTokenTypesOffered().add(item);
-        }
-        
-        for (String item : entity.getSupportedProtocols()) {
-            idp.getSupportedProtocols().add(item);
-        }
-        
-        if (expandList != null && (expandList.contains("all") || expandList.contains("claims"))) {
-            for (ClaimEntity item : entity.getClaimTypesOffered()) {
-                idp.getClaimTypesOffered().add(ClaimDAOJPAImpl.entity2domain(item));
-            }
-        }
-        
-        return idp;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
deleted file mode 100644
index 986b28d..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
-import javax.persistence.MapKeyColumn;
-import javax.validation.constraints.NotNull;
-
-import org.apache.openjpa.persistence.jdbc.Index;
-
-@Entity(name = "IDP")
-public class IdpEntity {
-
-    @Id
-    private int id;
-
-    // Unique
-    // fed:TargetScope
-    @Index
-    @NotNull
-    private String realm; // wtrealm, whr
-
-    // Unique
-    // https://<host>:<port>/fediz-idp/<IDP uri>/
-    private String uri;
-
-    // Home Realm Discovery Service
-    // Spring EL
-    private String hrds;
-
-    // if HRDS can't determine the home realm, should
-    // the list of trusted IDPs be shown to make a choice
-    private boolean provideIdpList;
-
-    // If HRDS can't discover a home realm and displaying IDP list is not
-    // enabled
-    // it falls back to current IDP if an authentication domain is configured
-    private boolean useCurrentIdp;
-
-    // Store certificate in DB or filesystem, provide options?
-    // md:KeyDescriptor, use="signing"
-    private String certificate;
-
-    // Password to read the private key to sign metadata document
-    private String certificatePassword;
-
-    // fed:SecurityTokenSerivceEndpoint
-    @NotNull
-    private URL stsUrl;
-
-    // fedl:PassiveRequestorEndpoint
-    // published hostname, port must be configured
-    @NotNull
-    private URL idpUrl;
-    
-    private boolean rpSingleSignOutConfirmation;
-
-    // RoleDescriptor protocolSupportEnumeration=
-    // "http://docs.oasis-open.org/wsfed/federation/200706"
-    // "http://docs.oasis-open.org/ws-sx/ws-trust/200512"
-    // Could be more in the future
-    
-    @ElementCollection
-    @CollectionTable(name = "idp_protocols")
-    @Column(name = "protocol")
-    private List<String> supportedProtocols = new ArrayList<>();
-
-    // list of RPs and RP-IDPs from whom we accept SignInResponse
-    // which includes RP IDPs
-    // key: wtrealm
-    @ManyToMany(cascade = CascadeType.ALL)
-    private List<ApplicationEntity> applications = new ArrayList<>();
-
-    // list of trusted IDP from whom we accept SignInResponse
-    // key: whr
-    @ManyToMany(cascade = CascadeType.ALL)
-    private List<TrustedIdpEntity> trustedIdps = new ArrayList<>();
-
-    // which URI to redirect for authentication
-    // fediz-idp/<IDP uri>/login/auth/<auth URI>
-    // wauth to auth URI mapping
-    @ElementCollection
-    @MapKeyColumn(name = "name")
-    @Column(name = "value")
-    @CollectionTable(name = "idp_auth_uris", joinColumns = @JoinColumn(name = "idp_id"))
-    private Map<String, String> authenticationURIs = new HashMap<>();
-
-    // required to create Federation Metadata document
-    // fed:TokenTypesOffered
-    //[TODO] Tokens could be managed independently, but no real impact in IDP at runtime
-    //       Only informational purpose for metadata document, but required in STS
-    @ElementCollection
-    @CollectionTable(name = "idp_tokentypes")
-    @Column(name = "tokentype")
-    private List<String> tokenTypesOffered = new ArrayList<>();
-
-    // fed:ClaimTypesOffered
-    @ManyToMany(cascade = CascadeType.ALL)
-    private List<ClaimEntity> claimTypesOffered = new ArrayList<>();
-
-    // ServiceDisplayName
-    @NotNull
-    private String serviceDisplayName;
-
-    // ServiceDescription
-    private String serviceDescription;
-    
-    private boolean rpSingleSignOutCleanupConfirmation;
-
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-    
-    public String getRealm() {
-        return realm;
-    }
-
-    public void setRealm(String realm) {
-        this.realm = realm;
-    }
-
-    public String getUri() {
-        return uri;
-    }
-
-    public void setUri(String uri) {
-        this.uri = uri;
-    }
-
-    public String getHrds() {
-        return hrds;
-    }
-
-    public void setHrds(String hrds) {
-        this.hrds = hrds;
-    }
-
-    public boolean isProvideIdpList() {
-        return provideIdpList;
-    }
-
-    public void setProvideIdpList(boolean provideIdpList) {
-        this.provideIdpList = provideIdpList;
-    }
-
-    public boolean isUseCurrentIdp() {
-        return useCurrentIdp;
-    }
-
-    public void setUseCurrentIdp(boolean useCurrentIdp) {
-        this.useCurrentIdp = useCurrentIdp;
-    }
-
-    public String getCertificate() {
-        return certificate;
-    }
-
-    public void setCertificate(String certificate) {
-        this.certificate = certificate;
-    }
-
-    public String getCertificatePassword() {
-        return certificatePassword;
-    }
-
-    public void setCertificatePassword(String password) {
-        this.certificatePassword = password;
-    }
-
-    public URL getStsUrl() {
-        return stsUrl;
-    }
-
-    public void setStsUrl(URL stsUrl) {
-        this.stsUrl = stsUrl;
-    }
-
-    public URL getIdpUrl() {
-        return idpUrl;
-    }
-
-    public void setIdpUrl(URL idpUrl) {
-        this.idpUrl = idpUrl;
-    }
-
-    public List<String> getSupportedProtocols() {
-        return supportedProtocols;
-    }
-
-    public void setSupportedProtocols(List<String> supportedProtocols) {
-        this.supportedProtocols = supportedProtocols;
-    }
-
-    public List<ApplicationEntity> getApplications() {
-        return applications;
-    }
-
-    public void setApplications(List<ApplicationEntity> applications) {
-        this.applications = applications;
-    }
-
-    public List<TrustedIdpEntity> getTrustedIdps() {
-        return trustedIdps;
-    }
-
-    public void setTrustedIdps(List<TrustedIdpEntity> trustedIdps) {
-        this.trustedIdps = trustedIdps;
-    }
-
-    public Map<String, String> getAuthenticationURIs() {
-        return authenticationURIs;
-    }
-
-    public void setAuthenticationURIs(Map<String, String> authenticationURIs) {
-        this.authenticationURIs = authenticationURIs;
-    }
-
-    public List<String> getTokenTypesOffered() {
-        return tokenTypesOffered;
-    }
-
-    public void setTokenTypesOffered(List<String> tokenTypesOffered) {
-        this.tokenTypesOffered = tokenTypesOffered;
-    }
-
-    public List<ClaimEntity> getClaimTypesOffered() {
-        return claimTypesOffered;
-    }
-
-    public void setClaimTypesOffered(List<ClaimEntity> claimTypesOffered) {
-        this.claimTypesOffered = claimTypesOffered;
-    }
-
-    public String getServiceDisplayName() {
-        return serviceDisplayName;
-    }
-
-    public void setServiceDisplayName(String serviceDisplayName) {
-        this.serviceDisplayName = serviceDisplayName;
-    }
-
-    public String getServiceDescription() {
-        return serviceDescription;
-    }
-
-    public void setServiceDescription(String serviceDescription) {
-        this.serviceDescription = serviceDescription;
-    }
-    
-    public boolean isRpSingleSignOutConfirmation() {
-        return rpSingleSignOutConfirmation;
-    }
-
-    public void setRpSingleSignOutConfirmation(boolean rpSingleSignOutConfirmation) {
-        this.rpSingleSignOutConfirmation = rpSingleSignOutConfirmation;
-    }
-
-    public boolean isRpSingleSignOutCleanupConfirmation() {
-        return rpSingleSignOutCleanupConfirmation;
-    }
-
-    public void setRpSingleSignOutCleanupConfirmation(boolean rpSingleSignOutCleanupConfirmation) {
-        this.rpSingleSignOutCleanupConfirmation = rpSingleSignOutCleanupConfirmation;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java
deleted file mode 100644
index 0493bf9..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleDAOJPAImpl.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityNotFoundException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.domain.Role;
-import org.apache.cxf.fediz.service.idp.service.RoleDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-@Repository
-@Transactional
-public class RoleDAOJPAImpl implements RoleDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(RoleDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<Role> getRoles(int start, int size, List<String> expandList) {
-        List<Role> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select r from Role r");
-        
-        //@SuppressWarnings("rawtypes")
-        List<?> roleEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-    
-        for (Object obj : roleEntities) {
-            RoleEntity entity = (RoleEntity) obj;
-            list.add(entity2domain(entity, expandList));
-        }
-        return list;
-    }
-    
-    @Override
-    public Role getRole(String name, List<String> expandList) {
-        Query query = null;
-        query = em.createQuery("select r from Role r where r.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        Object roleObj = query.getSingleResult();
-        return entity2domain((RoleEntity)roleObj, expandList);
-    }
-    
-    @Override
-    public Role addRole(Role role) {
-        RoleEntity entity = new RoleEntity();
-        domain2entity(role, entity);
-        em.persist(entity);
-        
-        LOG.debug("Role '{}' added", role.getName());
-        return entity2domain(entity, Arrays.asList("all"));
-    }
-
-    @Override
-    public void updateRole(String name, Role role) {
-        Query query = null;
-        query = em.createQuery("select r from Role r where r.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        RoleEntity roleEntity = (RoleEntity)query.getSingleResult();
-        
-        domain2entity(role, roleEntity);
-        
-        em.persist(roleEntity);
-        
-        LOG.debug("Role '{}' updated", role.getName());
-    }
-
-    @Override
-    public void deleteRole(String name) {
-        Query query = null;
-        query = em.createQuery("select r from Role r where r.name=:name");
-        query.setParameter("name", name);
-        
-        //@SuppressWarnings("rawtypes")
-        Object roleObj = query.getSingleResult();
-        em.remove(roleObj);
-        
-        LOG.debug("Role '{}' deleted", name);
-    }
-    
-    @Override
-    public void addEntitlementToRole(Role role, Entitlement entitlement) {
-        RoleEntity roleEntity = null;
-        if (role.getId() != 0) {
-            roleEntity = em.find(RoleEntity.class, role.getId());
-        } else {
-            roleEntity = getRoleEntity(role.getName(), em);
-        }
-        
-        EntitlementEntity entitlementEntity = null;
-        if (entitlement.getId() != 0) {
-            entitlementEntity = em.find(EntitlementEntity.class, entitlement.getId());
-        } else {
-            entitlementEntity = EntitlementDAOJPAImpl.getEntitlementEntity(entitlement.getName(), em);
-        }
-        
-        roleEntity.getEntitlements().add(entitlementEntity);
-        
-        LOG.debug("Entitlement '{}' added to Role '{}'", entitlement.getName(), role.getName());
-    }
-    
-    @Override
-    public void removeEntitlementFromRole(Role role, Entitlement entitlement) {
-        RoleEntity roleEntity = null;
-        if (role.getId() != 0) {
-            roleEntity = em.find(RoleEntity.class, role.getId());
-        } else {
-            roleEntity = getRoleEntity(role.getName(), em);
-        }
-        
-        EntitlementEntity entitlementEntity = null;
-        if (entitlement.getId() != 0) {
-            entitlementEntity = em.find(EntitlementEntity.class, entitlement.getId());
-        } else {
-            entitlementEntity = EntitlementDAOJPAImpl.getEntitlementEntity(entitlement.getName(), em);
-        }
-        
-        if (entitlementEntity == null) {
-            throw new EntityNotFoundException("EntitlementEntity not found");
-        }
-        
-        if (!roleEntity.getEntitlements().remove(entitlementEntity)) {
-            throw new EntityNotFoundException("EntitlementEntity not assigned to RoleEntity");
-        }
-        
-        LOG.debug("Entitlement '{}' removed from Role '{}'", entitlement.getName(), role.getName());
-    }
-    
-    static RoleEntity getRoleEntity(String realm, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select i from IDP i where i.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        return (RoleEntity)query.getSingleResult();
-    }
-    
-    public static void domain2entity(Role role, RoleEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (role.getId() > 0) {
-            entity.setId(role.getId());
-        }
-        
-        entity.setName(role.getName());
-        entity.setDescription(role.getDescription());
-    }
-
-    
-    public static Role entity2domain(RoleEntity entity, List<String> expandList) {
-        Role role = new Role();
-        role.setId(entity.getId());
-        role.setName(entity.getName());
-        role.setDescription(entity.getDescription());
-        
-        if (expandList != null && (expandList.contains("all") || expandList.contains("entitlements"))) {
-            for (EntitlementEntity item : entity.getEntitlements()) {
-                Entitlement entitlement = EntitlementDAOJPAImpl.entity2domain(item);
-                role.getEntitlements().add(entitlement);
-            }
-        }
-        
-        return role;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
deleted file mode 100644
index 3b515c3..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToMany;
-
-import org.apache.openjpa.persistence.jdbc.Index;
-
-@Entity(name = "Role")
-public class RoleEntity {
-    
-    @Id
-    private int id;
-    
-    @Index
-    private String name;
-    
-    private String description;
-    
-    @ManyToMany(cascade = CascadeType.ALL)
-    private List<EntitlementEntity> entitlements = new ArrayList<>();
-    
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-    
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-    
-    public List<EntitlementEntity> getEntitlements() {
-        return entitlements;
-    }
-
-    public void setEntitlements(List<EntitlementEntity> entitlements) {
-        this.entitlements = entitlements;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java
deleted file mode 100644
index 16d05f1..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-import org.apache.cxf.fediz.service.idp.service.TrustedIdpDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Transactional
-@Repository
-public class TrustedIdpDAOJPAImpl implements TrustedIdpDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(TrustedIdpDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<TrustedIdp> getTrustedIDPs(int start, int size) {
-        List<TrustedIdp> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select t from TrustedIDP t");
-        
-        List<?> idpEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-
-        for (Object obj : idpEntities) {
-            TrustedIdpEntity entity = (TrustedIdpEntity) obj;
-            list.add(entity2domain(entity));
-        }
-        
-        return list;
-    }
-
-    @Override
-    public TrustedIdp getTrustedIDP(String realm) {
-        return entity2domain(getTrustedIdpEntity(realm, em));
-    }
-    
-    @Override
-    public TrustedIdp addTrustedIDP(TrustedIdp trustedIdp) {
-        TrustedIdpEntity entity = new TrustedIdpEntity();
-        domain2entity(trustedIdp, entity);
-        em.persist(entity);
-        
-        LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' added");
-        return entity2domain(entity);
-    }
-    
-    @Override
-    public void updateTrustedIDP(String realm, TrustedIdp trustedIdp) {
-        TrustedIdpEntity trustedIdpEntity = getTrustedIdpEntity(realm, em);
-        
-        domain2entity(trustedIdp, trustedIdpEntity);
-        em.persist(trustedIdpEntity);
-        
-        LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' updated");
-    }
-
-    @Override
-    public void deleteTrustedIDP(String realm) {
-        Query query = null;
-        query = em.createQuery("select t from TrustedIDP t where t.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        Object trustedIdpObj = query.getSingleResult();
-        em.remove(trustedIdpObj);
-        
-        LOG.debug("Trusted IDP '" + realm + "' deleted");
-    }
-    
-    static TrustedIdpEntity getTrustedIdpEntity(String realm, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select t from TrustedIDP t where t.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        return (TrustedIdpEntity)query.getSingleResult();
-    }
-    
-    public static void domain2entity(TrustedIdp trustedIDP, TrustedIdpEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (trustedIDP.getId() > 0) {
-            entity.setId(trustedIDP.getId());
-        }
-        entity.setCacheTokens(trustedIDP.isCacheTokens());
-        entity.setCertificate(trustedIDP.getCertificate());
-        entity.setDescription(trustedIDP.getDescription());
-        entity.setFederationType(trustedIDP.getFederationType());
-        entity.setLogo(trustedIDP.getLogo());
-        entity.setName(trustedIDP.getName());
-        entity.setProtocol(trustedIDP.getProtocol());
-        entity.setRealm(trustedIDP.getRealm());
-        entity.setIssuer(trustedIDP.getIssuer());
-        entity.setTrustType(trustedIDP.getTrustType());
-        entity.setUrl(trustedIDP.getUrl());
-        entity.setParameters(trustedIDP.getParameters());
-    }
-    
-    public static TrustedIdp entity2domain(TrustedIdpEntity entity) {
-        TrustedIdp trustedIDP = new TrustedIdp();
-        trustedIDP.setId(entity.getId());
-        trustedIDP.setCacheTokens(entity.isCacheTokens());
-        trustedIDP.setCertificate(entity.getCertificate());
-        trustedIDP.setDescription(entity.getDescription());
-        trustedIDP.setFederationType(entity.getFederationType());
-        trustedIDP.setLogo(entity.getLogo());
-        trustedIDP.setName(entity.getName());
-        trustedIDP.setProtocol(entity.getProtocol());
-        trustedIDP.setRealm(entity.getRealm());
-        trustedIDP.setIssuer(entity.getIssuer());
-        trustedIDP.setTrustType(entity.getTrustType());
-        trustedIDP.setUrl(entity.getUrl());
-        trustedIDP.setParameters(entity.getParameters());
-        return trustedIDP;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
deleted file mode 100644
index a4c6592..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.MapKeyColumn;
-import javax.validation.constraints.NotNull;
-
-import org.apache.cxf.fediz.service.idp.domain.FederationType;
-import org.apache.cxf.fediz.service.idp.domain.TrustType;
-import org.apache.openjpa.persistence.jdbc.Index;
-
-
-@Entity(name = "TrustedIDP")
-public class TrustedIdpEntity {
-
-    @Id
-    private int id;
-
-    //@Column(name = "REALM", nullable = true, length = FIELD_LENGTH)
-    @Index
-    @NotNull
-    private String realm;  //wtrealm, whr
-    
-    private String issuer;  //Validation of issuer name in SAMLResponse
-
-    // Should tokens be cached from trusted IDPs
-    // to avoid redirection to the trusted IDP again for next SignIn request
-    private boolean cacheTokens;
-    
-    //Could be read from Metadata, PassiveRequestorEndpoint
-    @NotNull
-    private String url;
-    
-    //Could be read from Metadata, md:KeyDescriptor, use="signing"
-    //Store certificate in DB or filesystem, provide options?
-    private String certificate;
-    
-    //Direct trust (signing cert imported), Indirect trust (CA certs imported, subject configured)
-    @Enumerated(EnumType.STRING)
-    private TrustType trustType;
-    
-    //Could be read from Metadata, RoleDescriptor protocolSupportEnumeration=
-    // "http://docs.oasis-open.org/wsfed/federation/200706"
-    // Metadata could provide more than one but one must be chosen
-    @TrustedIdpProtocolSupported
-    private String protocol;
-    
-    //FederateIdentity, FederateClaims
-    @Enumerated(EnumType.STRING)
-    private FederationType federationType;
-    
-    //optional (to provide a list of IDPs)
-    @NotNull
-    private String name;
-    
-    //optional (to provide a list of IDPs)
-    private String description;
-    
-    //optional (to provide a list of IDPs)
-    private String logo;
-    
-    // Additional (possibly protocol specific parameters)
-    @ElementCollection
-    @MapKeyColumn(name = "name")
-    @Column(name = "value")
-    @CollectionTable(name = "trusted_idp_parameters", joinColumns = @JoinColumn(name = "trusted_idp_id"))
-    private Map<String, String> parameters = new HashMap<>();
-    
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getIssuer() {
-        return issuer;
-    }
-
-    public void setIssuer(String issuer) {
-        this.issuer = issuer;
-    }
-    
-    public String getRealm() {
-        return realm;
-    }
-
-    public void setRealm(String realm) {
-        this.realm = realm;
-    }
-
-    public boolean isCacheTokens() {
-        return cacheTokens;
-    }
-
-    public void setCacheTokens(boolean cacheTokens) {
-        this.cacheTokens = cacheTokens;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getCertificate() {
-        return certificate;
-    }
-
-    public void setCertificate(String certificate) {
-        this.certificate = certificate;
-    }
-
-    public String getProtocol() {
-        return protocol;
-    }
-
-    public void setProtocol(String protocol) {
-        this.protocol = protocol;
-    }
-
-    public FederationType getFederationType() {
-        return federationType;
-    }
-
-    public void setFederationType(FederationType federationType) {
-        this.federationType = federationType;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getLogo() {
-        return logo;
-    }
-
-    public void setLogo(String logo) {
-        this.logo = logo;
-    }
-
-    public TrustType getTrustType() {
-        return trustType;
-    }
-
-    public void setTrustType(TrustType trustType) {
-        this.trustType = trustType;
-    }
-
-    public Map<String, String> getParameters() {
-        return parameters;
-    }
-
-    public void setParameters(Map<String, String> parameters) {
-        this.parameters = parameters;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupportValidator.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupportValidator.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupportValidator.java
deleted file mode 100644
index 75ac2ec..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupportValidator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.util.List;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-import org.apache.cxf.fediz.service.idp.protocols.ProtocolController;
-import org.apache.cxf.fediz.service.idp.spi.TrustedIdpProtocolHandler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Component;
-
-/**
- * Validate that the protocol is a valid IdP protocol
- */
-@Component
-public class TrustedIdpProtocolSupportValidator implements ConstraintValidator<TrustedIdpProtocolSupported, String> {
-
-    @Autowired
-    // Qualifier workaround. See http://www.jayway.com/2013/11/03/spring-and-autowiring-of-generic-types/
-    @Qualifier("trustedIdpProtocolControllerImpl")
-    private ProtocolController<TrustedIdpProtocolHandler> trustedIdpProtocolHandlers;
-    
-    @Override
-    public boolean isValid(String object, ConstraintValidatorContext constraintContext) {
-        
-        List<String> protocols = trustedIdpProtocolHandlers.getProtocols();
-        return protocols.contains(object);
-    }
-
-    @Override
-    public void initialize(TrustedIdpProtocolSupported constraintAnnotation) {
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupported.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupported.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupported.java
deleted file mode 100644
index 9c32af3..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpProtocolSupported.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.cxf.fediz.service.idp.service.jpa;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ METHOD, FIELD, ANNOTATION_TYPE })
-@Retention(RUNTIME)
-@Constraint(validatedBy = TrustedIdpProtocolSupportValidator.class)
-@Documented
-public @interface TrustedIdpProtocolSupported {
-
-    String message() default "{Protocol not supported}";
-
-    Class<?>[] groups() default { };
-
-    Class<? extends Payload>[] payload() default { };
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/security/GrantedAuthorityEntitlements.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/security/GrantedAuthorityEntitlements.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/security/GrantedAuthorityEntitlements.java
deleted file mode 100644
index 475ccd7..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/security/GrantedAuthorityEntitlements.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.service.security;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.domain.Role;
-import org.apache.cxf.fediz.service.idp.service.RoleDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.web.filter.GenericFilterBean;
-
-public class GrantedAuthorityEntitlements extends GenericFilterBean {
-
-    private static final Logger LOG = LoggerFactory.getLogger(GrantedAuthorityEntitlements.class);
-    
-    @Autowired
-    private RoleDAO roleDAO;
-    
-    @Override
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-        throws IOException, ServletException {
-        
-        try {
-            Authentication currentAuth = SecurityContextHolder.getContext().getAuthentication();
-            if (currentAuth == null) {
-                chain.doFilter(request, response);
-                return;
-            }
-            
-            final Set<GrantedAuthority> authorities = new HashSet<>();
-            if (currentAuth.getAuthorities() != null) {
-                authorities.addAll(currentAuth.getAuthorities());
-            }
-            
-            Iterator<? extends GrantedAuthority> authIt = currentAuth.getAuthorities().iterator();
-            while (authIt.hasNext()) {
-                GrantedAuthority ga = authIt.next();
-                String roleName = ga.getAuthority();
-                
-                try {
-                    Role role = roleDAO.getRole(roleName.substring(5), Arrays.asList("all"));
-                    for (Entitlement e : role.getEntitlements()) {
-                        authorities.add(new SimpleGrantedAuthority(e.getName()));
-                    }
-                } catch (Exception ex) {
-                    LOG.error("Role '{}' not found", roleName);
-                }
-            }
-            LOG.debug("Granted Authorities: {}", authorities);
-            
-            UsernamePasswordAuthenticationToken enrichedAuthentication = new UsernamePasswordAuthenticationToken(
-                currentAuth.getName(), currentAuth.getCredentials(), authorities);
-            enrichedAuthentication.setDetails(currentAuth.getDetails());
-            
-            SecurityContextHolder.getContext().setAuthentication(enrichedAuthentication);
-            LOG.info("Enriched AuthenticationToken added");
-            
-        } catch (Exception ex) {
-            LOG.error("Failed to enrich security context with entitlements", ex);
-        }
-        
-        chain.doFilter(request, response);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ApplicationProtocolHandler.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ApplicationProtocolHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ApplicationProtocolHandler.java
deleted file mode 100644
index 1cd9dc1..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ApplicationProtocolHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.spi;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.webflow.execution.RequestContext;
-
-public interface ApplicationProtocolHandler extends ProtocolHandler {
-    
-    boolean canHandleRequest(HttpServletRequest request);
-
-    void mapSignInRequest(RequestContext context);
-    
-    void mapSignInResponse(RequestContext context);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ProtocolHandler.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ProtocolHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ProtocolHandler.java
deleted file mode 100644
index 2c1c8c9..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/ProtocolHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.spi;
-
-public interface ProtocolHandler {
-
-    String getProtocol();
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/TrustedIdpProtocolHandler.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/TrustedIdpProtocolHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/TrustedIdpProtocolHandler.java
deleted file mode 100644
index a33591b..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/spi/TrustedIdpProtocolHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.spi;
-
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-import org.apache.cxf.ws.security.tokenstore.SecurityToken;
-import org.springframework.webflow.execution.RequestContext;
-
-public interface TrustedIdpProtocolHandler extends ProtocolHandler {
-    
-    boolean canHandleRequest(HttpServletRequest request);
-
-    // Only supports HTTP GET SignIn Requests
-    URL mapSignInRequest(RequestContext context, Idp idp, TrustedIdp trustedIdp);
-    
-    //Hook in <action-state id="validateToken"> of federation-signin-response.xml
-    SecurityToken mapSignInResponse(RequestContext context, Idp idp, TrustedIdp trustedIdp);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/WebUtils.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/WebUtils.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/WebUtils.java
deleted file mode 100644
index 4484312..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/WebUtils.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.fediz.service.idp.util;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.springframework.util.Assert;
-import org.springframework.webflow.context.servlet.ServletExternalContext;
-import org.springframework.webflow.execution.RequestContext;
-
-/**
- * Utility class to bind with webflow artifacts
- */
-public final class WebUtils {
-    
-    private WebUtils() {
-        super();
-    }
-
-    public static HttpServletRequest getHttpServletRequest(
-            final RequestContext context) {
-        Assert.isInstanceOf(ServletExternalContext.class,
-                context.getExternalContext(),
-                "Cannot obtain HttpServletRequest from event of type: "
-                        + context.getExternalContext().getClass().getName());
-        return (HttpServletRequest) context.getExternalContext()
-                .getNativeRequest();
-    }
-
-    public static HttpSession getHttpSession(final RequestContext context) {
-        HttpServletRequest httpServletRequest = getHttpServletRequest(context);
-        return httpServletRequest.getSession();
-    }
-
-    public static HttpServletResponse getHttpServletResponse(
-            final RequestContext context) {
-        Assert.isInstanceOf(ServletExternalContext.class,
-                context.getExternalContext(),
-                "Cannot obtain HttpServletResponse from event of type: "
-                        + context.getExternalContext().getClass().getName());
-        return (HttpServletResponse) context.getExternalContext()
-                .getNativeResponse();
-    }
-
-    public static String getHttpHeader(RequestContext requestContext, String headerName) {
-        return getHttpServletRequest(requestContext).getHeader(headerName);
-    }
-
-    public static void putAttributeInRequestScope(final RequestContext context,
-            final String attributeKey, final Object attributeValue) {
-        context.getRequestScope().put(attributeKey, attributeValue);
-    }
-
-    public static void putAttributeInExternalContext(
-            final RequestContext context, final String attributeKey,
-            final Object attributeValue) {
-        context.getExternalContext().getSessionMap()
-                .put(attributeKey, attributeValue);
-    }
-
-    /**
-     * put attribute in request or in session depending on storeInSession.
-     * 
-     * @param context
-     * @param attributeKey
-     */
-    public static void putAttribute(final RequestContext context,
-            final String attributeKey, final Object attributeValue,
-            boolean storeInSession) {
-        if (storeInSession) {
-            putAttributeInExternalContext(context, attributeKey, attributeValue);
-        } else {
-            putAttributeInRequestScope(context, attributeKey, attributeValue);
-        }
-    }
-
-    public static Object getAttributeFromRequestScope(
-            final RequestContext context, final String attributeKey) {
-        return context.getRequestScope().get(attributeKey);
-    }
-
-    public static Object getAttributeFromExternalContext(
-            final RequestContext context, final String attributeKey) {
-        return context.getExternalContext().getSessionMap()
-                .get(attributeKey);
-    }
-
-    /**
-     * get attribute from request; if not found get it from session.
-     * 
-     * @param context
-     * @param attributeKey
-     * @return the attribute from the request or session
-     */
-    public static Object getAttribute(final RequestContext context,
-            final String attributeKey) {
-        Object value = getAttributeFromRequestScope(context, attributeKey);
-        if (value != null) {
-            return value;
-        }
-        return getAttributeFromExternalContext(context, attributeKey);
-    }
-
-    public static Object removeAttributeFromRequestScope(
-            final RequestContext context, final String attributeKey) {
-        return context.getRequestScope().remove(attributeKey);
-    }
-
-    public static Object removeAttributeFromExternalContext(
-            final RequestContext context, final String attributeKey) {
-        return context.getExternalContext().getSessionMap()
-                .remove(attributeKey);
-    }
-
-    /**
-     * remove attribute from request and session.
-     * 
-     * @param context
-     * @param attributeKey
-     * @return the removed attribute
-     */
-    public static Object removeAttribute(final RequestContext context,
-            final String attributeKey) {
-        Object valueReq = removeAttributeFromRequestScope(context, attributeKey);
-        Object valueSes = removeAttributeFromExternalContext(context,
-                attributeKey);
-        if (valueSes != null) {
-            return valueSes; // not clean if request has different value !
-        }
-        if (valueReq != null) {
-            return valueReq;
-        }
-        return null;
-    }
-
-    public static void putAttributeInFlowScope(final RequestContext context,
-            final String attributeKey, final Object attributeValue) {
-        context.getFlowScope().put(attributeKey, attributeValue);
-    }
-
-    public static Object getAttributeFromFlowScope(
-            final RequestContext context, final String attributeKey) {
-        return context.getFlowScope().get(attributeKey);
-    }
-
-    public static Object removeAttributeFromFlowScope(
-            final RequestContext context, final String attributeKey) {
-        return context.getFlowScope().remove(attributeKey);
-    }
-
-    public static String getParamFromRequestParameters(
-            final RequestContext context, final String attributeKey) {
-        return context.getRequestParameters().get(attributeKey);
-    }
-
-    public static Cookie readCookie(
-            final RequestContext context, final String cookieName) {
-        HttpServletRequest httpServletRequest = getHttpServletRequest(context);
-        Cookie[] cookies = httpServletRequest.getCookies();
-        if (cookies != null) {
-            for (int i = 0; i < cookies.length; i++) {
-                if (cookies[i].getName().equals(cookieName)) {
-                    return cookies[i];
-                }
-            }
-        }
-        return null;
-    }
-
-    public static void addCookie(
-            final RequestContext context, final String cookieName, final String cookieValue) {
-        HttpServletResponse httpServletResponse = getHttpServletResponse(context);
-        Cookie cookie = new Cookie(cookieName, cookieValue);
-        cookie.setSecure(true);
-        cookie.setMaxAge(-1);
-        httpServletResponse.addCookie(cookie);
-    }
-
-    public static void removeCookie(
-            final RequestContext context, final String cookieName) {
-        HttpServletResponse httpServletResponse = getHttpServletResponse(context);
-        Cookie cookie = readCookie(context, cookieName);
-        if (cookie != null) {
-            cookie.setMaxAge(0);
-            cookie.setValue("");
-            httpServletResponse.addCookie(cookie);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/resources/META-INF/orm.xml
----------------------------------------------------------------------
diff --git a/services/idp/src/main/resources/META-INF/orm.xml b/services/idp/src/main/resources/META-INF/orm.xml
deleted file mode 100644
index e9c2bd6..0000000
--- a/services/idp/src/main/resources/META-INF/orm.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
- 
-  http://www.apache.org/licenses/LICENSE-2.0
- 
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
-    version="2.0">
-
-    <entity class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
-        <table>
-            <unique-constraint>
-                <column-name>claimtype</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_Claim"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_Claim"
-                    pk-column-value="SEQ_Claim" initial-value="100" />
-            </id>
-        </attributes>
-    </entity>
-
-    <entity class="org.apache.cxf.fediz.service.idp.service.jpa.IdpEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_IDP"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_IDP"
-                    pk-column-value="SEQ_IDP" initial-value="100" />
-            </id>
-            <many-to-many name="claimTypesOffered">
-                <join-table name="idp_claims">
-                    <join-column name="idp_id" />
-                    <inverse-join-column name="claim_id" />
-                    <unique-constraint>
-                        <column-name>idp_id</column-name>
-                        <column-name>claim_id</column-name>
-                    </unique-constraint>
-                </join-table>
-            </many-to-many>
-            <many-to-many name="trustedIdps">
-                <join-table name="idp_trustedidps">
-                    <join-column name="idp_id" />
-                    <inverse-join-column name="trustedidp_id" />
-                    <unique-constraint>
-                        <column-name>idp_id</column-name>
-                        <column-name>trustedidp_id</column-name>
-                    </unique-constraint>
-                </join-table>
-            </many-to-many>
-            <many-to-many name="applications">
-                <join-table name="idp_applications">
-                    <join-column name="idp_id" />
-                    <inverse-join-column name="application_id" />
-                    <unique-constraint>
-                        <column-name>idp_id</column-name>
-                        <column-name>application_id</column-name>
-                    </unique-constraint>
-                </join-table>
-            </many-to-many>
-
-        </attributes>
-    </entity>
-
-    <entity
-        class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_Application"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_Application"
-                    pk-column-value="SEQ_Application" initial-value="100" />
-            </id>
-        </attributes>
-    </entity>
-
-    <entity
-        class="org.apache.cxf.fediz.service.idp.service.jpa.TrustedIdpEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_TrustedIDP"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_TrustedIDP"
-                    pk-column-value="SEQ_TrustedIDP" initial-value="100" />
-            </id>
-        </attributes>
-    </entity>
-
-    <entity
-        class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationClaimEntity">
-        <table>
-            <unique-constraint>
-                <column-name>claimid</column-name>
-                <column-name>applicationid</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_ApplicationClaim"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_ApplicationClaim"
-                    pk-column-value="SEQ_ApplicationClaim"
-                    initial-value="100" />
-            </id>
-        </attributes>
-    </entity>
-    
-    <entity class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
-        <table>
-            <unique-constraint>
-                <column-name>name</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_Entitlement"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_Entitlement"
-                    pk-column-value="SEQ_Entitlement" initial-value="100" />
-            </id>
-        </attributes>
-    </entity>
-    
-    <entity class="org.apache.cxf.fediz.service.idp.service.jpa.RoleEntity">
-        <table>
-            <unique-constraint>
-                <column-name>name</column-name>
-            </unique-constraint>
-        </table>
-        <attributes>
-            <id name="id">
-                <generated-value generator="SEQ_ROLE"
-                    strategy="TABLE" />
-                <table-generator name="SEQ_ROLE"
-                    pk-column-value="SEQ_ROLE" initial-value="100" />
-            </id>
-            <many-to-many name="entitlements">
-                <join-table name="role_entitlements">
-                    <join-column name="role_id" />
-                    <inverse-join-column name="entitlement_id" />
-                    <unique-constraint>
-                        <column-name>role_id</column-name>
-                        <column-name>entitlement_id</column-name>
-                    </unique-constraint>
-                </join-table>
-            </many-to-many>
-        </attributes>
-    </entity>
-    
-</entity-mappings>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/resources/META-INF/spring-persistence.xml
----------------------------------------------------------------------
diff --git a/services/idp/src/main/resources/META-INF/spring-persistence.xml b/services/idp/src/main/resources/META-INF/spring-persistence.xml
deleted file mode 100644
index bf34a76..0000000
--- a/services/idp/src/main/resources/META-INF/spring-persistence.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
- 
-  http://www.apache.org/licenses/LICENSE-2.0
- 
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<persistence
-    xmlns="http://java.sun.com/xml/ns/persistence"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
-    version="2.0">
-
-    <persistence-unit name="fedizPersistenceUnit">
-        <mapping-file>META-INF/orm.xml</mapping-file>
-        <validation-mode>AUTO</validation-mode>
-    </persistence-unit>
-</persistence>
\ No newline at end of file