X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Fcore%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Ffilter%2FMapBathConverter.java;h=62b458abfc1c9307b7890b1a6369b46258a5f61b;hb=deb396a3d53a84b2eb5a46d40122b4902d72c601;hp=8c616f4a1357fb569cd1afee71f5be1801631742;hpb=3d1706fcbe7f95830ff6fd23cf679ee55c6d0595;p=aaf%2Fauthz.git diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java index 8c616f4a..62b458ab 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.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. @@ -29,31 +29,30 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.xml.ws.Holder; - import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.Symm; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.cadi.util.CSV.Visitor; +import org.onap.aaf.cadi.util.Holder; /** - * This Filter is designed to help MIGRATE users from systems that don't match the FQI style. - * + * This Filter is designed to help MIGRATE users from systems that don't match the FQI style. + * * Style 1, where just the ID is translated, i.e. OLD => new@something.onap.org, that is acceptable * longer term, because it does not store Creds locally. The passwords are in appropriate systems, but * it's still painful operationally, though it does ease migration. * * Style 3, however, which is Direct match of Authorization Header to replacement, is only there * because some passwords are simply not acceptable for AAF, (too easy, for instance), and it is - * not feasible to break Organization Password rules for a Migration. Therefore, this method + * not feasible to break Organization Password rules for a Migration. Therefore, this method * should not considered something that is in any way a permanent - * + * - * + * * It goes without saying that any file with the password conversion should be protected by "400", etc. - * + * * @author Instrumental (Jonathan) * */ @@ -63,15 +62,15 @@ public class MapBathConverter { /** * Create with colon separated name value pairs - * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is + * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is * base64 encoded, which can be created with "cadi" tool (in jar) - * - * The replacement should also be an exact replacement of what you want. Recognize that - * this should be TEMPORARY as you are storing credentials outside the users control. - * + * + * The replacement should also be an exact replacement of what you want. Recognize that + * this should be TEMPORARY as you are storing credentials outside the users control. + * * @param value - * @throws IOException - * @throws CadiException + * @throws IOException + * @throws CadiException */ public MapBathConverter(final Access access, final CSV csv) throws IOException, CadiException { map = new TreeMap<>(); @@ -110,7 +109,7 @@ public class MapBathConverter { } }); } - + private static String idFromBasic(String bath, Holder hpass) throws IOException, CadiException { if(bath.startsWith(BASIC)) { String cred = Symm.base64noSplit.decode(bath.substring(6)); @@ -119,7 +118,7 @@ public class MapBathConverter { throw new CadiException("Invalid Authentication Credential for " + cred); } if(hpass!=null) { - hpass.value = cred.substring(colon+1); + hpass.set(cred.substring(colon+1)); } return cred.substring(0, colon); } else { @@ -128,8 +127,8 @@ public class MapBathConverter { } /** - * use to instantiate entries - * + * use to instantiate entries + * * @return */ public Map map() { @@ -144,7 +143,7 @@ public class MapBathConverter { Holder hpass=null; try { if(bath.startsWith(BASIC)) { - cred = idFromBasic(bath,(hpass=new Holder())); + cred = idFromBasic(bath,(hpass=new Holder(null))); if(rv==null) { rv = map.get(cred); } @@ -161,7 +160,7 @@ public class MapBathConverter { } else { if(hpass!=null) { tcred = rv; - rv = BASIC + Symm.base64noSplit.encode(rv+':'+hpass.value); + rv = BASIC + Symm.base64noSplit.encode(rv+':'+hpass.get()); } } if(tcred != null) {