From de1238abf9c120a1ed2dd07e3bd46d6878c4d6b3 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Sun, 14 Oct 2018 17:06:56 -0500 Subject: ID Translate onto AAFTaf Clients user "AAFTaf", need the Translation there, more than AAF Service Issue-ID: AAF-556 Change-Id: I8467e2a5e25f264ddb056db2fb10ecee098a0f94 Signed-off-by: Instrumental --- .../org/onap/aaf/cadi/filter/MapBathConverter.java | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'cadi/core/src') 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 7a138e97..93074932 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 @@ -139,6 +139,7 @@ public class MapBathConverter { public String convert(Access access, final String bath) { String rv = map.get(bath); String cred=null; + String tcred=null; Holder hpass=null; try { if(rv==null || !rv.startsWith(BASIC)) { @@ -154,9 +155,8 @@ public class MapBathConverter { // for SAFETY REASONS, we WILL NOT allow a non validated cred to // pass a password from file. Should be caught from Instation, but... if(rv!=null) { - if(rv.startsWith(BASIC)) { - return bath; - } else { + if(!rv.startsWith(BASIC)) { + tcred = rv; rv = BASIC + Symm.base64noSplit.encode(rv+':'+hpass.value); } } @@ -164,7 +164,22 @@ public class MapBathConverter { } catch (IOException | CadiException e) { access.log(e,"Invalid Authorization"); } - - return rv; + + if(rv==null) { + rv=bath; + } else { + try { + if(cred==null) { + cred = idFromBasic(bath,null); + } + if(tcred==null) { + tcred = idFromBasic(rv,null); + } + } catch (IOException | CadiException e) { + access.log(Level.ERROR,"Invalid Basic Authentication for conversion"); + } + access.printf(Level.AUDIT, "ID %s converted to %s",cred,tcred); + } + return rv==null?bath:rv; } } -- cgit 1.2.3-korg