cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1560525 [3/4] - in /cxf/fediz/trunk: ./ services/idp/ services/idp/src/main/java/org/apache/cxf/fediz/service/idp/ services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ services/idp/src/main/java/org/apache/cxf/fediz/service/i...
Date Wed, 22 Jan 2014 21:47:03 GMT
Added: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java (added)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java Wed Jan 22 21:47:02 2014
@@ -0,0 +1,197 @@
+/**
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.ws.security.WSConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+//CHECKSTYLE:OFF
+public class DBLoaderImpl implements DBLoader {
+    
+    public static final String NAME = "DEMODBLOADER";
+    
+    private static final Logger LOG = LoggerFactory.getLogger(DBLoaderImpl.class);
+    
+    private EntityManager em;
+
+    @PersistenceContext
+    public void setEntityManager(EntityManager entityManager) {
+        this.em = entityManager;
+    }
+    
+    @Override
+    public String getName() {
+        return NAME;
+    }
+    
+    @Override
+    public void load() {
+
+        try {
+            ClaimEntity claimEntity1 = new ClaimEntity();
+            claimEntity1.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname");
+            claimEntity1.setDisplayName("firstname");
+            claimEntity1.setDescription("Description for firstname");
+            em.persist(claimEntity1);
+    
+            ClaimEntity claimEntity2 = new ClaimEntity();
+            claimEntity2.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname");
+            claimEntity2.setDisplayName("lastname");
+            claimEntity2.setDescription("Description for lastname");
+            em.persist(claimEntity2);
+    
+            ClaimEntity claimEntity3 = new ClaimEntity();
+            claimEntity3.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress");
+            claimEntity3.setDisplayName("email");
+            claimEntity3.setDescription("Description for email");
+            em.persist(claimEntity3);
+    
+            ClaimEntity claimEntity4 = new ClaimEntity();
+            claimEntity4.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");
+            claimEntity4.setDisplayName("role");
+            claimEntity4.setDescription("Description for role");
+            em.persist(claimEntity4);
+            
+            
+            ApplicationEntity entity = new ApplicationEntity();
+            entity.setEncryptionCertificate("");
+            entity.setLifeTime("3600");
+            entity.setProtocol("http://docs.oasis-open.org/wsfed/federation/200706");
+            entity.setRealm("urn:org:apache:cxf:fediz:fedizhelloworld");
+            entity.setRole("ApplicationServiceType");
+            entity.setServiceDescription("Fedizhelloworld description");
+            entity.setServiceDisplayName("Fedizhelloworld");
+            entity.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
+            // must be persistet here already as the ApplicationClaimEntity requires the Application Id
+            em.persist(entity);
+            ApplicationClaimEntity ace1 = new ApplicationClaimEntity(entity, claimEntity1);
+            ace1.setOptional(true);
+            em.persist(ace1);
+            entity.getRequestedClaims().add(ace1);
+            ApplicationClaimEntity ace2 = new ApplicationClaimEntity(entity, claimEntity2);
+            ace2.setOptional(true);
+            em.persist(ace2);
+            entity.getRequestedClaims().add(ace2);
+            ApplicationClaimEntity ace3 = new ApplicationClaimEntity(entity, claimEntity3);
+            ace3.setOptional(true);
+            em.persist(ace3);
+            entity.getRequestedClaims().add(ace3);
+            ApplicationClaimEntity ace4 = new ApplicationClaimEntity(entity, claimEntity4);
+            ace4.setOptional(false);
+            em.persist(ace4);
+            entity.getRequestedClaims().add(ace4);
+            em.persist(entity);
+            
+            
+            TrustedIdpEntity entity3 = new TrustedIdpEntity();
+            entity3.setCacheTokens(true);
+            entity3.setCertificate("trusted cert");
+            entity3.setDescription("Realm B description");
+            entity3.setFederationType("FederateIdentity");
+            entity3.setName("Realm B");
+            entity3.setProtocol("http://docs.oasis-open.org/wsfed/federation/200706");
+            entity3.setRealm("urn:org:apache:cxf:fediz:idp:realm-B");
+            entity3.setTrustType("PEER_TRUST");
+            entity3.setUrl("https://localhost:${realmB.port}/fediz-idp-remote/federation");
+            em.persist(entity3);
+            
+            IdpEntity idpEntity = new IdpEntity();
+            idpEntity.getApplications().add(entity);
+            idpEntity.getTrustedIDPs().add(entity3);
+            idpEntity.setCertificate("stsKeystoreA.properties");
+            idpEntity.setCertificatePassword("realma");
+            idpEntity.setIdpUrl("https://localhost:9443/fediz-idp/federation");
+            idpEntity.setRealm("urn:org:apache:cxf:fediz:idp:realm-A");
+            idpEntity.setStsUrl("https://localhost:9443/fediz-idp-sts/REALMA");
+            idpEntity.setServiceDisplayName("REALM A");
+            idpEntity.setServiceDescription("IDP of Realm A");
+            idpEntity.setUri("realma");
+            idpEntity.setProvideIDPList(true);
+            Map<String, String> authUris = new HashMap<String, String>();
+            authUris.put("default", "/login/default");
+            idpEntity.setAuthenticationURIs(authUris);
+            List<String> protocols = new ArrayList<String>();
+            protocols.add("http://docs.oasis-open.org/wsfed/federation/200706");
+            protocols.add("http://docs.oasis-open.org/ws-sx/ws-trust/200512");
+            idpEntity.setSupportedProtocols(protocols);
+            idpEntity.getClaimTypesOffered().add(claimEntity1);
+            idpEntity.getClaimTypesOffered().add(claimEntity2);
+            idpEntity.getClaimTypesOffered().add(claimEntity3);
+            idpEntity.getClaimTypesOffered().add(claimEntity4);
+            List<String> tokenTypes = new ArrayList<String>();
+            tokenTypes.add(WSConstants.SAML2_NS);
+            tokenTypes.add(WSConstants.SAML_NS);
+            idpEntity.setTokenTypesOffered(tokenTypes);
+            idpEntity.setUseCurrentIDP(true);
+            em.persist(idpEntity);
+            
+            /*
+            ClaimEntity claimEntity5 = new ClaimEntity();
+            claimEntity5.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/city");
+            claimEntity5.setDisplayName("city");
+            claimEntity5.setDescription("Description for city");
+            em.persist(claimEntity5);
+                        
+            ApplicationEntity entity2 = new ApplicationEntity();
+            entity2.setEncryptionCertificate("my encryption cert2");
+            entity2.setLifeTime("22my lifetime");
+            entity2.setProtocol("22protocol");
+            entity2.setRealm("myrealm2");
+            entity2.setRole("myrole");
+            entity2.setServiceDescription("service description2");
+            entity2.setServiceDisplayName("service displayname2");
+            entity2.setTokenType("my tokentype");
+            // must be persistet here already as the ApplicationClaimEntity requires the Application Id
+            em.persist(entity2);
+            ApplicationClaimEntity ace5 = new ApplicationClaimEntity(entity2, claimEntity5);
+            ace5.setOptional(false);
+            em.persist(ace5);
+            entity2.getRequestedClaims().add(ace5);
+            em.persist(entity2);
+            
+            TrustedIdpEntity entity4 = new TrustedIdpEntity();
+            entity4.setCacheTokens(true);
+            entity4.setCertificate("trusted cert");
+            entity4.setDescription("Realm B description");
+            entity4.setFederationType("FederateIdentity");
+            entity4.setName("Realm B");
+            entity4.setProtocol("http://docs.oasis-open.org/wsfed/federation/200706");
+            entity4.setRealm("trustedidp2realm");
+            entity4.setTrustType("PEER_TRUST");
+            entity4.setUrl("https://localhost:${realmB.port}/fediz-idp-remote/federation");
+            em.persist(entity4);
+            */
+            
+            em.flush();
+        } catch (Exception ex) {
+            LOG.warn("Failed to initialize DB with data", ex);
+        }
+    }
+}

Added: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java (added)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPAImpl.java Wed Jan 22 21:47:02 2014
@@ -0,0 +1,383 @@
+/**
+ * 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.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+@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<Idp>();
+        
+        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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("IDP '" + idp.getRealm() + "' added");
+        }
+        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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("IDP '" + idp.getRealm() + "' updated");
+        }
+    }
+
+    @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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("IDP '" + realm + "' deleted");
+        }
+        
+    }
+    
+    @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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Application '" + application.getRealm() + "' added to IDP '" + 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");
+        }
+                
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Application '" + application.getRealm() + "' removed from IDP '" + 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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' added to IDP '" + 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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Trusted IDP '" + trustedIdp.getRealm() + "' removed from IDP '" + 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);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Claim '" + claim.getClaimType() + "' added to IDP '" + 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");
+        }
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Claim '" + claim.getClaimType() + "' removed from IDP '" + 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.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());
+        
+        
+        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;
+    }
+
+}

Copied: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java (from r1560523, cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/IDPConfig.java)
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java?p2=cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java&p1=cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/IDPConfig.java&r1=1560523&r2=1560525&rev=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/IDPConfig.java (original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java Wed Jan 22 21:47:02 2014
@@ -16,26 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.fediz.service.idp.model;
 
-import java.io.Serializable;
+package org.apache.cxf.fediz.service.idp.service.jpa;
+
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "IDP", namespace = "http://org.apache.cxf.fediz")
-public class IDPConfig implements Serializable {
+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;
 
-    // @Id
-    // private Long id;
+@Entity(name = "IDP")
+public class IdpEntity {
 
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -5570301342547139039L;
+    @Id
+    private int id;
 
-    // @Column(name = "REALM", nullable = false, length = FIELD_LENGTH)
     // Unique
     // fed:TargetScope
     private String realm; // wtrealm, whr
@@ -48,7 +52,6 @@ public class IDPConfig implements Serial
     // Spring EL
     private String hrds;
 
-    // @Column(name = "INACTIVE", nullable = true, length = FIELD_LENGTH)
     // if HRDS can't determine the home realm, should
     // the list of trusted IDPs be shown to make a choice
     private boolean provideIDPList;
@@ -68,7 +71,7 @@ public class IDPConfig implements Serial
     // fed:SecurityTokenSerivceEndpoint
     private String stsUrl;
 
-    // fed:PassiveRequestorEndpoint
+    // fedl:PassiveRequestorEndpoint
     // published hostname, port must be configured
     private String idpUrl;
 
@@ -76,28 +79,44 @@ public class IDPConfig implements Serial
     // "http://docs.oasis-open.org/wsfed/federation/200706"
     // "http://docs.oasis-open.org/ws-sx/ws-trust/200512"
     // Could be more in the future
-    private List<String> supportedProtocols;
+    
+    @ElementCollection
+    @CollectionTable(name = "idp_protocols")
+    @Column(name = "protocol")
+    private List<String> supportedProtocols = new ArrayList<String>();
 
     // list of RPs and RP-IDPs from whom we accept SignInResponse
     // which includes RP IDPs
     // key: wtrealm
-    private Map<String, ServiceConfig> services;
+    @ManyToMany(cascade = CascadeType.ALL)
+    private List<ApplicationEntity> applications = new ArrayList<ApplicationEntity>();
 
     // list of trusted IDP from whom we accept SignInResponse
     // key: whr
-    private Map<String, TrustedIDPConfig> trustedIDPs;
+    @ManyToMany(cascade = CascadeType.ALL)
+    private List<TrustedIdpEntity> trustedIDPs = new ArrayList<TrustedIdpEntity>();
 
     // which URI to redirect for authentication
     // fediz-idp/<IDP uri>/login/auth/<auth URI>
     // wauth to auth URI mapping
-    private Map<String, String> authenticationURIs;
+    @ElementCollection
+    @MapKeyColumn(name = "name")
+    @Column(name = "value")
+    @CollectionTable(name = "idp_auth_uris", joinColumns = @JoinColumn(name = "idp_id"))
+    private Map<String, String> authenticationURIs = new HashMap<String, String>();
 
     // required to create Federation Metadata document
     // fed:TokenTypesOffered
-    private List<String> 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<String>();
 
     // fed:ClaimTypesOffered
-    private List<String> claimTypesOffered;
+    @ManyToMany(cascade = CascadeType.ALL)
+    private List<ClaimEntity> claimTypesOffered = new ArrayList<ClaimEntity>();
 
     // ServiceDisplayName
     private String serviceDisplayName;
@@ -105,6 +124,15 @@ public class IDPConfig implements Serial
     // ServiceDescription
     private String serviceDescription;
 
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+    
     public String getRealm() {
         return realm;
     }
@@ -185,19 +213,19 @@ public class IDPConfig implements Serial
         this.supportedProtocols = supportedProtocols;
     }
 
-    public Map<String, ServiceConfig> getServices() {
-        return services;
+    public List<ApplicationEntity> getApplications() {
+        return applications;
     }
 
-    public void setServices(Map<String, ServiceConfig> services) {
-        this.services = services;
+    public void setApplications(List<ApplicationEntity> applications) {
+        this.applications = applications;
     }
 
-    public Map<String, TrustedIDPConfig> getTrustedIDPs() {
+    public List<TrustedIdpEntity> getTrustedIDPs() {
         return trustedIDPs;
     }
 
-    public void setTrustedIDPs(Map<String, TrustedIDPConfig> trustedIDPs) {
+    public void setTrustedIDPs(List<TrustedIdpEntity> trustedIDPs) {
         this.trustedIDPs = trustedIDPs;
     }
 
@@ -217,11 +245,11 @@ public class IDPConfig implements Serial
         this.tokenTypesOffered = tokenTypesOffered;
     }
 
-    public List<String> getClaimTypesOffered() {
+    public List<ClaimEntity> getClaimTypesOffered() {
         return claimTypesOffered;
     }
 
-    public void setClaimTypesOffered(List<String> claimTypesOffered) {
+    public void setClaimTypesOffered(List<ClaimEntity> claimTypesOffered) {
         this.claimTypesOffered = claimTypesOffered;
     }
 

Added: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java (added)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPAImpl.java Wed Jan 22 21:47:02 2014
@@ -0,0 +1,151 @@
+/**
+ * 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.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Transactional
+@Component
+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<TrustedIdp>();
+        
+        Query query = null;
+        query = em.createQuery("select t from TrustedIDP t");
+        
+        //@SuppressWarnings("rawtypes")
+        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.setTrustType(trustedIDP.getTrustType());
+        entity.setUrl(trustedIDP.getUrl());
+    }
+    
+    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.setTrustType(entity.getTrustType());
+        trustedIDP.setUrl(entity.getUrl());
+        return trustedIDP;
+    }
+
+}

Copied: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java (from r1560523, cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/TrustedIDPConfig.java)
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java?p2=cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java&p1=cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/TrustedIDPConfig.java&r1=1560523&r2=1560525&rev=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/model/TrustedIDPConfig.java (original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java Wed Jan 22 21:47:02 2014
@@ -16,26 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.fediz.service.idp.model;
+package org.apache.cxf.fediz.service.idp.service.jpa;
 
-import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
 
-import javax.xml.bind.annotation.XmlRootElement;
 
+@Entity(name = "TrustedIDP")
+public class TrustedIdpEntity {
 
-//import javax.persistence.Column;
-//import javax.persistence.Entity;
-//import javax.persistence.Id;
-//import javax.persistence.Table;
-
-//@Entity
-//@Table(name = "TRUSTEDIDP")
-@XmlRootElement(name = "TrustedIDP", namespace = "http://org.apache.cxf.fediz")
-public class TrustedIDPConfig implements Serializable {
-
-        
-    //@Id
-    //private Long id;
+    @Id
+    private int id;
 
     //@Column(name = "REALM", nullable = true, length = FIELD_LENGTH)
     private String realm;  //wtrealm, whr
@@ -70,6 +61,15 @@ public class TrustedIDPConfig implements
     
     //optional (to provide a list of IDPs)
     private String logo;
+    
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
 
     public String getRealm() {
         return realm;
@@ -150,6 +150,5 @@ public class TrustedIDPConfig implements
     public void setTrustType(String trustType) {
         this.trustType = trustType;
     }
-               
 
 }

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java (original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java Wed Jan 22 21:47:02 2014
@@ -36,7 +36,8 @@ import org.w3c.dom.Document;
 import org.apache.cxf.fediz.core.util.CertsUtils;
 import org.apache.cxf.fediz.core.util.DOMUtils;
 import org.apache.cxf.fediz.core.util.SignatureUtils;
-import org.apache.cxf.fediz.service.idp.model.IDPConfig;
+import org.apache.cxf.fediz.service.idp.domain.Claim;
+import org.apache.cxf.fediz.service.idp.domain.Idp;
 
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.util.Base64;
@@ -62,7 +63,7 @@ public class MetadataWriter {
     }
 
     //CHECKSTYLE:OFF
-    public Document getMetaData(IDPConfig config) throws RuntimeException {
+    public Document getMetaData(Idp config) throws RuntimeException {
         //Return as text/xml
         try {
             
@@ -145,10 +146,10 @@ public class MetadataWriter {
             // create ClaimsType section
             if (config.getClaimTypesOffered() != null && config.getClaimTypesOffered().size() > 0) {
                 writer.writeStartElement("fed", "ClaimTypesOffered", WS_FEDERATION_NS);
-                for (String claim : config.getClaimTypesOffered()) {
+                for (Claim claim : config.getClaimTypesOffered()) {
     
                     writer.writeStartElement("auth", "ClaimType", WS_FEDERATION_NS);
-                    writer.writeAttribute("Uri", claim);
+                    writer.writeAttribute("Uri", claim.getClaimType().toString());
                     writer.writeAttribute("Optional", "true");
                     writer.writeEndElement(); // ClaimType
     

Added: cxf/fediz/trunk/services/idp/src/main/resources/META-INF/orm.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/resources/META-INF/orm.xml?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/resources/META-INF/orm.xml (added)
+++ cxf/fediz/trunk/services/idp/src/main/resources/META-INF/orm.xml Wed Jan 22 21:47:02 2014
@@ -0,0 +1,128 @@
+<?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-mappings>

Added: cxf/fediz/trunk/services/idp/src/main/resources/META-INF/spring-persistence.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/resources/META-INF/spring-persistence.xml?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/resources/META-INF/spring-persistence.xml (added)
+++ cxf/fediz/trunk/services/idp/src/main/resources/META-INF/spring-persistence.xml Wed Jan 22 21:47:02 2014
@@ -0,0 +1,30 @@
+<?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>NONE</validation-mode>
+  </persistence-unit>
+</persistence>
\ No newline at end of file

Modified: cxf/fediz/trunk/services/idp/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/resources/log4j.properties?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/resources/log4j.properties (original)
+++ cxf/fediz/trunk/services/idp/src/main/resources/log4j.properties Wed Jan 22 21:47:02 2014
@@ -1,6 +1,7 @@
 # Set root category priority to INFO and its only appender to CONSOLE.
 #log4j.rootCategory=FATAL, CONSOLE
 log4j.rootCategory=INFO, CONSOLE, LOGFILE
+log4j.logger.org.springframework.webflow=INFO,LOGFILE
 
 # CONSOLE is set to be a ConsoleAppender using a PatternLayout.
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

Added: cxf/fediz/trunk/services/idp/src/main/resources/persistence.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/resources/persistence.properties?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/resources/persistence.properties (added)
+++ cxf/fediz/trunk/services/idp/src/main/resources/persistence.properties Wed Jan 22 21:47:02 2014
@@ -0,0 +1,14 @@
+#jpa.driverClassName=org.apache.derby.jdbc.ClientDriver
+#jpa.url=jdbc:derby://localhost:1527/Fediz
+#jpa.username=admin
+#jpa.password=admin
+#jpa.defaultData=true
+#jpa.platform=DerbyDictionary
+
+
+jpa.driverClassName=org.hsqldb.jdbcDriver
+jpa.url=jdbc:hsqldb:target/fediz/db/myDB;shutdown=true
+jpa.username=sa
+jpa.password=
+jpa.defaultData=true
+jpa.platform=HSQLDictionary
\ No newline at end of file

Added: cxf/fediz/trunk/services/idp/src/main/resources/persistenceContext.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/resources/persistenceContext.xml?rev=1560525&view=auto
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/resources/persistenceContext.xml (added)
+++ cxf/fediz/trunk/services/idp/src/main/resources/persistenceContext.xml Wed Jan 22 21:47:02 2014
@@ -0,0 +1,133 @@
+<?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.
+-->
+<beans profile="jpa" xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+    http://www.springframework.org/schema/context
+    http://www.springframework.org/schema/context/spring-context-3.0.xsd
+    http://www.springframework.org/schema/tx
+    http://www.springframework.org/schema/tx/spring-tx.xsd
+    http://www.springframework.org/schema/jdbc
+    http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"
+       default-autowire="byName">
+
+	<!-- 
+	<jdbc:initialize-database data-source="dataSource" enabled="${jpa.defaultData}" >
+	    <jdbc:script location="classpath:default.sql"/>
+	</jdbc:initialize-database>
+	-->
+	<context:component-scan base-package="org.apache.cxf.fediz.service.idp.service"/>
+	<context:component-scan base-package="org.apache.cxf.fediz.service.idp.rest"/>
+
+    <bean id="entityManagerFactory"
+          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+        <property name="persistenceXmlLocation" value="classpath*:META-INF/spring-persistence.xml"/>
+        <property name="persistenceUnitName" value="fedizPersistenceUnit"/>
+        <property name="dataSource" ref="dataSource"/>
+        <property name="jpaVendorAdapter">
+            <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+                <property name="showSql" value="true"/>
+                <property name="generateDdl" value="true"/>
+                <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.${jpa.platform}"/>
+            </bean>
+        </property>
+    </bean>
+    
+    <!-- 
+    <bean id="entityManagerFactory"
+        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+    <property name="persistenceXmlLocation" value="classpath*:META-INF/spring-persistence.xml"/>
+    <property name="persistenceUnitName" value="syncopePersistenceUnit"/>
+    <property name="dataSource" ref="dataSource"/>
+    <property name="jpaVendorAdapter">
+      <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+        <property name="showSql" value="false"/>
+        <property name="generateDdl" value="true"/>
+        <property name="databasePlatform" value="${jpa.dialect}"/>
+      </bean>
+    </property>
+    <property name="jpaPropertyMap">
+      <map>
+-->      
+        <!--<entry key="openjpa.Log" value="SQL=TRACE"/>
+        <entry key="openjpa.ConnectionFactoryProperties" 
+               value="PrintParameters=true, PrettyPrint=true, PrettyPrintLineLength=80"/>-->
+                <!-- 
+        <entry key="openjpa.NontransactionalWrite" value="false"/>
+        <entry key="openjpa.AutoDetach" value="close, commit, nontx-read, rollback"/>
+
+        <entry key="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
+        <entry key="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
+                
+        <entry key="openjpa.DataCache" value="true"/>
+        <entry key="openjpa.QueryCache" value="true"/>
+        <entry key="openjpa.RemoteCommitProvider" value="sjvm"/>
+      </map>
+    </property>
+  </bean>
+     -->
+
+  <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
+    <property name="jndiName" value="java:comp/env/jdbc/fedizDataSource"/>
+    <property name="defaultObject" ref="localDataSource"/>
+  </bean>
+
+    <bean id="localDataSource"
+          class="org.apache.commons.dbcp.BasicDataSource"
+          destroy-method="close">
+        <property name="driverClassName" value="${jpa.driverClassName}"/>
+        <property name="url" value="${jpa.url}"/>
+        <property name="username" value="${jpa.username}"/>
+        <property name="password" value="${jpa.password}"/>
+    </bean>
+         
+  <bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
+    <property name="entityManagerFactory" ref="entityManagerFactory"/>
+  </bean>
+
+  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+    <property name="entityManagerFactory" ref="entityManagerFactory"/>
+  </bean>          
+
+    <!-- Support annotation Transactional
+         http://docs.spring.io/spring/docs/3.1.4.RELEASE/spring-framework-reference/htmlsingle/#tx-decl-explained
+     -->
+    <tx:annotation-driven/>
+
+    <!-- Support annotation PersistenceContext
+         http://docs.spring.io/spring/docs/3.1.4.RELEASE/spring-framework-reference/htmlsingle/#orm-jpa-straight
+    -->
+    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
+
+    <bean id="config" class="org.apache.cxf.fediz.service.idp.service.jpa.ConfigServiceJPA" >
+    	<property name="idpService" ref="idpServiceImpl" />
+    </bean>
+     
+    <bean id="dbLoader" class="org.apache.cxf.fediz.service.idp.service.jpa.DBLoaderImpl" />
+    
+    
+    <bean id="dbListener" class="org.apache.cxf.fediz.service.idp.service.jpa.DBInitApplicationListener" />
+    	
+
+</beans>
\ No newline at end of file

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/applicationContext.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/applicationContext.xml Wed Jan 22 21:47:02 2014
@@ -28,7 +28,7 @@
         http://cxf.apache.org/core
         http://cxf.apache.org/schemas/core.xsd
         http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
         http://cxf.apache.org/jaxws                                     
         http://cxf.apache.org/schemas/jaxws.xsd
         http://www.springframework.org/schema/util
@@ -42,12 +42,23 @@
         http://cxf.apache.org/jaxrs
         http://cxf.apache.org/schemas/jaxrs.xsd">
         
-    <context:property-placeholder location="classpath:realm.properties"/>
+    <!-- Use http://www.baeldung.com/2012/02/06/properties-with-spring/ instead -->
+      <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+    <property name="locations">
+      <list>
+        <value>classpath:persistence.properties</value>
+      </list>
+    </property>
+    <property name="ignoreResourceNotFound" value="true"/>
+    <property name="ignoreUnresolvablePlaceholders" value="true"/>
+  </bean>
 
     <import resource="classpath:META-INF/cxf/cxf.xml" />
 
     <import resource="security-config.xml" />
     <import resource="${idp-config}" />
+    <import resource="classpath:persistenceContext.xml" />
+    
 
     <cxf:bus>
         <cxf:features>
@@ -63,17 +74,57 @@
         </http:tlsClientParameters>
     </http:conduit>
     
+    
+      <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+    <property name="depthProperties">
+      <bean id="depthProperties" class="org.apache.cxf.staxutils.DocumentDepthProperties">
+        <property name="innerElementCountThreshold" value="500"/>
+      </bean>
+    </property>
+    <property name="marshallerProperties">
+      <map>
+        <entry key="jaxb.formatted.output">
+          <value type="java.lang.Boolean">true</value>
+        </entry>
+      </map>
+    </property>
+  </bean>
+
+  <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" />
+    
     <jaxrs:server id="idpService" address="/rs">
         <jaxrs:serviceBeans>
             <ref bean="idpServiceImpl" />
+            <ref bean="claimServiceImpl" />
+            <ref bean="applicationServiceImpl" />
+            <ref bean="trustedIdpServiceImpl" />
+            <ref bean="rootServiceImpl" />
         </jaxrs:serviceBeans>
+        <!-- 
+        <jaxrs:resourceComparator>
+            <bean id="myServiceComparator" class="org.apache.cxf.fediz.service.idp.rest.QueryResourceInfoComparator"/>
+        </jaxrs:resourceComparator>
+        -->    
+        <jaxrs:providers>
+      		<ref bean="jaxbProvider"/>
+      		<ref bean="jsonProvider"/>
+      		<!--<ref bean="exceptionMapper"/>-->
+    	</jaxrs:providers>
+    	<jaxrs:extensionMappings>
+      		<entry key="json" value="application/json;charset=UTF-8"/>
+      		<entry key="xml" value="application/xml;charset=UTF-8"/>
+    	</jaxrs:extensionMappings>
     </jaxrs:server>
     
+    <bean id="rootServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.RootServiceImpl" />
+    
+    <bean id="idpServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.IdpServiceImpl" />
+    
+    <bean id="claimServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.ClaimServiceImpl" />
     
-    <bean id="idpServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.IDPServices">
-    	<property name="configService" ref="config" />
-    </bean>
+    <bean id="applicationServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.ApplicationServiceImpl" />
     
+    <bean id="trustedIdpServiceImpl" class="org.apache.cxf.fediz.service.idp.rest.TrustedIdpServiceImpl" />
     
 </beans>
 

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-signin-request.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-signin-request.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-signin-request.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-signin-request.xml Wed Jan 22 21:47:02 2014
@@ -1,4 +1,22 @@
 <?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.
+-->
 <flow xmlns="http://www.springframework.org/schema/webflow"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/webflow
@@ -39,7 +57,7 @@
     </action-state>
 
     <decision-state id="provideIDPListForUser">
-        <if test="flowScope.idpConfig.trustedIDPs == null or idpConfig.trustedIDPs.isEmpty()" then="checkDefaultToThisIDP" />
+        <if test="flowScope.idpConfig.trustedIdps == null or idpConfig.trustedIdps.isEmpty()" then="checkDefaultToThisIDP" />
         <if test="flowScope.idpConfig.isProvideIDPList() == false" then="checkDefaultToThisIDP" else="showIDPList" />
     </decision-state>
 

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-validate-request.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-validate-request.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-validate-request.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/federation-validate-request.xml Wed Jan 22 21:47:02 2014
@@ -31,8 +31,8 @@
             <set name="flowScope.wfresh" value="requestParameters.wfresh" />
             <set name="flowScope.whr" value="requestParameters.whr" />
             <set name="flowScope.wresult" value="requestParameters.wresult" />
-            <evaluate expression="requestScope.getString('wauth','default')" result="flowScope.wauth" /> 
-	        <set name="flowScope.idpConfig" value="config.getIdpConfigs().get(0)" />
+            <evaluate expression="requestScope.getString('wauth','default')" result="flowScope.wauth" />
+	        <set name="flowScope.idpConfig" value="config.getIDP(null)" />
         </on-entry>
         <if test="requestParameters.wa == null" then="viewBadRequest" />
         <if test="requestParameters.wa != 'wsignin1.0' and requestParameters.wa != 'wsignout1.0' and requestParameters.wa != 'wsignoutcleanup1.0'" then="viewBadRequest" />

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realma.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realma.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realma.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realma.xml Wed Jan 22 21:47:02 2014
@@ -17,7 +17,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans"
+<beans profile="spring" xmlns="http://www.springframework.org/schema/beans"
     xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
     xmlns:test="http://apache.org/hello_world_soap_http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:util="http://www.springframework.org/schema/util" xmlns:http="http://cxf.apache.org/transports/http/configuration"
@@ -27,7 +27,7 @@
     http://cxf.apache.org/core
     http://cxf.apache.org/schemas/core.xsd
     http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
     http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://cxf.apache.org/jaxws                                     

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realmb.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realmb.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realmb.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idp-config-realmb.xml Wed Jan 22 21:47:02 2014
@@ -17,7 +17,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans"
+<beans profile="spring" xmlns="http://www.springframework.org/schema/beans"
     xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
     xmlns:test="http://apache.org/hello_world_soap_http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:util="http://www.springframework.org/schema/util" xmlns:http="http://cxf.apache.org/transports/http/configuration"
@@ -27,7 +27,7 @@
     http://cxf.apache.org/core
     http://cxf.apache.org/schemas/core.xsd
     http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
     http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://cxf.apache.org/jaxws                                     

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idplist.jsp
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idplist.jsp?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idplist.jsp (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/idplist.jsp Wed Jan 22 21:47:02 2014
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <%@page import="java.util.Map"%>
-<%@page import="org.apache.cxf.fediz.service.idp.model.IDPConfig"%>
-<%@page import="org.apache.cxf.fediz.service.idp.model.TrustedIDPConfig"%>
+<%@page import="org.apache.cxf.fediz.service.idp.domain.Idp"%>
+<%@page import="org.apache.cxf.fediz.service.idp.domain.TrustedIdp"%>
 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
 <html>
@@ -13,11 +13,14 @@
 	<i>Where are you from? Please, select one Identity Provider in the list which is able to authenticate you. </i>
 	<form:form method="POST" id="idplist" name="idplist">
 		<br />
-        <% IDPConfig idpConfig = (IDPConfig)request.getAttribute("idpConfig");
-        Map<String, TrustedIDPConfig> trustedIDPs = idpConfig.getTrustedIDPs(); %>
+        <%
+            Idp idpConfig = (Idp)request.getAttribute("idpConfig");
+        %>
       <select name="whr">
         <option value="<%=idpConfig.getRealm()%>" selected="selected" ><%=idpConfig.getServiceDescription()%></option>
-        <% for (TrustedIDPConfig trustedIDP : trustedIDPs.values()) { %>
+        <%
+            for (TrustedIdp trustedIDP : idpConfig.getTrustedIdps()) {
+        %>
         <option value="<%=trustedIDP.getRealm()%>"><%=trustedIDP.getDescription()%></option>
         <% } %>
       </select>

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/security-config.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/security-config.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/security-config.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/security-config.xml Wed Jan 22 21:47:02 2014
@@ -27,7 +27,6 @@
         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
 
     <context:property-placeholder location="classpath:realm.properties"/>
-    <context:component-scan base-package="org.apache.cxf.fediz.service.idp"/>
     
     <!-- DIABLE in production as it might log confidential information about the user -->
     <!-- <security:debug /> -->

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml?rev=1560525&r1=1560524&r2=1560525&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml Wed Jan 22 21:47:02 2014
@@ -1,3 +1,22 @@
+<!--
+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.
+
+-->
 <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                       http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
@@ -11,6 +30,11 @@
 		<param-value>/WEB-INF/applicationContext.xml</param-value>
 	</context-param>
 	
+	<context-param>
+		<param-name>spring.profiles.active</param-name>
+		<param-value>jpa</param-value>
+	</context-param>
+	
 	<filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>



Mime
View raw message