List of usage examples for org.apache.zookeeper Environment JAAS_CONF_KEY
String JAAS_CONF_KEY
To view the source code for org.apache.zookeeper Environment JAAS_CONF_KEY.
Click Source Link
From source file:com.blackberry.bdp.kaboom.StartupConfig.java
License:Apache License
/** * Returns an instantiated kaboomCurator framework object * * @return CuratorFramework/* w ww . jav a2 s.c om*/ */ private CuratorFramework buildCuratorFramework(String connectionString) { RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); LOG.info("attempting to connect to ZK with connection string {}", connectionString); String[] connStringAndPrefix = connectionString.split("/", 2); CuratorFramework newCurator; LOG.info("jaas key: {}", System.getProperty(Environment.JAAS_CONF_KEY)); if (connStringAndPrefix.length == 1) { newCurator = CuratorFrameworkFactory.newClient(connectionString, retryPolicy); } else { newCurator = CuratorFrameworkFactory.builder().namespace(connStringAndPrefix[1]) .connectString(connStringAndPrefix[0]).retryPolicy(retryPolicy).build(); } newCurator.start(); return newCurator; }
From source file:com.lami.tuomatuo.mq.zookeeper.common.ZKConfig.java
License:Apache License
/** * Return the value of "java.security.auth.login.config" system property * * @return value// w ww . jav a2 s . c om */ public String getJaasConfKey() { return System.getProperty(Environment.JAAS_CONF_KEY); }
From source file:org.apache.atlas.web.security.BaseSecurityTest.java
License:Apache License
protected void bindJVMtoJAASFile(File jaasFile) { String path = jaasFile.getAbsolutePath(); System.setProperty(Environment.JAAS_CONF_KEY, path); disableZookeeperSecurity(); }
From source file:org.apache.hadoop.metadata.web.BaseSecurityTest.java
License:Apache License
protected void bindJVMtoJAASFile(File jaasFile) { String path = jaasFile.getAbsolutePath(); System.setProperty(Environment.JAAS_CONF_KEY, path); }
From source file:org.apache.hadoop.registry.client.impl.zk.RegistrySecurity.java
License:Apache License
/** * Bind the JVM JAS setting to the specified JAAS file. * * <b>Important:</b> once a file has been loaded the JVM doesn't pick up * changes/* w w w . jav a2 s . co m*/ * @param jaasFile the JAAS file */ public static void bindJVMtoJAASFile(File jaasFile) { String path = jaasFile.getAbsolutePath(); if (LOG.isDebugEnabled()) { LOG.debug("Binding {} to {}", Environment.JAAS_CONF_KEY, path); } System.setProperty(Environment.JAAS_CONF_KEY, path); }
From source file:org.apache.hadoop.registry.client.impl.zk.RegistrySecurity.java
License:Apache License
/** * Reset any system properties related to JAAS *///w w w . j a v a 2 s . c o m public static void clearJaasSystemProperties() { System.clearProperty(Environment.JAAS_CONF_KEY); }
From source file:org.apache.hadoop.registry.client.impl.zk.RegistrySecurity.java
License:Apache License
/** * Resolve the context of an entry. This is an effective test of * JAAS setup, because it will relay detected problems up * @param context context name/*from w w w.j a v a2 s. co m*/ * @return the entry * @throws RuntimeException if there is no context entry found */ public static AppConfigurationEntry[] validateContext(String context) { if (context == null) { throw new RuntimeException("Null context argument"); } if (context.isEmpty()) { throw new RuntimeException("Empty context argument"); } javax.security.auth.login.Configuration configuration = javax.security.auth.login.Configuration .getConfiguration(); AppConfigurationEntry[] entries = configuration.getAppConfigurationEntry(context); if (entries == null) { throw new RuntimeException(String.format("Entry \"%s\" not found; " + "JAAS config = %s", context, describeProperty(Environment.JAAS_CONF_KEY))); } return entries; }
From source file:org.apache.hadoop.registry.client.impl.zk.RegistrySecurity.java
License:Apache License
/** * Build up low-level security diagnostics to aid debugging * @return a string to use in diagnostics *//*from w w w . j a v a 2 s. c o m*/ public String buildSecurityDiagnostics() { StringBuilder builder = new StringBuilder(); builder.append(secureRegistry ? "secure registry; " : "insecure registry; "); builder.append("Curator service access policy: ").append(access); builder.append("; System ACLs: ").append(aclsToString(systemACLs)); builder.append("User: ").append(UgiInfo.fromCurrentUser()); builder.append("; Kerberos Realm: ").append(kerberosRealm); builder.append(describeProperty(Environment.JAAS_CONF_KEY)); String sasl = System.getProperty(PROP_ZK_ENABLE_SASL_CLIENT, DEFAULT_ZK_ENABLE_SASL_CLIENT); boolean saslEnabled = Boolean.parseBoolean(sasl); builder.append(describeProperty(PROP_ZK_ENABLE_SASL_CLIENT, DEFAULT_ZK_ENABLE_SASL_CLIENT)); if (saslEnabled) { builder.append("; JAAS Client Identity").append("=").append(jaasClientIdentity).append("; "); builder.append(KEY_REGISTRY_CLIENT_JAAS_CONTEXT).append("=").append(jaasClientContext).append("; "); builder.append(describeProperty(PROP_ZK_SASL_CLIENT_USERNAME)); builder.append(describeProperty(PROP_ZK_SASL_CLIENT_CONTEXT)); } builder.append(describeProperty(PROP_ZK_ALLOW_FAILED_SASL_CLIENTS, "(undefined but defaults to true)")); builder.append(describeProperty(PROP_ZK_SERVER_MAINTAIN_CONNECTION_DESPITE_SASL_FAILURE)); return builder.toString(); }
From source file:org.apache.hadoop.registry.secure.TestSecureLogins.java
License:Apache License
@Test public void testJaasFileSetup() throws Throwable { // the JVM has seemed inconsistent on setting up here assertNotNull("jaasFile", jaasFile); String confFilename = System.getProperty(Environment.JAAS_CONF_KEY); assertEquals(jaasFile.getAbsolutePath(), confFilename); }
From source file:org.apache.hadoop.registry.secure.TestSecureLogins.java
License:Apache License
@Test public void testJaasFileBinding() throws Throwable { // the JVM has seemed inconsistent on setting up here assertNotNull("jaasFile", jaasFile); RegistrySecurity.bindJVMtoJAASFile(jaasFile); String confFilename = System.getProperty(Environment.JAAS_CONF_KEY); assertEquals(jaasFile.getAbsolutePath(), confFilename); }