Merge "AAFcli.java -Declare "value" on a separate line"
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / oauth / OAuth2HttpTaf.java
index b4b4b1e..e22eed0 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.
@@ -48,18 +48,18 @@ public class OAuth2HttpTaf implements HttpTaf {
         this.tmgr = tmgr;
         this.access = access;
     }
-    
+
     @Override
     public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
         String authz = req.getHeader("Authorization");
-        if(authz != null && authz.length()>7 && authz.startsWith("Bearer ")) {
-            if(!req.isSecure()) {
+        if (authz != null && authz.length()>7 && authz.startsWith("Bearer ")) {
+            if (!req.isSecure()) {
                 access.log(Level.WARN,"WARNING! OAuth has been used over an insecure channel");
             }
             try {
                 String tkn = authz.substring(7);
                 Result<OAuth2Principal> rp = tmgr.toPrincipal(tkn,Hash.hashSHA256(tkn.getBytes()));
-                if(rp.isOK()) {
+                if (rp.isOK()) {
                     return new OAuth2HttpTafResp(access,rp.value,rp.value.getName()+" authenticated by Bearer Token",RESP.IS_AUTHENTICATED,resp,false);
                 } else {
                     return new OAuth2HttpTafResp(access,null,rp.error,RESP.FAIL,resp,true);