Merge "AAFcli.java -Declare "value" on a separate line"
[aaf/authz.git] / auth / auth-oauth / src / main / java / org / onap / aaf / auth / oauth / service / JSONPermLoaderFactory.java
index 886b06c..f163f21 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed 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.
@@ -47,13 +47,13 @@ public class JSONPermLoaderFactory {
     public static JSONPermLoader remote(final AAFCon<?> aafcon, final int timeout) {
         return new JSONPermLoader() {
             public Result<String> loadJSONPerms(AuthzTrans trans, String user, Set<String> scopes) throws APIException, CadiException {
-                Rcli<?> c = aafcon.clientAs(Config.AAF_DEFAULT_VERSION,trans.getUserPrincipal());
+                Rcli<?> c = aafcon.clientAs(Config.AAF_DEFAULT_API_VERSION,trans.getUserPrincipal());
                 StringBuilder pathinfo = new StringBuilder("/authz/perms/user/");
                 pathinfo.append(user);
                 pathinfo.append("?scopes=");
                 boolean first = true;
-                for(String s : scopes) {
-                    if(first) {
+                for (String s : scopes) {
+                    if (first) {
                         first = false;
                     } else {
                         pathinfo.append(':');
@@ -63,9 +63,9 @@ public class JSONPermLoaderFactory {
                 TimeTaken tt = trans.start("Call AAF Service", Env.REMOTE);
                 try {
                     Future<String> fs = c.read(pathinfo.toString(), "application/Perms+json;charset=utf-8;version=2.0");
-                    if(fs.get(timeout)) {
+                    if (fs.get(timeout)) {
                         return Result.ok(fs.body());
-                    } else if(fs.code()==404) {
+                    } else if (fs.code()==404) {
                         return Result.err(Result.ERR_NotFound,fs.body());
                     } else {
                         return Result.err(Result.ERR_Backend,"Error accessing AAF %s: %s",Integer.toString(fs.code()),fs.body());
@@ -86,15 +86,15 @@ public class JSONPermLoaderFactory {
                 } finally {
                     tt.done();
                 }
-                if(pd.notOK()) {
+                if (pd.notOK()) {
                     return Result.err(pd);
                 }
-                // Since we know it is 
+                // Since we know it is
                 StringBuilder sb = new StringBuilder("{\"perm\":[");
                 boolean first = true;
-                for(PermDAO.Data d : pd.value) {
-                    if(scopes.contains(d.ns)) {
-                        if(first) {
+                for (PermDAO.Data d : pd.value) {
+                    if (scopes.contains(d.ns)) {
+                        if (first) {
                             first = false;
                         } else {
                             sb.append(',');