X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Faaf%2Fv2_0%2FAAFTaf.java;h=c77444077b3c053cb76b6645b5b138ab5795c039;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=a25d25024fc77dcf62dcee5d8a99c53cfb230196;hpb=078325f8ef05a6216292f5331ef0805a5bdd9ef1;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java index a25d2502..c7744407 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.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. @@ -58,7 +58,7 @@ public class AAFTaf extends AbsUserCache implements HttpT private AAFCon aaf; private boolean warn; private MapBathConverter mapIds; - + public AAFTaf(AAFCon con, boolean turnOnWarning) { super(con.access,con.cleanInterval,con.highCount, con.usageRefreshTriggerCount); aaf = con; @@ -73,7 +73,7 @@ public class AAFTaf extends AbsUserCache implements HttpT initMapBathConverter(); } - + // Note: Needed for Creation of this Object with Generics @SuppressWarnings("unchecked") public AAFTaf(Connector mustBeAAFCon, boolean turnOnWarning, AbsUserCache other) { @@ -89,14 +89,14 @@ public class AAFTaf extends AbsUserCache implements HttpT private void initMapBathConverter() { String csvFile = access.getProperty(Config.CADI_BATH_CONVERT, null); if(csvFile==null) { - mapIds=null; + mapIds=null; } else { - try { - mapIds = new MapBathConverter(access, new CSV(access,csvFile)); - access.log(Level.INIT,"Basic Auth Conversion using",csvFile,"enabled" ); - } catch (IOException | CadiException e) { - access.log(e,"Bath Map Conversion is not initialized (non fatal)"); - } + try { + mapIds = new MapBathConverter(access, new CSV(access,csvFile)); + access.log(Level.INIT,"Basic Auth Conversion using",csvFile,"enabled" ); + } catch (IOException | CadiException e) { + access.log(e,"Bath Map Conversion is not initialized (non fatal)"); + } } } @@ -112,7 +112,7 @@ public class AAFTaf extends AbsUserCache implements HttpT aaf.access.log(Level.WARN,"WARNING! BasicAuth has been used over an insecure channel"); } if(mapIds != null) { - authz = mapIds.convert(access, authz); + authz = mapIds.convert(access, authz); } try { @@ -133,10 +133,10 @@ public class AAFTaf extends AbsUserCache implements HttpT Miss miss = missed(bp.getName(), bp.getCred()); if (miss!=null && !miss.mayContinue()) { return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req, - "User/Pass Retry limit exceeded"), + "User/Pass Retry limit exceeded"), RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true); } - + return aaf.bestForUser( new GetSetter() { @Override @@ -159,11 +159,11 @@ public class AAFTaf extends AbsUserCache implements HttpT boolean rv= addMiss(bp.getName(),bp.getCred()); if (rv) { return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req, - "user/pass combo invalid via AAF from " + req.getRemoteAddr()), + "user/pass combo invalid via AAF from " + req.getRemoteAddr()), RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true); } else { return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req, - "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"), + "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"), RESP.FAIL,resp,aaf.getRealm(),true); } } @@ -187,7 +187,7 @@ public class AAFTaf extends AbsUserCache implements HttpT } return new BasicHttpTafResp(aaf.access,target,"Requesting HTTP Basic Authorization",RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),false); } - + private String buildMsg(Principal pr, HttpServletRequest req, Object... msg) { StringBuilder sb = new StringBuilder(); for (Object s : msg) { @@ -205,7 +205,7 @@ public class AAFTaf extends AbsUserCache implements HttpT } - + public Resp revalidate(CachedPrincipal prin, Object state) { // !!!! TEST THIS.. Things may not be revalidated, if not BasicPrincipal if (prin instanceof BasicPrincipal) {