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 05:56:14 UTC
[2/2] 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>
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/5eb030ad
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/5eb030ad
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/5eb030ad
Branch: refs/heads/ranger-0.7
Commit: 5eb030ada419c4b1aaff4474ac98b6680667efb0
Parents: 06005ca
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 00:48:45 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/5eb030ad/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);