Remove Code from cadi, it is now in authz
[aaf/cadi.git] / aaf / src / main / java / org / onap / aaf / cadi / aaf / v2_0 / AAFConDME2.java
diff --git a/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConDME2.java b/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConDME2.java
deleted file mode 100644 (file)
index 2757efc..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.aaf.v2_0;\r
-\r
-import java.io.IOException;\r
-import java.net.ConnectException;\r
-import java.net.URI;\r
-import java.net.URISyntaxException;\r
-import java.security.GeneralSecurityException;\r
-import java.security.Principal;\r
-import java.util.Properties;\r
-\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.LocatorException;\r
-import org.onap.aaf.cadi.PropAccess;\r
-import org.onap.aaf.cadi.SecuritySetter;\r
-import org.onap.aaf.cadi.client.Rcli;\r
-import org.onap.aaf.cadi.client.Retryable;\r
-import org.onap.aaf.cadi.config.Config;\r
-import org.onap.aaf.cadi.config.SecurityInfoC;\r
-import org.onap.aaf.cadi.dme2.DME2BasicAuth;\r
-import org.onap.aaf.cadi.dme2.DME2TransferSS;\r
-import org.onap.aaf.cadi.dme2.DME2x509SS;\r
-import org.onap.aaf.cadi.dme2.DRcli;\r
-import org.onap.aaf.cadi.principal.BasicPrincipal;\r
-\r
-import com.att.aft.dme2.api.DME2Client;\r
-import com.att.aft.dme2.api.DME2Exception;\r
-import com.att.aft.dme2.api.DME2Manager;\r
-import org.onap.aaf.inno.env.APIException;\r
-\r
-public class AAFConDME2 extends AAFCon<DME2Client>{\r
-       private DME2Manager manager;\r
-       private boolean isProxy;\r
-       private URI initURI;\r
-\r
-       public AAFConDME2(PropAccess access) throws CadiException, GeneralSecurityException, IOException{\r
-               super(access,Config.AAF_URL,new SecurityInfoC<DME2Client> (access));\r
-               manager = newManager(access);\r
-               setIsProxy();\r
-       }\r
-       \r
-       public AAFConDME2(PropAccess access, String url) throws CadiException, GeneralSecurityException, IOException{\r
-               super(access,url,new SecurityInfoC<DME2Client> (access));\r
-               manager = newManager(access);\r
-               setIsProxy();\r
-       }\r
-\r
-       public AAFConDME2(PropAccess access, SecurityInfoC<DME2Client> si) throws CadiException {\r
-               super(access,Config.AAF_URL,si);\r
-               manager = newManager(access);\r
-               setIsProxy();\r
-       }\r
-\r
-       public AAFConDME2(PropAccess access, String url, SecurityInfoC<DME2Client> si) throws CadiException {\r
-               super(access,url,si);\r
-               manager = newManager(access);\r
-               setIsProxy();\r
-       }\r
-\r
-       /**\r
-       *  Construct a Connector based on the AAF one.  This is for remote access to OTHER than AAF,\r
-       *  but using Credentials, etc\r
-       */ \r
-       private AAFConDME2(AAFCon<DME2Client> aafcon, String url) throws CadiException {\r
-               super(aafcon);\r
-               try {\r
-                       initURI = new URI(url);\r
-               } catch (URISyntaxException e) {\r
-                       throw new CadiException(e);\r
-               }\r
-               manager = newManager(access);\r
-       }\r
-       \r
-       /**\r
-       *  Create a Connector based on the AAF one.  This is for remote access to OTHER than AAF,\r
-       *  but using Credentials, etc\r
-       */ \r
-       public AAFCon<DME2Client> clone(String url) throws CadiException {\r
-               return new AAFConDME2(this,url);\r
-       }\r
-       \r
-       private void setIsProxy() {\r
-               String str;\r
-               if((str=access.getProperty(Config.AAF_URL, null))!=null) {\r
-                       isProxy = str.contains("service=com.att.authz.authz-gw/version=");\r
-               }\r
-       }\r
-\r
-       private DME2Manager newManager(PropAccess access) throws CadiException {\r
-               Properties props = access.getDME2Properties();\r
-               // Critical that TLS Settings not ignored\r
-               try {\r
-                       return new DME2Manager("AAFCon",props);\r
-               } catch (DME2Exception e) {\r
-                       throw new CadiException(e);\r
-               }\r
-       }\r
-\r
-\r
-       /* (non-Javadoc)\r
-        * @see com.att.cadi.aaf.v2_0.AAFCon#basicAuth(java.lang.String, java.lang.String)\r
-        */\r
-       @Override\r
-       public SecuritySetter<DME2Client> basicAuth(String user, String password) throws CadiException {\r
-               if(password.startsWith("enc:???")) {\r
-                       try {\r
-                               password = access.decrypt(password, true);\r
-                       } catch (IOException e) {\r
-                               throw new CadiException("Error Decrypting Password",e);\r
-                       }\r
-               }\r
-\r
-               try {\r
-                       return set(new DME2BasicAuth(user,password,si));\r
-               } catch (IOException e) {\r
-                       throw new CadiException("Error setting up DME2BasicAuth",e);\r
-               }\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see com.att.cadi.aaf.v2_0.AAFCon#rclient(java.net.URI, com.att.cadi.SecuritySetter)\r
-        */\r
-       @Override\r
-       protected Rcli<DME2Client> rclient(URI uri, SecuritySetter<DME2Client> ss) {\r
-               DRcli dc = new DRcli(uri, ss);\r
-               dc.setProxy(isProxy);\r
-               dc.setManager(manager);\r
-               return dc;\r
-       }\r
-\r
-       @Override\r
-       public SecuritySetter<DME2Client> transferSS(Principal principal) throws CadiException {\r
-               try {\r
-                       return principal==null?ss:new DME2TransferSS(principal, app, si);\r
-               } catch (IOException e) {\r
-                       throw new CadiException("Error creating DME2TransferSS",e);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public SecuritySetter<DME2Client> basicAuthSS(BasicPrincipal principal) throws CadiException {\r
-               try {\r
-                       return new DME2BasicAuth(principal,si);\r
-               } catch (IOException e) {\r
-                       throw new CadiException("Error creating DME2BasicAuth",e);\r
-               }\r
-\r
-       }\r
-\r
-       @Override\r
-       public SecuritySetter<DME2Client> x509Alias(String alias) throws CadiException {\r
-               try {\r
-                       presetProps(access, alias);\r
-                       return new DME2x509SS(alias,si);\r
-               } catch (Exception e) {\r
-                       throw new CadiException("Error creating DME2x509SS",e);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public <RET> RET best(Retryable<RET> retryable) throws LocatorException, CadiException, APIException {\r
-               // NOTE: DME2 had Retry Logic embedded lower.  \r
-               try {\r
-                       return (retryable.code(rclient(initURI,ss)));\r
-               } catch (ConnectException e) {\r
-                       // DME2 should catch\r
-                       try {\r
-                               manager.refresh();\r
-                       } catch (Exception e1) {\r
-                               throw new CadiException(e1);\r
-                       }\r
-                       throw new CadiException(e);\r
-               }\r
-       }\r
-       \r
-       public static void presetProps(PropAccess access, String alias) throws IOException {\r
-               System.setProperty(Config.AFT_DME2_CLIENT_SSL_CERT_ALIAS, alias);\r
-               if(System.getProperty(Config.AFT_DME2_CLIENT_IGNORE_SSL_CONFIG)==null) {\r
-                       access.getDME2Properties();\r
-               }\r
-\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see com.att.cadi.aaf.v2_0.AAFCon#initURI()\r
-        */\r
-       @Override\r
-       protected URI initURI() {\r
-               return initURI;\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see com.att.cadi.aaf.v2_0.AAFCon#setInitURI(java.lang.String)\r
-        */\r
-       @Override\r
-       protected void setInitURI(String uriString) throws CadiException {\r
-               try {\r
-                       initURI = new URI(uriString);\r
-               } catch (URISyntaxException e) {\r
-                       throw new CadiException(e);\r
-               }\r
-       }\r
-}\r