List of usage examples for org.apache.hadoop.security.authentication.server PseudoAuthenticationHandler TYPE
String TYPE
To view the source code for org.apache.hadoop.security.authentication.server PseudoAuthenticationHandler TYPE.
Click Source Link
From source file:org.apache.falcon.entity.HiveUtilTest.java
License:Apache License
@Test public void testGetHiveCredentialsWithoutKerberos() { StartupProperties.get().setProperty(SecurityUtil.AUTHENTICATION_TYPE, PseudoAuthenticationHandler.TYPE); Cluster cluster = new Cluster(); String metaStoreUrl = "thrift://localhost:19083"; // set registry interface Interfaces interfaces = new Interfaces(); Interface registry = new Interface(); registry.setEndpoint(metaStoreUrl);/*from w ww . ja va2s. co m*/ registry.setType(Interfacetype.REGISTRY); registry.setVersion("0.1"); interfaces.getInterfaces().add(registry); cluster.setInterfaces(interfaces); Properties expected = new Properties(); expected.put(HiveUtil.METASTORE_UGI, "true"); expected.put(HiveUtil.NODE, metaStoreUrl.replace("thrift", "hcat")); expected.put(HiveUtil.METASTORE_URI, metaStoreUrl); expected.put(HiveUtil.METASTOREURIS, metaStoreUrl); Properties actual = HiveUtil.getHiveCredentials(cluster); Assert.assertTrue(actual.equals(expected)); }
From source file:org.apache.falcon.security.AuthenticationInitializationServiceTest.java
License:Apache License
@Test public void testInitForSimpleAuthenticationMethod() { try {//from w w w . j a v a2s . com StartupProperties.get().setProperty(SecurityUtil.AUTHENTICATION_TYPE, PseudoAuthenticationHandler.TYPE); authenticationService.init(); UserGroupInformation loginUser = UserGroupInformation.getLoginUser(); Assert.assertFalse(loginUser.isFromKeytab()); Assert.assertEquals(loginUser.getAuthenticationMethod().name().toLowerCase(), PseudoAuthenticationHandler.TYPE); Assert.assertEquals(System.getProperty("user.name"), loginUser.getUserName()); } catch (Exception e) { Assert.fail("AuthenticationInitializationService init failed.", e); } }
From source file:org.apache.falcon.security.SecurityUtil.java
License:Apache License
public static String getAuthenticationType() { return StartupProperties.get().getProperty(AUTHENTICATION_TYPE, PseudoAuthenticationHandler.TYPE); }
From source file:org.apache.falcon.security.SecurityUtil.java
License:Apache License
/** * Checks if kerberos authentication is enabled in the configuration. * * @return true if falcon.authentication.type is kerberos, false otherwise *//*from w ww.ja v a 2s.c om*/ public static boolean isSecurityEnabled() { String authenticationType = StartupProperties.get().getProperty(AUTHENTICATION_TYPE, PseudoAuthenticationHandler.TYPE); final boolean useKerberos; if (authenticationType == null || PseudoAuthenticationHandler.TYPE.equals(authenticationType)) { useKerberos = false; } else if (KerberosAuthenticationHandler.TYPE.equals(authenticationType)) { useKerberos = true; } else { throw new IllegalArgumentException( "Invalid attribute value for " + AUTHENTICATION_TYPE + " of " + authenticationType); } return useKerberos; }
From source file:org.apache.ranger.security.web.filter.RangerKrbFilter.java
License:Apache License
/** * <p>Initializes the authentication filter and signer secret provider.</p> * It instantiates and initializes the specified {@link * AuthenticationHandler}./*from w w w . j a v a 2 s.co m*/ * * @param filterConfig filter configuration. * * @throws ServletException thrown if the filter or the authentication handler could not be initialized properly. */ @Override public void init(FilterConfig filterConfig) throws ServletException { String configPrefix = filterConfig.getInitParameter(CONFIG_PREFIX); configPrefix = (configPrefix != null) ? configPrefix + "." : ""; config = getConfiguration(configPrefix, filterConfig); String authHandlerName = config.getProperty(AUTH_TYPE, null); String authHandlerClassName; if (authHandlerName == null) { throw new ServletException("Authentication type must be specified: " + PseudoAuthenticationHandler.TYPE + "|" + KerberosAuthenticationHandler.TYPE + "|<class>"); } if (StringUtils.equalsIgnoreCase(authHandlerName, PseudoAuthenticationHandler.TYPE)) { authHandlerClassName = PseudoAuthenticationHandler.class.getName(); } else if (StringUtils.equalsIgnoreCase(authHandlerName, KerberosAuthenticationHandler.TYPE)) { authHandlerClassName = KerberosAuthenticationHandler.class.getName(); } else { authHandlerClassName = authHandlerName; } validity = Long.parseLong(config.getProperty(AUTH_TOKEN_VALIDITY, "36000")) * 1000; //10 hours initializeSecretProvider(filterConfig); initializeAuthHandler(authHandlerClassName, filterConfig); cookieDomain = config.getProperty(COOKIE_DOMAIN, null); cookiePath = config.getProperty(COOKIE_PATH, null); }