X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Folur%2FOLur.java;h=5b78585dfaf031edb8ef77583d9d1ae0d6e0f893;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=c67f986e407803e69e222d33532788bc4aa700da;hpb=4b5a7d721d994a49057e9bfb403c7bff1b376660;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java index c67f986e..5b78585d 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java @@ -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. @@ -56,13 +56,13 @@ public class OLur extends AbsOTafLur implements Lur { @Override public boolean fish(Principal bait, Permission ... pond) { TokenPerm tp; - if(bait instanceof OAuth2Principal) { + if (bait instanceof OAuth2Principal) { OAuth2Principal oa2p = (OAuth2Principal)bait; tp = oa2p.tokenPerm(); } else { tp=null; } - if(tp==null) { + if (tp==null) { // if no Token Perm preset, get try { Pooled tcp = tokenClientPool.get(); @@ -73,18 +73,18 @@ public class OLur extends AbsOTafLur implements Lur { scopeSet.add(tc.defaultScope()); AAFPermission ap; for (Permission p : pond) { - if(p instanceof AAFPermission) { + if (p instanceof AAFPermission) { ap = (AAFPermission)p; scopeSet.add(ap.getNS()); } } String[] scopes = new String[scopeSet.size()]; scopeSet.toArray(scopes); - + Result rtt = tc.getToken(Kind.getKind(bait),scopes); - if(rtt.isOK()) { + if (rtt.isOK()) { Result rtp = tkMgr.get(rtt.value.getAccessToken(), bait.getName().getBytes()); - if(rtp.isOK()) { + if (rtp.isOK()) { tp = rtp.value; } } @@ -95,18 +95,18 @@ public class OLur extends AbsOTafLur implements Lur { access.log(e, "Unable to Get a Token"); } } - + boolean rv = false; - if(tp!=null) { - if(tkMgr.access.willLog(Level.DEBUG)) { + if (tp!=null) { + if (tkMgr.access.willLog(Level.DEBUG)) { StringBuilder sb = new StringBuilder("AAF Permissions for user "); sb.append(bait.getName()); - sb.append(", from token "); + sb.append(", from token "); sb.append(tp.get().getAccessToken()); for (AAFPermission p : tp.perms()) { sb.append("\n\t["); sb.append(p.getNS()); - sb.append(']'); + sb.append(']'); sb.append(p.getType()); sb.append('|'); sb.append(p.getInstance()); @@ -117,7 +117,7 @@ public class OLur extends AbsOTafLur implements Lur { access.log(Level.DEBUG, sb); } for (Permission p : pond) { - if(rv) { + if (rv) { break; } for (AAFPermission perm : tp.perms()) { @@ -135,11 +135,11 @@ public class OLur extends AbsOTafLur implements Lur { */ @Override public void fishAll(Principal bait, List permissions) { - if(bait instanceof OAuth2Principal) { + if (bait instanceof OAuth2Principal) { for (AAFPermission p : ((OAuth2Principal)bait).tokenPerm().perms()) { permissions.add(p); } - } + } } /* (non-Javadoc)