Repository: incubator-ranger Updated Branches: refs/heads/master e7ef59995 -> d1bb82dcf
RANGER-1047 : Not able to login Ranger using KnoxSSO User Signed-off-by: Velmurugan Periasamy <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/d1bb82dc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/d1bb82dc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/d1bb82dc Branch: refs/heads/master Commit: d1bb82dcf19f956aba03223e898895857a418c63 Parents: e7ef599 Author: Ankita Sinha <[email protected]> Authored: Fri Jun 24 19:49:45 2016 +0530 Committer: Velmurugan Periasamy <[email protected]> Committed: Sat Jun 25 08:57:25 2016 -0400 ---------------------------------------------------------------------- .../filter/RangerSSOAuthenticationFilter.java | 23 ++++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d1bb82dc/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerSSOAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerSSOAuthenticationFilter.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerSSOAuthenticationFilter.java index 4ebf972..b6d3286 100644 --- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerSSOAuthenticationFilter.java +++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerSSOAuthenticationFilter.java @@ -374,6 +374,8 @@ public class RangerSSOAuthenticationFilter implements Filter { } } catch (JOSEException je) { LOG.warn("Error while validating signature", je); + }catch(Exception e){ + LOG.warn("Error while validating signature", e); } } } @@ -413,25 +415,22 @@ public class RangerSSOAuthenticationFilter implements Filter { public SSOAuthenticationProperties getJwtProperties() { String providerUrl = PropertiesUtil.getProperty(JWT_AUTH_PROVIDER_URL); if (providerUrl != null && PropertiesUtil.getBooleanProperty("ranger.sso.enabled", false)) { + SSOAuthenticationProperties jwtProperties = new SSOAuthenticationProperties(); String publicKeyPath = PropertiesUtil.getProperty(JWT_PUBLIC_KEY); if (publicKeyPath == null) { LOG.error("Public key pem not specified for SSO auth provider {}. SSO auth will be disabled.",providerUrl); return null; } + jwtProperties.setAuthenticationProviderUrl(providerUrl); + jwtProperties.setCookieName(PropertiesUtil.getProperty(JWT_COOKIE_NAME, JWT_COOKIE_NAME_DEFAULT)); + jwtProperties.setOriginalUrlQueryParam(PropertiesUtil.getProperty(JWT_ORIGINAL_URL_QUERY_PARAM, JWT_ORIGINAL_URL_QUERY_PARAM_DEFAULT)); + String userAgent = PropertiesUtil.getProperty(BROWSER_USERAGENT); + if(userAgent != null && !userAgent.isEmpty()){ + jwtProperties.setUserAgentList(userAgent.split(",")); + } try { RSAPublicKey publicKey = parseRSAPublicKey(publicKeyPath); - SSOAuthenticationProperties jwtProperties = new SSOAuthenticationProperties(); - jwtProperties.setAuthenticationProviderUrl(providerUrl); jwtProperties.setPublicKey(publicKey); - - jwtProperties.setCookieName(PropertiesUtil.getProperty(JWT_COOKIE_NAME, JWT_COOKIE_NAME_DEFAULT)); - jwtProperties.setOriginalUrlQueryParam(PropertiesUtil.getProperty(JWT_ORIGINAL_URL_QUERY_PARAM, JWT_ORIGINAL_URL_QUERY_PARAM_DEFAULT)); - String userAgent = PropertiesUtil.getProperty(BROWSER_USERAGENT); - if(userAgent != null && !userAgent.isEmpty()){ - jwtProperties.setUserAgentList(userAgent.split(",")); - } - return jwtProperties; - } catch (IOException e) { LOG.error("Unable to read public certificate file. JWT auth will be disabled.",e); return null; @@ -441,10 +440,10 @@ public class RangerSSOAuthenticationFilter implements Filter { } catch (ServletException e) { LOG.error("ServletException while processing the properties",e); } + return jwtProperties; } else { return null; } - return jwtProperties; } /*
