summaryrefslogtreecommitdiffstats
path: root/cadi/oauth-enduser
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:23 -0500
committerInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:26 -0500
commit7e966914050e66219689001ff4ab601a49eef0ac (patch)
treeb1bf643f2d191207adc7d9f6b41ac20f56083e76 /cadi/oauth-enduser
parentead32f193586e39b59bb366bddf70e665173a52d (diff)
Mass whitespace changes (Style Warnings)
Issue-ID: AAF-473 Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/oauth-enduser')
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java34
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java12
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java10
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java10
4 files changed, 33 insertions, 33 deletions
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
index 7c633640..f98c76fb 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
@@ -61,11 +61,11 @@ public class SimpleRESTClient {
callTimeout = Integer.parseInt(tcf.access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
tokenClient = tcf.newClient(tokenURL);
Result<TimedToken> rtt = tokenClient.getToken(scope);
- if(rtt.isOK()) {
+ if (rtt.isOK()) {
restClient = tcf.newTzClient(endpoint);
- if((client_id = tcf.access.getProperty(Config.AAF_APPID, null))==null) {
- if((client_id = tcf.access.getProperty(Config.CADI_ALIAS, null))==null) {
+ if ((client_id = tcf.access.getProperty(Config.AAF_APPID, null))==null) {
+ if ((client_id = tcf.access.getProperty(Config.CADI_ALIAS, null))==null) {
throw new CadiException(Config.AAF_APPID + " or " + Config.CADI_ALIAS + " needs to be defined");
}
}
@@ -86,10 +86,10 @@ public class SimpleRESTClient {
//Format:<ID>:<APP>:<protocol>[:AS][,<ID>:<APP>:<protocol>]*
public SimpleRESTClient endUser(Principal principal) {
- if(principal==null) {
+ if (principal==null) {
chain = null;
} else {
- if(principal instanceof TaggedPrincipal) {
+ if (principal instanceof TaggedPrincipal) {
TaggedPrincipal tp = (TaggedPrincipal)principal;
chain = tp.getName() + ':' + (app==null?"":app) + ':' + tp.tag() + ":AS";
} else {
@@ -128,7 +128,7 @@ public class SimpleRESTClient {
}
public StringBuilder builder() {
- if(sb==null) {
+ if (sb==null) {
sb = new StringBuilder();
content = null;
}
@@ -140,16 +140,16 @@ public class SimpleRESTClient {
*/
public void clear() {
content = null;
- if(sb!=null) {
+ if (sb!=null) {
sb.setLength(0);
}
}
@Override
public String toString() {
- if(content!=null) {
+ if (content!=null) {
return content;
- } else if(sb!=null) {
+ } else if (sb!=null) {
return sb.toString();
} else {
return "";
@@ -158,8 +158,8 @@ public class SimpleRESTClient {
public byte[] getBytes() {
byte[] rv;
- if(content==null) {
- if(sb==null) {
+ if (content==null) {
+ if (sb==null) {
rv = EMPTY_STREAM_BYTES;
} else {
rv = sb.toString().getBytes();
@@ -192,7 +192,7 @@ public class SimpleRESTClient {
return client.create(path, contentType, new ETransfer(input));
}
});
- if(!future.get(callTimeout)) {
+ if (!future.get(callTimeout)) {
throw new RESTException(future);
}
}
@@ -217,7 +217,7 @@ public class SimpleRESTClient {
return client.read(path,accepts, headers());
}
});
- if(future.get(callTimeout)) {
+ if (future.get(callTimeout)) {
return future.value;
} else {
throw new RESTException(future);
@@ -245,7 +245,7 @@ public class SimpleRESTClient {
return client.update(path, contentType, new ETransfer(input));
}
});
- if(future.get(callTimeout)) {
+ if (future.get(callTimeout)) {
return future.value;
} else {
throw new RESTException(future);
@@ -268,7 +268,7 @@ public class SimpleRESTClient {
return client.delete(path, contentType);
}
});
- if(!future.get(callTimeout)) {
+ if (!future.get(callTimeout)) {
throw new RESTException(future);
}
}
@@ -292,14 +292,14 @@ public class SimpleRESTClient {
}
public String[] headers() {
- if(chain==null) {
+ if (chain==null) {
return headers.headers();
} else {
String[] strs = headers.headers();
String[] rv = new String[strs.length+2];
rv[0]=Config.CADI_USER_CHAIN;
rv[1]=chain;
- for(int i = 0;i<strs.length;++i) {
+ for (int i = 0;i<strs.length;++i) {
rv[i+2]=strs[i];
}
return rv;
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
index 154ba1b7..cd9c2313 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
@@ -94,7 +94,7 @@ public class OAuthExample {
// If AAF Token server, then its just the same as your other AAF MechID creds
// If it is the Alternate OAUTH, you'll need THOSE credentials. See that tool's Onboarding procedures.
String client_id = access.getProperty(Config.AAF_APPID);
- if(client_id==null) {
+ if (client_id==null) {
// For AAF, client_id CAN be Certificate. This is not necessarily true elsewhere
client_id = access.getProperty(Config.CADI_ALIAS);
}
@@ -126,7 +126,7 @@ public class OAuthExample {
// tc.clearToken("org.onap.aaf","org.onap.test");
// Result Object can be queried for success
- if(rtt.isOK()) {
+ if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
@@ -147,7 +147,7 @@ public class OAuthExample {
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
// If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
- if(future.get(CALL_TIMEOUT)) {
+ if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
@@ -165,7 +165,7 @@ public class OAuthExample {
// As a Service, read Introspection information as proof of Authenticated Authorization
//////////////////////////////////////////////////////////////////////
// CADI Framework (i.e. CadiFilter) works with the Introspection to drive the J2EE interfaces (
- // i.e. if(isUserInRole("ns.perm|instance|action")) {...
+ // i.e. if (isUserInRole("ns.perm|instance|action")) {...
//
// Here, however, is a way to introspect via Java
//
@@ -174,7 +174,7 @@ public class OAuthExample {
TokenClient tci = tcf.newClient(tokenIntrospectURL);
tci.client_creds(client_id, client_secret);
Result<Introspect> is = tci.introspect(token.getAccessToken());
- if(is.isOK()) {
+ if (is.isOK()) {
// Note that AAF will add JSON set of Permissions as part of "Content:", legitimate extension of OAuth Structure
print(is.value); // do something with Introspect Object
} else {
@@ -206,7 +206,7 @@ public class OAuthExample {
}
private static void print(Introspect ti) {
- if(ti==null || ti.getClientId()==null) {
+ if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
return;
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
index 657a9b78..f4fe017f 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
@@ -97,7 +97,7 @@ public class OnapClientExample {
// tc.clearToken("org.onap.aaf","org.onap.test");
// Result Object can be queried for success
- if(rtt.isOK()) {
+ if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
@@ -122,7 +122,7 @@ public class OnapClientExample {
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
// If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
- if(future.get(CALL_TIMEOUT)) {
+ if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
@@ -140,7 +140,7 @@ public class OnapClientExample {
// As a Service, read Introspection information as proof of Authenticated Authorization
//////////////////////////////////////////////////////////////////////
// CADI Framework (i.e. CadiFilter) works with the Introspection to drive the J2EE interfaces (
- // i.e. if(isUserInRole("ns.perm|instance|action")) {...
+ // i.e. if (isUserInRole("ns.perm|instance|action")) {...
//
// Here, however, is a way to introspect via Java
//
@@ -148,7 +148,7 @@ public class OnapClientExample {
// We need a Different Introspect TokenClient, because different Endpoint (and usually different Services)
TokenClient tci = tcf.newClient(Config.AAF_OAUTH2_INTROSPECT_URL);
Result<Introspect> is = tci.introspect(token.getAccessToken());
- if(is.isOK()) {
+ if (is.isOK()) {
// Note that AAF will add JSON set of Permissions as part of "Content:", legitimate extension of OAuth Structure
print(is.value); // do something with Introspect Object
} else {
@@ -180,7 +180,7 @@ public class OnapClientExample {
}
private static void print(Introspect ti) {
- if(ti==null || ti.getClientId()==null) {
+ if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
return;
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
index 27f9198a..dc1824fc 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
@@ -42,7 +42,7 @@ public class SimpleRestClientExample {
String urlString = cf.getAccess().getProperty("myurl", null);
- if(urlString==null) {
+ if (urlString==null) {
System.out.println("Note: In your startup, add \"myurl=https://<aaf hello machine>:8130\" to command line\n\t"
+ "OR\n\t"
+ " add -Dmyurl=https://<aaf hello machine>:8130 to VM Args\n\t"
@@ -64,8 +64,8 @@ public class SimpleRestClientExample {
PrintWriter pw = input.writer();
pw.print("{\"something\": [");
- for(int i=0;i<4;++i) {
- if(i>0) {
+ for (int i=0;i<4;++i) {
+ if (i>0) {
pw.print(',');
}
pw.print("{\"myint\":");
@@ -136,14 +136,14 @@ public class SimpleRestClientExample {
System.out.println("-------- START Expecting Exception starting here --------");
expectException = true;
restClient.get("notAnAPI");
- } catch(RESTException e) {
+ } catch (RESTException e) {
System.out.println(e.getCode());
System.out.println(e.getMsg());
System.out.println(e.getMessage());
System.out.println(e.getLocalizedMessage());
System.out.println(e);
} finally {
- if(expectException) {
+ if (expectException) {
System.out.println("-------- END Expecting Exception starting here --------");
}
System.out.println("-------- END REST READ/GET --------");