diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-10-14 17:06:56 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-10-14 17:08:06 -0500 |
commit | de1238abf9c120a1ed2dd07e3bd46d6878c4d6b3 (patch) | |
tree | e412f0ba44cfe92af5c23b6fee5bdd19cc5cf284 /cadi/core | |
parent | 7e5ccdd25e377cfa2dd5850ac3c2c1428c40b078 (diff) |
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 <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/core')
-rw-r--r-- | cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java | 25 |
1 files changed, 20 insertions, 5 deletions
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<String> 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; } } |