You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2017/02/20 06:06:33 UTC
[3/3] ranger git commit: RANGER-1347 - The AtlasClient should fall
back to the plain password if the password decryption fails
RANGER-1347 - The AtlasClient should fall back to the plain password if the password decryption fails
Signed-off-by: Selvamohan Neethiraj <sn...@apache.org>
(cherry picked from commit 5eb030ada419c4b1aaff4474ac98b6680667efb0)
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/c07e8600
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/c07e8600
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/c07e8600
Branch: refs/heads/master
Commit: c07e8600ae353a156e83d89ebdd1590353bdc47f
Parents: b9b4b80
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Feb 3 15:50:13 2017 +0000
Committer: Selvamohan Neethiraj <sn...@apache.org>
Committed: Mon Feb 20 01:00:56 2017 -0500
----------------------------------------------------------------------
.../ranger/services/atlas/client/AtlasClient.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/c07e8600/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/client/AtlasClient.java
----------------------------------------------------------------------
diff --git a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/client/AtlasClient.java b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/client/AtlasClient.java
index 4f90469..b959f97 100644
--- a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/client/AtlasClient.java
+++ b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/client/AtlasClient.java
@@ -112,7 +112,20 @@ public class AtlasClient extends BaseClient {
WebResource webResource = client.resource(statusUrl);
MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
formData.add("j_username", userName);
- formData.add("j_password",PasswordUtils.decryptPassword(password));
+
+ String decryptedPwd = null;
+ try {
+ decryptedPwd = PasswordUtils.decryptPassword(password);
+ } catch (Exception ex) {
+ LOG.info("Password decryption failed; trying Atlas connection with received password string");
+ decryptedPwd = null;
+ } finally {
+ if (decryptedPwd == null) {
+ decryptedPwd = password;
+ }
+ }
+ formData.add("j_password", decryptedPwd);
+
try {
statusResponse = webResource.type("application/x-www-form-urlencoded").post(
ClientResponse.class, formData);