Update aaf client module
[aaf/authz.git] / authz-core / src / main / java / com / att / authz / server / AbsServer.java
diff --git a/authz-core/src/main/java/com/att/authz/server/AbsServer.java b/authz-core/src/main/java/com/att/authz/server/AbsServer.java
deleted file mode 100644 (file)
index 75db79b..0000000
+++ /dev/null
@@ -1,149 +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 com.att.authz.server;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.lang.reflect.Constructor;\r
-import java.net.URL;\r
-import java.security.GeneralSecurityException;\r
-import java.security.Principal;\r
-import java.util.Properties;\r
-\r
-import javax.net.ssl.SSLContext;\r
-import javax.net.ssl.SSLSocketFactory;\r
-\r
-import com.att.authz.common.Define;\r
-import com.att.authz.env.AuthzEnv;\r
-import com.att.authz.env.AuthzTrans;\r
-import com.att.cadi.CadiException;\r
-import com.att.cadi.LocatorException;\r
-//import com.att.cadi.PropAccess;\r
-import com.att.cadi.aaf.v2_0.AAFConHttp;\r
-import com.att.cadi.client.Rcli;\r
-import com.att.cadi.client.Retryable;\r
-import com.att.cadi.config.Config;\r
-import com.att.cadi.http.HTransferSS;\r
-import com.att.cssa.rserv.RServlet;\r
-import com.att.inno.env.APIException;\r
-\r
-public abstract class AbsServer extends RServlet<AuthzTrans> {\r
-       private static final String AAF_API_VERSION = "2.0";\r
-       public final String app;\r
-       public final AuthzEnv env;\r
-       public AAFConHttp aafCon;\r
-\r
-    public AbsServer(final AuthzEnv env, final String app) throws CadiException, GeneralSecurityException, IOException {\r
-       this.env = env;\r
-       this.app = app;\r
-       if(env.getProperty(Config.AAF_URL)!=null) {\r
-               //aafCon = new AAFConHttp(env);\r
-       }\r
-    }\r
-    \r
-    // This is a method, so we can overload for AAFAPI\r
-    public String aaf_url() {\r
-       return env.getProperty(Config.AAF_URL);\r
-    }\r
-    \r
-       public abstract void startDME2(Properties props) throws Exception;\r
-       public static void setup(Class<?> abss, String propFile) {\r
-\r
-               try {\r
-                       // Load Properties from authFramework.properties.  Needed for DME2 and AuthzEnv\r
-                       Properties props = new Properties();\r
-                       URL rsrc = ClassLoader.getSystemResource(propFile);\r
-                       if(rsrc==null) {\r
-                               System.err.println("Folder containing " + propFile + " must be on Classpath");\r
-                               System.exit(1);\r
-                       }\r
-\r
-                       InputStream is = rsrc.openStream();\r
-                       try {\r
-                               props.load(is);\r
-                       } finally {\r
-                               is.close();\r
-                               is=null;\r
-                       }\r
-\r
-                       // Load Properties into AuthzEnv\r
-                       AuthzEnv env = new AuthzEnv(props);\r
-                       // Log where Config found\r
-                       env.init().log("Configuring from",rsrc.getPath());\r
-                       rsrc = null;\r
-                       \r
-                       // Print Cipher Suites Available\r
-                       if(env.debug().isLoggable()) {\r
-                               SSLContext context = SSLContext.getDefault();\r
-                               SSLSocketFactory sf = context.getSocketFactory();\r
-                               StringBuilder sb = new StringBuilder("Available Cipher Suites: ");\r
-                               boolean first = true;\r
-                               int count=0;\r
-                               for( String cs : sf.getSupportedCipherSuites()) {\r
-                                       if(first)first = false;\r
-                                       else sb.append(',');\r
-                                       sb.append(cs);\r
-                                       if(++count%4==0){sb.append('\n');}\r
-                               }\r
-                               env.debug().log(sb);\r
-                       }\r
-\r
-                       // Set ROOT NS, etc\r
-                       Define.set(env);\r
-\r
-                       // Convert CADI properties and Encrypted Passwords for these two properties (if exist) \r
-                       // to DME2 Readable.  Further, Discovery Props are loaded to System if missing.\r
-                       // May be causing client errors\r
-                       //Config.cadiToDME2(env,props);\r
-                       env.init().log("DME2 ServiceName: " + env.getProperty("DMEServiceName","unknown"));\r
-\r
-                       // Construct with Env\r
-                       Constructor<?> cons = abss.getConstructor(new Class<?>[] {AuthzEnv.class});\r
-                       // Start DME2 (DME2 needs Properties form of props)\r
-                       AbsServer s = (AbsServer)cons.newInstance(env);\r
-                       \r
-                       // Schedule removal of Clear Text Passwords from System Props (DME2 Requirement) \r
-//                     new Timer("PassRemove").schedule(tt, 120000);\r
-//                     tt=null;\r
-                       \r
-                       s.startDME2(props);\r
-               } catch (Exception e) {\r
-                       e.printStackTrace(System.err);\r
-                       System.exit(1);\r
-               }\r
-       }\r
-       \r
-       public Rcli<?> client() throws CadiException {\r
-               return aafCon.client(AAF_API_VERSION);\r
-       }\r
-\r
-       public Rcli<?> clientAsUser(Principal p) throws CadiException {\r
-               return aafCon.client(AAF_API_VERSION).forUser(\r
-                               new HTransferSS(p,app, aafCon.securityInfo()));\r
-       }\r
-\r
-       public<RET> RET clientAsUser(Principal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException  {\r
-                       return aafCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable);\r
-       }\r
-\r
-}\r