cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [03/19] cxf-fediz git commit: FEDIZ-155 - Move .java components out of idp webapp and into a separate JAR
Date Fri, 27 Jan 2017 11:22:46 GMT
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2CallbackHandler.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2CallbackHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2CallbackHandler.java
deleted file mode 100644
index 9981253..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2CallbackHandler.java
+++ /dev/null
@@ -1,148 +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.samlsso;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.wss4j.common.saml.SAMLCallback;
-import org.apache.wss4j.common.saml.bean.AttributeBean;
-import org.apache.wss4j.common.saml.bean.AttributeStatementBean;
-import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean;
-import org.apache.wss4j.common.saml.bean.ConditionsBean;
-import org.apache.wss4j.common.saml.bean.SubjectBean;
-import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean;
-import org.apache.wss4j.common.saml.bean.Version;
-import org.apache.wss4j.common.saml.builder.SAML2Constants;
-import org.opensaml.core.xml.XMLObject;
-import org.opensaml.saml.saml2.core.Attribute;
-import org.opensaml.saml.saml2.core.AttributeStatement;
-import org.opensaml.saml.saml2.core.Subject;
-
-/**
- * A Callback Handler implementation for a SAML 2 assertion. By default it creates a SAML 2.0 Assertion with
- * an AuthenticationStatement. If a list of AttributeStatements are also supplied it will insert them into the
- * Assertion.
- */
-public class SAML2CallbackHandler implements CallbackHandler {
-    
-    private Subject subject;
-    private String confirmationMethod = SAML2Constants.CONF_BEARER;
-    private String issuer;
-    private ConditionsBean conditions;
-    private SubjectConfirmationDataBean subjectConfirmationData;
-    private List<AttributeStatement> attributeStatements;
-    
-    private void createAndSetStatement(SAMLCallback callback) {
-        AuthenticationStatementBean authBean = new AuthenticationStatementBean();
-        authBean.setAuthenticationMethod("Password");
-        callback.setAuthenticationStatementData(Collections.singletonList(authBean));
-
-        if (attributeStatements != null && !attributeStatements.isEmpty()) {
-            List<AttributeStatementBean> attrStatementBeans = new ArrayList<>();
-            
-            for (AttributeStatement attrStatement : attributeStatements) {
-                AttributeStatementBean attrStatementBean = new AttributeStatementBean();
-                List<AttributeBean> attrBeans = new ArrayList<>();
-                
-                for (Attribute attribute : attrStatement.getAttributes()) {
-                    AttributeBean attributeBean = new AttributeBean();
-                    attributeBean.setQualifiedName(attribute.getName());
-                    attributeBean.setNameFormat(attribute.getNameFormat());
-                    List<Object> attributeValues = new ArrayList<>();
-                    for (XMLObject attrVal : attribute.getAttributeValues()) {
-                        attributeValues.add(attrVal.getDOM().getTextContent());
-                    }
-                    attributeBean.setAttributeValues(attributeValues);
-                    attrBeans.add(attributeBean);
-                }
-                attrStatementBean.setSamlAttributes(attrBeans);
-                attrStatementBeans.add(attrStatementBean);
-            }
-            callback.setAttributeStatementData(attrStatementBeans);
-        }
-    }
-    
-    public void handle(Callback[] callbacks)
-        throws IOException, UnsupportedCallbackException {
-        for (int i = 0; i < callbacks.length; i++) {
-            if (callbacks[i] instanceof SAMLCallback) {
-                SAMLCallback callback = (SAMLCallback) callbacks[i];
-                callback.setSamlVersion(Version.SAML_20);
-                callback.setIssuer(issuer);
-                if (conditions != null) {
-                    callback.setConditions(conditions);
-                }
-                
-                SubjectBean subjectBean = 
-                    new SubjectBean(
-                        subject.getNameID().getValue(), subject.getNameID().getNameQualifier(), confirmationMethod
-                    );
-                subjectBean.setSubjectNameIDFormat(subject.getNameID().getFormat());
-                subjectBean.setSubjectConfirmationData(subjectConfirmationData);
-
-                callback.setSubject(subjectBean);
-                createAndSetStatement(callback);
-            } else {
-                throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
-            }
-        }
-    }
-    
-    public void setSubjectConfirmationData(SubjectConfirmationDataBean subjectConfirmationData) {
-        this.subjectConfirmationData = subjectConfirmationData;
-    }
-    
-    public void setConditions(ConditionsBean conditionsBean) {
-        this.conditions = conditionsBean;
-    }
-    
-    public void setConfirmationMethod(String confMethod) {
-        confirmationMethod = confMethod;
-    }
-    
-    public void setIssuer(String issuer) {
-        this.issuer = issuer;
-    }
-
-    public Subject getSubject() {
-        return subject;
-    }
-
-    public void setSubject(Subject subject) {
-        this.subject = subject;
-    }
-
-    public List<AttributeStatement> getAttributeStatements() {
-        return attributeStatements;
-    }
-
-    public void setAttributeStatements(List<AttributeStatement> attributeStatements) {
-        this.attributeStatements = attributeStatements;
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2PResponseComponentBuilder.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2PResponseComponentBuilder.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2PResponseComponentBuilder.java
deleted file mode 100644
index 7e64cfa..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAML2PResponseComponentBuilder.java
+++ /dev/null
@@ -1,127 +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.samlsso;
-
-import java.util.UUID;
-
-import org.joda.time.DateTime;
-import org.opensaml.core.xml.XMLObjectBuilderFactory;
-import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
-import org.opensaml.saml.common.SAMLObjectBuilder;
-import org.opensaml.saml.common.SAMLVersion;
-import org.opensaml.saml.saml2.core.Issuer;
-import org.opensaml.saml.saml2.core.Response;
-import org.opensaml.saml.saml2.core.Status;
-import org.opensaml.saml.saml2.core.StatusCode;
-import org.opensaml.saml.saml2.core.StatusMessage;
-
-/**
-* A (basic) set of utility methods to construct SAML 2.0 Protocol Response statements
-*/
-public final class SAML2PResponseComponentBuilder {
-    
-    private static SAMLObjectBuilder<Response> responseBuilder;
-    
-    private static SAMLObjectBuilder<Issuer> issuerBuilder;
-    
-    private static SAMLObjectBuilder<Status> statusBuilder;
-    
-    private static SAMLObjectBuilder<StatusCode> statusCodeBuilder;
-    
-    private static SAMLObjectBuilder<StatusMessage> statusMessageBuilder;
-    
-    private static XMLObjectBuilderFactory builderFactory = 
-        XMLObjectProviderRegistrySupport.getBuilderFactory();
-    
-    private SAML2PResponseComponentBuilder() {
-        
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static Response createSAMLResponse(
-        String inResponseTo,
-        String issuer,
-        Status status
-    ) {
-        if (responseBuilder == null) {
-            responseBuilder = (SAMLObjectBuilder<Response>)
-                builderFactory.getBuilder(Response.DEFAULT_ELEMENT_NAME);
-        }
-        Response response = responseBuilder.buildObject();
-        
-        response.setID(UUID.randomUUID().toString());
-        response.setIssueInstant(new DateTime());
-        response.setInResponseTo(inResponseTo);
-        response.setIssuer(createIssuer(issuer));
-        response.setStatus(status);
-        response.setVersion(SAMLVersion.VERSION_20);
-        
-        return response;
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static Issuer createIssuer(
-        String issuerValue
-    ) {
-        if (issuerBuilder == null) {
-            issuerBuilder = (SAMLObjectBuilder<Issuer>)
-                builderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
-        }
-        Issuer issuer = issuerBuilder.buildObject();
-        issuer.setValue(issuerValue);
-        
-        return issuer;
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static Status createStatus(
-        String statusCodeValue,
-        String statusMessage
-    ) {
-        if (statusBuilder == null) {
-            statusBuilder = (SAMLObjectBuilder<Status>)
-                builderFactory.getBuilder(Status.DEFAULT_ELEMENT_NAME);
-        }
-        if (statusCodeBuilder == null) {
-            statusCodeBuilder = (SAMLObjectBuilder<StatusCode>)
-                builderFactory.getBuilder(StatusCode.DEFAULT_ELEMENT_NAME);
-        }
-        if (statusMessageBuilder == null) {
-            statusMessageBuilder = (SAMLObjectBuilder<StatusMessage>)
-                builderFactory.getBuilder(StatusMessage.DEFAULT_ELEMENT_NAME);
-        }
-        
-        Status status = statusBuilder.buildObject();
-        
-        StatusCode statusCode = statusCodeBuilder.buildObject();
-        statusCode.setValue(statusCodeValue);
-        status.setStatusCode(statusCode);
-        
-        if (statusMessage != null) {
-            StatusMessage statusMessageObject = statusMessageBuilder.buildObject();
-            statusMessageObject.setMessage(statusMessage);
-            status.setStatusMessage(statusMessageObject);
-        }
-        
-        return status;
-    }
-    
-    
-}
\ 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/samlsso/SAMLAuthnRequest.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAMLAuthnRequest.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAMLAuthnRequest.java
deleted file mode 100644
index c7ded4b..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/samlsso/SAMLAuthnRequest.java
+++ /dev/null
@@ -1,74 +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.samlsso;
-
-import java.io.Serializable;
-
-import org.opensaml.saml.saml2.core.AuthnRequest;
-
-/**
- * This class encapsulates a (parsed) SAML AuthnRequest Object. The OpenSAML AuthnRequest Object is not
- * serializable.
- */
-public class SAMLAuthnRequest implements Serializable {
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 4353024755428346545L;
-    
-    private String issuer;
-    private String consumerServiceURL;
-    private String requestId;
-    private boolean forceAuthn;
-    private String subjectNameId;
-    
-    public SAMLAuthnRequest(AuthnRequest authnRequest) {
-        if (authnRequest.getIssuer() != null) {
-            issuer = authnRequest.getIssuer().getValue();
-        }
-        
-        consumerServiceURL = authnRequest.getAssertionConsumerServiceURL();
-        requestId = authnRequest.getID();
-        forceAuthn = authnRequest.isForceAuthn().booleanValue();
-        if (authnRequest.getSubject() != null && authnRequest.getSubject().getNameID() != null) {
-            subjectNameId = authnRequest.getSubject().getNameID().getValue();
-        }
-    }
-    
-    public String getIssuer() {
-        return issuer;
-    }
-    
-    public String getConsumerServiceURL() {
-        return consumerServiceURL;
-    }
-    
-    public String getRequestId() {
-        return requestId;
-    }
-    
-    public boolean isForceAuthn() {
-        return forceAuthn;
-    }
-    
-    public String getSubjectNameId() {
-        return subjectNameId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ApplicationDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ApplicationDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ApplicationDAO.java
deleted file mode 100644
index a519908..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ApplicationDAO.java
+++ /dev/null
@@ -1,43 +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;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
-
-public interface ApplicationDAO {
-
-    List<Application> getApplications(int start, int size, List<String> expand);
-
-    Application getApplication(String realm, List<String> expand);
-
-    Application addApplication(Application application);
-
-    void updateApplication(String realm, Application application);
-
-    void deleteApplication(String realm);
-
-    void addClaimToApplication(Application application, RequestClaim claim);
-    
-    void removeClaimFromApplication(Application application, RequestClaim claim);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ClaimDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ClaimDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ClaimDAO.java
deleted file mode 100644
index 417a50a..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ClaimDAO.java
+++ /dev/null
@@ -1,38 +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;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-
-public interface ClaimDAO {
-
-    List<Claim> getClaims(int start, int size);
-    
-    Claim getClaim(String claimType);
-    
-    Claim addClaim(Claim claim);
-    
-    void updateClaim(String claimType, Claim claim);
-    
-    void deleteClaim(String claimType);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigService.java
deleted file mode 100644
index e306ff4..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigService.java
+++ /dev/null
@@ -1,32 +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;
-
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-
-
-public interface ConfigService {
-
-    Idp getIDP(String realm);
-
-    void setIDP(Idp config);
-
-    void removeIDP(String realm);
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigServiceSpring.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigServiceSpring.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigServiceSpring.java
deleted file mode 100644
index 8545af3..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/ConfigServiceSpring.java
+++ /dev/null
@@ -1,76 +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;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.model.IDPConfig;
-import org.apache.cxf.fediz.service.idp.model.ServiceConfig;
-
-public class ConfigServiceSpring implements ConfigService {
-
-    private Map<String, Application> serviceConfigs = new HashMap<>();
-    private Map<String, Idp> idpConfigs = new HashMap<>();
-
-
-    @Override
-    public Idp getIDP(String realm) {
-        if (realm == null || realm.length() == 0) {
-            return this.getIdpConfigs().get(0);
-        } else {
-            return idpConfigs.get(realm);
-        }
-    }
-
-    @Override
-    public void setIDP(Idp config) {
-        idpConfigs.put(config.getRealm(), config);
-    }
-
-    @Override
-    public void removeIDP(String realm) {
-        idpConfigs.remove(realm);
-    }
-
-    public List<Application> getServiceConfigs() {
-        return new ArrayList<Application>(serviceConfigs.values());
-    }
-
-    public void setServiceConfigs(List<ServiceConfig> serviceList) {
-        for (ServiceConfig s : serviceList) {
-            serviceConfigs.put(s.getRealm(), s);
-        }
-    }
-    
-    public List<Idp> getIdpConfigs() {
-        return new ArrayList<Idp>(idpConfigs.values());
-    }
-
-    public void setIdpConfigs(List<IDPConfig> idpList) {
-        for (IDPConfig i : idpList) {
-            idpConfigs.put(i.getRealm(), i);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/EntitlementDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/EntitlementDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/EntitlementDAO.java
deleted file mode 100644
index d93cdc0..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/EntitlementDAO.java
+++ /dev/null
@@ -1,38 +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;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-
-public interface EntitlementDAO {
-
-    List<Entitlement> getEntitlements(int start, int size);
-    
-    Entitlement getEntitlement(String name);
-    
-    Entitlement addEntitlement(Entitlement entitlement);
-    
-    void updateEntitlement(String name, Entitlement entitlement);
-    
-    void deleteEntitlement(String name);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/IdpDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/IdpDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/IdpDAO.java
deleted file mode 100644
index 41c5cdf..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/IdpDAO.java
+++ /dev/null
@@ -1,53 +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;
-
-import java.util.List;
-
-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;
-
-public interface IdpDAO {
-
-    List<Idp> getIdps(int start, int size, List<String> expand);
-
-    Idp getIdp(String realm, List<String> expand);
-
-    Idp addIdp(Idp idp);
-
-    void updateIdp(String realm, Idp idp);
-
-    void deleteIdp(String realm);
-
-    void addApplicationToIdp(Idp idp, Application application);
-    
-    void removeApplicationFromIdp(Idp idp, Application application);
-    
-    void addTrustedIdpToIdp(Idp idp, TrustedIdp trustedIdp);
-    
-    void removeTrustedIdpFromIdp(Idp idp, TrustedIdp trustedIdp);
-    
-    void addClaimToIdp(Idp idp, Claim claim);
-    
-    void removeClaimFromIdp(Idp idp, Claim claim);
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/RoleDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/RoleDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/RoleDAO.java
deleted file mode 100644
index 2d8e7f5..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/RoleDAO.java
+++ /dev/null
@@ -1,43 +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;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.domain.Role;
-
-public interface RoleDAO {
-
-    List<Role> getRoles(int start, int size, List<String> expand);
-
-    Role getRole(String name, List<String> expand);
-
-    Role addRole(Role role);
-
-    void updateRole(String realm, Role role);
-
-    void deleteRole(String name);
-
-    void addEntitlementToRole(Role role, Entitlement entitlement);
-    
-    void removeEntitlementFromRole(Role role, Entitlement 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/TrustedIdpDAO.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/TrustedIdpDAO.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/TrustedIdpDAO.java
deleted file mode 100644
index 54fb634..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/TrustedIdpDAO.java
+++ /dev/null
@@ -1,38 +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;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-
-public interface TrustedIdpDAO {
-
-    List<TrustedIdp> getTrustedIDPs(int start, int size);
-
-    TrustedIdp getTrustedIDP(String realm);
-
-    TrustedIdp addTrustedIDP(TrustedIdp trustedIdp);
-
-    void updateTrustedIDP(String realm, TrustedIdp trustedIdp);
-
-    void deleteTrustedIDP(String realm);
-
-}

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/ApplicationClaimEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationClaimEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationClaimEntity.java
deleted file mode 100644
index e2ca923..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationClaimEntity.java
+++ /dev/null
@@ -1,83 +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 javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-
-@Entity(name = "Application_Claim")
-//@IdClass(ApplicationClaimId.class)
-public class ApplicationClaimEntity {
-    
-    @Id
-    private int id;
-    
-    @ManyToOne
-    @JoinColumn(name = "applicationid")
-    private ApplicationEntity application;
- 
-    @ManyToOne
-    @JoinColumn(name = "claimid")
-    private ClaimEntity claim;
- 
-    private boolean optional;
-    
-    public ApplicationClaimEntity() {
-    }
-    
-    public ApplicationClaimEntity(ApplicationEntity application, ClaimEntity claim) {
-        super();
-        this.application = application;
-        this.claim = claim;
-    }
-    
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public boolean isOptional() {
-        return optional;
-    }
-
-    public void setOptional(boolean optional) {
-        this.optional = optional;
-    }
-
-    public ApplicationEntity getApplication() {
-        return application;
-    }
-
-    public void setApplication(ApplicationEntity application) {
-        this.application = application;
-    }
-
-    public ClaimEntity getClaim() {
-        return claim;
-    }
-
-    public void setClaim(ClaimEntity claim) {
-        this.claim = claim;
-    }
-}

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/ApplicationDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
deleted file mode 100644
index 307e381..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
+++ /dev/null
@@ -1,254 +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.Application;
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
-import org.apache.cxf.fediz.service.idp.service.ApplicationDAO;
-import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-@Repository
-@Transactional
-public class ApplicationDAOJPAImpl implements ApplicationDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(ApplicationDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @Autowired
-    private ClaimDAO claimDAO;
-    
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<Application> getApplications(int start, int size, List<String> expandList) {
-        List<Application> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select a from Application a");
-        
-        //@SuppressWarnings("rawtypes")
-        List<?> serviceEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-    
-        for (Object obj : serviceEntities) {
-            ApplicationEntity entity = (ApplicationEntity) obj;
-            list.add(entity2domain(entity, expandList));
-        }
-        return list;
-    }
-    
-    @Override
-    public Application getApplication(String realm, List<String> expandList) {
-        return entity2domain(getApplicationEntity(realm, em), expandList);
-    }
-    
-    @Override
-    public Application addApplication(Application application) {
-        ApplicationEntity entity = new ApplicationEntity();
-        
-        domain2entity(application, entity);
-        em.persist(entity);
-        
-        LOG.debug("Application '{}' added", application.getRealm());
-        return entity2domain(entity, Arrays.asList("all"));
-    }
-
-    @Override
-    public void updateApplication(String realm, Application application) {
-        Query query = null;
-        query = em.createQuery("select a from Application a where a.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        ApplicationEntity applicationEntity = (ApplicationEntity)query.getSingleResult();
-        
-        domain2entity(application, applicationEntity);
-        
-        em.persist(applicationEntity);
-        
-        LOG.debug("Application '{}' updated", realm);
-    }
-    
-
-    @Override
-    public void deleteApplication(String realm) {
-        Query query = null;
-        query = em.createQuery("select a from Application a where a.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        Object applObj = query.getSingleResult();
-        em.remove(applObj);
-        
-        LOG.debug("Application '{}' deleted", realm);
-        
-    }
-    
-    @Override
-    public void addClaimToApplication(Application application, RequestClaim claim) {
-        ApplicationEntity applicationEntity = null;
-        if (application.getId() != 0) {
-            applicationEntity = em.find(ApplicationEntity.class, application.getId());
-        } else {
-            Query query = null;
-            query = em.createQuery("select a from Application a where a.realm=:realm");
-            query.setParameter("realm", application.getRealm());
-            
-            applicationEntity = (ApplicationEntity)query.getSingleResult();
-        }
-        
-        Claim c = claimDAO.getClaim(claim.getClaimType().toString());
-        ClaimEntity claimEntity = em.find(ClaimEntity.class, c.getId());
-                
-        ApplicationClaimEntity appClaimEntity = new ApplicationClaimEntity();
-        appClaimEntity.setClaim(claimEntity);
-        appClaimEntity.setApplication(applicationEntity);
-        appClaimEntity.setOptional(claim.isOptional());
-        
-        applicationEntity.getRequestedClaims().add(appClaimEntity);
-    }
-    
-    @Override
-    public void removeClaimFromApplication(Application application, RequestClaim claim) {
-        ApplicationEntity applicationEntity = null;
-        if (application.getId() != 0) {
-            applicationEntity = em.find(ApplicationEntity.class, application.getId());
-        } else {
-            Query query = null;
-            query = em.createQuery("select a from Application a where a.realm=:realm");
-            query.setParameter("realm", application.getRealm());
-            
-            applicationEntity = (ApplicationEntity)query.getSingleResult();
-        }
-        
-        ApplicationClaimEntity foundEntity = null;
-        for (ApplicationClaimEntity acm : applicationEntity.getRequestedClaims()) {
-            if (claim.getClaimType().toString().equals(acm.getClaim().getClaimType())) {
-                foundEntity = acm;
-                break;
-            }
-        }
-        if (foundEntity == null) {
-            throw new EntityNotFoundException("ApplicationClaimEntity not found");
-        }
-        
-        applicationEntity.getRequestedClaims().remove(foundEntity);
-    }
-    
-    
-    static ApplicationEntity getApplicationEntity(String realm, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select a from Application a where a.realm=:realm");
-        query.setParameter("realm", realm);
-        
-        //@SuppressWarnings("rawtypes")
-        return (ApplicationEntity)query.getSingleResult();
-    }
-        
-    public static void domain2entity(Application application, ApplicationEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (application.getId() > 0) {
-            entity.setId(application.getId());
-        }
-        
-        entity.setEncryptionCertificate(application.getEncryptionCertificate());
-        entity.setValidatingCertificate(application.getValidatingCertificate());
-        entity.setLifeTime(application.getLifeTime());
-        entity.setProtocol(application.getProtocol());
-        entity.setRealm(application.getRealm());
-        entity.setRole(application.getRole());
-        entity.setServiceDescription(application.getServiceDescription());
-        entity.setServiceDisplayName(application.getServiceDisplayName());
-        entity.setTokenType(application.getTokenType());
-        entity.setPolicyNamespace(application.getPolicyNamespace());
-        entity.setPassiveRequestorEndpoint(application.getPassiveRequestorEndpoint());
-        entity.setPassiveRequestorEndpointConstraint(application.getPassiveRequestorEndpointConstraint());
-        entity.setEnableAppliesTo(application.isEnableAppliesTo());
-    }
-    
-    public static Application entity2domain(ApplicationEntity entity, List<String> expandList) {
-        Application application = new Application();
-        application.setId(entity.getId());
-        application.setEncryptionCertificate(entity.getEncryptionCertificate());
-        application.setValidatingCertificate(entity.getValidatingCertificate());
-        application.setLifeTime(entity.getLifeTime());
-        application.setProtocol(entity.getProtocol());
-        application.setRealm(entity.getRealm());
-        application.setRole(entity.getRole());
-        application.setServiceDescription(entity.getServiceDescription());
-        application.setServiceDisplayName(entity.getServiceDisplayName());
-        application.setTokenType(entity.getTokenType());
-        application.setPolicyNamespace(entity.getPolicyNamespace());
-        application.setPassiveRequestorEndpoint(entity.getPassiveRequestorEndpoint());
-        application.setPassiveRequestorEndpointConstraint(entity.getPassiveRequestorEndpointConstraint());
-        application.setEnableAppliesTo(entity.isEnableAppliesTo());
-        
-        if (expandList != null && (expandList.contains("all") || expandList.contains("claims"))) {
-            for (ApplicationClaimEntity item : entity.getRequestedClaims()) {
-                RequestClaim claim = entity2domain(item);
-                application.getRequestedClaims().add(claim);
-            }
-        }
-        return application;
-    }
-    
-    public static RequestClaim entity2domain(ApplicationClaimEntity entity) {
-        Claim claim = ClaimDAOJPAImpl.entity2domain(entity.getClaim());
-        RequestClaim reqClaim = new RequestClaim(claim);
-        reqClaim.setId(entity.getId());
-        reqClaim.setOptional(entity.isOptional());
-        
-        return reqClaim;
-    }
-    
-    public static void domain2entity(ApplicationEntity application,
-                                     RequestClaim reqClaim, ApplicationClaimEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        ClaimEntity claim = new ClaimEntity();
-        ClaimDAOJPAImpl.domain2entity(reqClaim, claim);
-        
-        entity.setApplication(application);
-        entity.setClaim(claim);
-        entity.setOptional(reqClaim.isOptional());
-    }
-
-}

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/ApplicationEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
deleted file mode 100644
index 1397da2..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
+++ /dev/null
@@ -1,214 +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.OneToMany;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-import org.apache.openjpa.persistence.jdbc.Index;
-
-
-@Entity(name = "Application")
-public class ApplicationEntity {
-    
-    @Id
-    private int id;
-    
-    @Index
-    @NotNull
-    private String realm;  //wtrealm, whr
-
-    //Could be read from Metadata, RoleDescriptor protocolSupportEnumeration=
-    // "http://docs.oa14sis-open.org/wsfed/federation/200706"
-    // Metadata could provide more than one but one must be chosen
-    @NotNull
-    @ApplicationProtocolSupported
-    private String protocol;
- 
-    // Public key only
-    // Could be read from Metadata, md:KeyDescriptor, use="encryption"
-    private String encryptionCertificate;
-    
-    // Certificate for Signature verification
-    private String validatingCertificate;
-    
-    // Could be read from Metadata, fed:ClaimTypesRequested
-    @OneToMany(mappedBy = "application", cascade = CascadeType.ALL, orphanRemoval = true)
-    private List<ApplicationClaimEntity> requestedClaims = new ArrayList<>();
-    
-    //Could be read from Metadata, ServiceDisplayName
-    //usage for list of application where user is logged in
-    @NotNull
-    private String serviceDisplayName;
-    
-    //Could be read from Metadata, ServiceDescription
-    //usage for list of application where user is logged in
-    private String serviceDescription;
-    
-    //Could be read from Metadata, RoleDescriptor
-    //fed:ApplicationServiceType, fed:SecurityTokenServiceType
-    private String role;
-    
-    // Not in Metadata, configured in IDP or passed in wreq parameter
-    @NotNull
-    private String tokenType;
-    
-    // Not in Metadata, configured in IDP or passed in wreq parameter
-    @Min(value = 1)
-    private int lifeTime;
-    
-    // Request audience restriction in token for this application (default is true)
-    private boolean enableAppliesTo = true;
-    
-    // WS-Policy Namespace in SignIn Response
-    private String policyNamespace;
-    
-    private String passiveRequestorEndpoint;
-    
-    // A regular expression constraint on the passiveRequestorEndpoint
-    private String passiveRequestorEndpointConstraint;
-
-
-    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 getProtocol() {
-        return protocol;
-    }
-
-    public void setProtocol(String protocol) {
-        this.protocol = protocol;
-    }
-
-    public String getEncryptionCertificate() {
-        return encryptionCertificate;
-    }
-
-    public void setEncryptionCertificate(String encryptionCertificate) {
-        this.encryptionCertificate = encryptionCertificate;
-    }
-
-    public List<ApplicationClaimEntity> getRequestedClaims() {
-        return requestedClaims;
-    }
-
-    public void setRequestedClaims(List<ApplicationClaimEntity> requestedClaims) {
-        this.requestedClaims = requestedClaims;
-    }
-
-    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 String getRole() {
-        return role;
-    }
-
-    public void setRole(String role) {
-        this.role = role;
-    }
-
-    public String getTokenType() {
-        return tokenType;
-    }
-
-    public void setTokenType(String tokenType) {
-        this.tokenType = tokenType;
-    }
-
-    public int getLifeTime() {
-        return lifeTime;
-    }
-
-    public void setLifeTime(int lifeTime) {
-        this.lifeTime = lifeTime;
-    }
-    
-    public String getPolicyNamespace() {
-        return policyNamespace;
-    }
-
-    public void setPolicyNamespace(String policyNamespace) {
-        this.policyNamespace = policyNamespace;
-    }
-
-    public String getPassiveRequestorEndpoint() {
-        return passiveRequestorEndpoint;
-    }
-
-    public void setPassiveRequestorEndpoint(String passiveRequestorEndpoint) {
-        this.passiveRequestorEndpoint = passiveRequestorEndpoint;
-    }
-    
-    public String getPassiveRequestorEndpointConstraint() {
-        return passiveRequestorEndpointConstraint;
-    }
-
-    public void setPassiveRequestorEndpointConstraint(String passiveRequestorEndpointConstraint) {
-        this.passiveRequestorEndpointConstraint = passiveRequestorEndpointConstraint;
-    }
-
-    public String getValidatingCertificate() {
-        return validatingCertificate;
-    }
-
-    public void setValidatingCertificate(String validatingCertificate) {
-        this.validatingCertificate = validatingCertificate;
-    }
-
-    public boolean isEnableAppliesTo() {
-        return enableAppliesTo;
-    }
-
-    public void setEnableAppliesTo(boolean enableAppliesTo) {
-        this.enableAppliesTo = enableAppliesTo;
-    }
-}

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/ApplicationIdpProtocolSupportValidator.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationIdpProtocolSupportValidator.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationIdpProtocolSupportValidator.java
deleted file mode 100644
index 5a999e9..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationIdpProtocolSupportValidator.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.ApplicationProtocolHandler;
-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 Application protocol
- */
-@Component
-public class ApplicationIdpProtocolSupportValidator
-    implements ConstraintValidator<ApplicationProtocolSupported, String> {
-
-    @Autowired
-    @Qualifier("applicationProtocolControllerImpl")
-    private ProtocolController<ApplicationProtocolHandler> applicationProtocolHandlers;
-    
-    @Override
-    public boolean isValid(String object, ConstraintValidatorContext constraintContext) {
-        
-        List<String> protocols = applicationProtocolHandlers.getProtocols();
-        return protocols.contains(object);
-    }
-
-    @Override
-    public void initialize(ApplicationProtocolSupported constraintAnnotation) {
-    }
-
-}

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/ApplicationProtocolSupported.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationProtocolSupported.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationProtocolSupported.java
deleted file mode 100644
index 6dc69a5..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationProtocolSupported.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 = ApplicationIdpProtocolSupportValidator.class)
-@Documented
-public @interface ApplicationProtocolSupported {
-
-    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/jpa/ClaimDAOJPAImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
deleted file mode 100644
index dea2b8d..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
+++ /dev/null
@@ -1,143 +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.URI;
-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.Claim;
-import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Repository
-@Transactional
-public class ClaimDAOJPAImpl implements ClaimDAO {
-    
-    private static final Logger LOG = LoggerFactory.getLogger(ClaimDAOJPAImpl.class);
-
-    private EntityManager em;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public List<Claim> getClaims(int start, int size) {
-        List<Claim> list = new ArrayList<>();
-        
-        Query query = null;
-        query = em.createQuery("select c from Claim c");
-        
-        //@SuppressWarnings("rawtypes")
-        List<?> claimEntities = query
-            .setFirstResult(start)
-            .setMaxResults(size)
-            .getResultList();
-
-        for (Object obj : claimEntities) {
-            ClaimEntity entity = (ClaimEntity) obj;
-            list.add(entity2domain(entity));
-        }
-        
-        return list;
-    }
-    
-    @Override
-    public Claim addClaim(Claim claim) {
-        ClaimEntity entity = new ClaimEntity();
-        domain2entity(claim, entity);
-        em.persist(entity);
-        
-        LOG.debug("Claim '{}' added", claim.getClaimType());
-        return entity2domain(entity);
-    }
-
-    @Override
-    public Claim getClaim(String claimType) {
-        return entity2domain(getClaimEntity(claimType, em));
-    }
-
-    @Override
-    public void updateClaim(String claimType, Claim claim) {
-        Query query = null;
-        query = em.createQuery("select c from Claim c where c.claimtype=:claimtype");
-        query.setParameter("claimtype", claimType);
-        
-        //@SuppressWarnings("rawtypes")
-        ClaimEntity claimEntity = (ClaimEntity)query.getSingleResult();
-        
-        domain2entity(claim, claimEntity);
-        
-        LOG.debug("Claim '{}' added", claim.getClaimType());
-        em.persist(claimEntity);
-    }
-
-    @Override
-    public void deleteClaim(String claimType) {
-        Query query = null;
-        query = em.createQuery("select c from Claim c where c.claimType=:claimtype");
-        query.setParameter("claimtype", claimType);
-        
-        //@SuppressWarnings("rawtypes")
-        Object claimObj = query.getSingleResult();
-        em.remove(claimObj);
-        
-        LOG.debug("Claim '{}' deleted", claimType);
-    }
-    
-    static ClaimEntity getClaimEntity(String claimType, EntityManager em) {
-        Query query = null;
-        query = em.createQuery("select c from Claim c where c.claimType=:claimtype");
-        query.setParameter("claimtype", claimType);
-        
-        //@SuppressWarnings("rawtypes")
-        return (ClaimEntity)query.getSingleResult();
-    }
-    
-    public static void domain2entity(Claim claim, ClaimEntity entity) {
-        //The ID must not be updated if the entity has got an id already (update case)
-        if (claim.getId() > 0) {
-            entity.setId(claim.getId());
-        }
-        entity.setClaimType(claim.getClaimType().toString());
-        entity.setDisplayName(claim.getDisplayName());
-        entity.setDescription(claim.getDescription());
-    }
-    
-    public static Claim entity2domain(ClaimEntity entity) {
-        Claim claim = new Claim();
-        claim.setId(entity.getId());
-        claim.setClaimType(URI.create(entity.getClaimType()));
-        claim.setDisplayName(entity.getDisplayName());
-        claim.setDescription(entity.getDescription());
-        return claim;
-    }
-
-}

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/ClaimEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
deleted file mode 100644
index 54ee1eb..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
+++ /dev/null
@@ -1,71 +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 javax.validation.constraints.NotNull;
-
-import org.apache.openjpa.persistence.jdbc.Index;
-
-@Entity(name = "Claim")
-public class ClaimEntity {
-    
-    @Id
-    private int id;
-    
-    @Index
-    @NotNull
-    private String claimType;
-    
-    private String displayName;
-    private String description;
-        
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-    
-    public void setClaimType(String claimType) {
-        this.claimType = claimType;
-    }
-    
-    public String getClaimType() {
-        return claimType;
-    }
-
-    public String getDisplayName() {
-        return displayName;
-    }
-
-    public void setDisplayName(String displayName) {
-        this.displayName = displayName;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-}

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/ConfigServiceJPA.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ConfigServiceJPA.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ConfigServiceJPA.java
deleted file mode 100644
index 03f70b9..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ConfigServiceJPA.java
+++ /dev/null
@@ -1,96 +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.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.rest.IdpService;
-import org.apache.cxf.fediz.service.idp.service.ConfigService;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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;
-
-
-public class ConfigServiceJPA implements ConfigService {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ConfigServiceJPA.class);
-    
-    IdpService idpService;
-
-    @Override
-    public Idp getIDP(String realm) {
-        Authentication currentAuthentication = SecurityContextHolder.getContext().getAuthentication();
-        try {
-            final Set<GrantedAuthority> authorities = new HashSet<>();
-            
-            if (realm == null || realm.length() == 0) {
-                authorities.add(new SimpleGrantedAuthority("IDP_LIST"));
-                UsernamePasswordAuthenticationToken technicalUser =
-                    new UsernamePasswordAuthenticationToken("IDP_TEST", "N.A", authorities);
-                
-                SecurityContextHolder.getContext().setAuthentication(technicalUser);
-                
-                return idpService.getIdps(0, 1, Arrays.asList("all"), null).getIdps().iterator().next();
-            } else {
-                authorities.add(new SimpleGrantedAuthority("IDP_READ"));
-                UsernamePasswordAuthenticationToken technicalUser =
-                    new UsernamePasswordAuthenticationToken("IDP_TEST", "N.A", authorities);
-                
-                SecurityContextHolder.getContext().setAuthentication(technicalUser);
-                
-                return idpService.getIdp(realm, Arrays.asList("all"));
-            }
-        } finally {
-            SecurityContextHolder.getContext().setAuthentication(currentAuthentication);
-            LOG.info("Old Spring security context restored");
-        }
-    }
-
-    @Override
-    public void setIDP(Idp config) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    @Override
-    public void removeIDP(String realm) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public IdpService getIdpService() {
-        return idpService;
-    }
-
-    public void setIdpService(IdpService idpService) {
-        this.idpService = idpService;
-    }
-    
-
-}

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/DBInitApplicationListener.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBInitApplicationListener.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBInitApplicationListener.java
deleted file mode 100644
index eebb99a..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBInitApplicationListener.java
+++ /dev/null
@@ -1,73 +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.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.stereotype.Component;
-
-@Component
-public class DBInitApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DBInitApplicationListener.class);
-    
-    private EntityManager em;
-    
-    @Autowired
-    private List<DBLoader> dbloader;
-    
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-        
-    @Override
-    public void onApplicationEvent(ContextRefreshedEvent arg0) {
-        if (!isDBEmpty()) {
-            LOG.info("Inital DB already loaded");
-            return;
-        }
-        
-        LOG.debug("Loading inital DB data...");
-        for (DBLoader loader : this.dbloader) {
-            loader.load();
-            LOG.info("Inital DB data loaded for " + loader.getName());
-        }
-    }
-    
-    protected boolean isDBEmpty() {
-        CriteriaBuilder cb = em.getCriteriaBuilder();
-        CriteriaQuery<Long> cq = cb.createQuery(Long.class);
-        cq.select(cb.count(cq.from(ClaimEntity.class)));
-
-        return em.createQuery(cq).getSingleResult() == 0;
-    }
-
-}

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/DBLoader.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoader.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoader.java
deleted file mode 100644
index c79a79b..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoader.java
+++ /dev/null
@@ -1,28 +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;
-
-public interface DBLoader {
-
-    void load();
-    
-    String getName();
-
-}

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/DBLoaderImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
deleted file mode 100644
index 2c6ab15..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
+++ /dev/null
@@ -1,163 +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.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.apache.cxf.fediz.service.idp.domain.FederationType;
-import org.apache.cxf.fediz.service.idp.domain.TrustType;
-import org.apache.wss4j.dom.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("Web Application to illustrate WS-Federation");
-            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(FederationType.FEDERATE_IDENTITY);
-            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(TrustType.PEER_TRUST);
-            entity3.setUrl("https://localhost:12443/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(new URL("https://localhost:9443/fediz-idp/federation"));
-            idpEntity.setRealm("urn:org:apache:cxf:fediz:idp:realm-A");
-            idpEntity.setStsUrl(new URL("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<>();
-            authUris.put("default", "/login/default");
-            idpEntity.setAuthenticationURIs(authUris);
-            List<String> protocols = new ArrayList<>();
-            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<>();
-            tokenTypes.add(WSConstants.SAML2_NS);
-            tokenTypes.add(WSConstants.SAML_NS);
-            idpEntity.setTokenTypesOffered(tokenTypes);
-            idpEntity.setUseCurrentIdp(true);
-            em.persist(idpEntity);
-            
-            em.flush();
-        } catch (Exception ex) {
-            LOG.warn("Failed to initialize DB with data", ex);
-        }
-    }
-}

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/DBLoaderSpring.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
deleted file mode 100644
index eb0fa40..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
+++ /dev/null
@@ -1,129 +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.Collection;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.support.GenericXmlApplicationContext;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class DBLoaderSpring implements DBLoader {
-    
-    public static final String NAME = "SPRINGDBLOADER";
-    
-    private static final Logger LOG = LoggerFactory.getLogger(DBLoaderSpring.class);
-    
-    private EntityManager em;
-    private String resource;
-
-    @PersistenceContext
-    public void setEntityManager(EntityManager entityManager) {
-        this.em = entityManager;
-    }
-    
-    @Override
-    public String getName() {
-        return NAME;
-    }
-    
-    public String getResource() {
-        return resource;
-    }
-
-    public void setResource(String resource) {
-        this.resource = resource;
-    }
-
-    @Override
-    public void load() {
-
-        GenericXmlApplicationContext ctx = null;
-        try {
-            
-            if (resource == null) {
-                LOG.warn("Resource null for DBLoaderSpring");
-            }
-            
-            ctx = new GenericXmlApplicationContext();
-            ctx.load(resource);
-            ctx.refresh();
-            ctx.start();
-            
-            Collection<EntitlementEntity> entitlements = ctx.
-                getBeansOfType(EntitlementEntity.class, true, true).values();
-            for (EntitlementEntity e : entitlements) {
-                em.persist(e);
-            }
-            LOG.info(entitlements.size() + " EntitlementEntity added");
-            
-            Collection<RoleEntity> roles = ctx.
-                getBeansOfType(RoleEntity.class, true, true).values();
-            for (RoleEntity r : roles) {
-                em.persist(r);
-            }
-            LOG.info(roles.size() + " RoleEntity added");
-            
-            Collection<ClaimEntity> claims = ctx.getBeansOfType(ClaimEntity.class, true, true).values();
-            for (ClaimEntity c : claims) {
-                em.persist(c);
-            }
-            LOG.info(claims.size() + " ClaimEntity added");
-            
-            Collection<TrustedIdpEntity> trustedIdps = ctx.getBeansOfType(TrustedIdpEntity.class).values();
-            for (TrustedIdpEntity t : trustedIdps) {
-                em.persist(t);
-            }
-            LOG.info(trustedIdps.size() + " TrustedIdpEntity added");
-            
-            Collection<ApplicationEntity> applications = ctx.getBeansOfType(ApplicationEntity.class).values();
-            for (ApplicationEntity a : applications) {
-                em.persist(a);
-            }
-            LOG.info(applications.size() + " ApplicationEntity added");
-            
-            Collection<IdpEntity> idps = ctx.getBeansOfType(IdpEntity.class).values();
-            for (IdpEntity i : idps) {
-                em.persist(i);
-            }
-            LOG.info(idps.size() + " IdpEntity added");
-            
-            Collection<ApplicationClaimEntity> applicationClaims =
-                ctx.getBeansOfType(ApplicationClaimEntity.class).values();
-            for (ApplicationClaimEntity ac : applicationClaims) {
-                em.persist(ac);
-            }
-            LOG.info(applicationClaims.size() + " ApplicationClaimEntity added");
-            
-            em.flush();
-        } catch (Exception ex) {
-            LOG.warn("Failed to initialize DB with data", ex);
-        } finally {
-            if (ctx != null) {
-                ctx.close();
-            }
-        }
-    }
-
-}


Mime
View raw message