Merge "Sonar fixes related to exceptions"
[aaf/authz.git] / cadi / core / src / main / java / org / onap / aaf / cadi / config / Config.java
index b74ccb3..efe5503 100644 (file)
@@ -74,14 +74,12 @@ public class Config {
        private static final String OAUTH_TOKEN_MGR = OAUTH+".TokenMgr";
        private static final String OAUTH_HTTP_TAF = OAUTH+".OAuth2HttpTaf";
        private static final String OAUTH_DIRECT_TAF = OAUTH+".OAuthDirectTAF";
-
        public static final String UTF_8 = "UTF-8";
 
        // Property Names associated with configurations.
        // As of 1.0.2, these have had the dots removed so as to be compatible with JavaBean style
        // configurations as well as property list style.
        public static final String HOSTNAME = "hostname";
-       public static final String CADI_REGISTRATION_HOSTNAME = "cadi_registration_hostname";
        public static final String CADI_PROP_FILES = "cadi_prop_files"; // Additional Properties files (separate with ;)
        public static final String CADI_LOGLEVEL = "cadi_loglevel";
        public static final String CADI_LOGDIR = "cadi_log_dir";
@@ -136,12 +134,22 @@ public class Config {
        public static final String OAUTH_CLIENT_SECRET="client_secret";
        
        public static final String AAF_ENV = "aaf_env";
-       public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
        public static final String AAF_ROOT_NS = "aaf_root_ns";
        public static final String AAF_ROOT_NS_DEF = "org.osaaf.aaf";
        public static final String AAF_ROOT_COMPANY = "aaf_root_company";
        public static final String AAF_LOCATE_URL = "aaf_locate_url"; //URL for AAF locator
        private static final String AAF_LOCATE_URL_TAG = "AAF_LOCATE_URL"; // Name of Above for use in Config Variables.
+       public static final String AAF_DEFAULT_VERSION = "2.1";
+       public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
+       public static final String AAF_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.service:" + AAF_DEFAULT_VERSION;
+       public static final String GUI_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.gui:" + AAF_DEFAULT_VERSION;
+       public static final String CM_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.cm:" + AAF_DEFAULT_VERSION;
+       public static final String FS_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.fs:" + AAF_DEFAULT_VERSION;
+       public static final String HELLO_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.hello:" + AAF_DEFAULT_VERSION;
+       public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/AAF_NS.token:" + AAF_DEFAULT_VERSION;
+       public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/AAF_NS.introspect:" + AAF_DEFAULT_VERSION;
+
+       public static final String AAF_REGISTER_AS = "aaf_register_as";
        public static final String AAF_APPID = "aaf_id";
        public static final String AAF_APPPASS = "aaf_password";
        public static final String AAF_LUR_CLASS = "aaf_lur_class";
@@ -175,7 +183,6 @@ public class Config {
        public static final String AAF_COMPONENT = "aaf_component";
        public static final String AAF_CERT_IDS = "aaf_cert_ids";
        public static final String AAF_DEBUG_IDS = "aaf_debug_ids"; // comma delimited
-       public static final String AAF_DEFAULT_VERSION = "2.0";
        public static final String AAF_DATA_DIR = "aaf_data_dir"; // AAF processes and Components only.
 
 
@@ -259,7 +266,7 @@ public class Config {
                
                access.log(Level.INIT, "Hostname set to",hostname);
                // Get appropriate TAFs
-               ArrayList<HttpTaf> htlist = new ArrayList<HttpTaf>();
+               ArrayList<HttpTaf> htlist = new ArrayList<>();
 
                /////////////////////////////////////////////////////
                // Add a Denial of Service TAF
@@ -474,6 +481,14 @@ public class Config {
                        }
                }
                
+               // Add BasicAuth, if any, to x509Taf
+               if(x509TAF!=null) {
+                       for( HttpTaf ht : htlist) {
+                               if(ht instanceof BasicHttpTaf) {
+                                       x509TAF.add((BasicHttpTaf)ht);
+                               }
+                       }
+               }
                /////////////////////////////////////////////////////
                // Create EpiTaf from configured TAFs
                /////////////////////////////////////////////////////
@@ -507,7 +522,7 @@ public class Config {
        
        public static Lur configLur(SecurityInfoC<HttpURLConnection> si, Connector con, Object ... additionalTafLurs) throws CadiException {
                Access access = si.access;
-               List<Lur> lurs = new ArrayList<Lur>();
+               List<Lur> lurs = new ArrayList<>();
                
                /////////////////////////////////////////////////////
                // Configure a Local Property Based RBAC/LUR
@@ -671,7 +686,7 @@ public class Config {
                                        aafConClass = loadClass(access, AAF_V2_0_AAF_CON_HTTP);
                                        if (aafConClass != null) {
                                                for (Constructor<?> c : aafConClass.getConstructors()) {
-                                                       List<Object> lo = new ArrayList<Object>();
+                                                       List<Object> lo = new ArrayList<>();
                                                        for (Class<?> pc : c.getParameterTypes()) {
                                                                if (pc.equals(Access.class)) {
                                                                        lo.add(access);