public boolean getHttpsEnabled() { if (httpsEnabled!=null) return httpsEnabled; httpsEnabled = managementContext.getConfig().getConfig(BrooklynWebConfig.HTTPS_REQUIRED); return httpsEnabled; }
public LdapSecurityProvider(ManagementContext mgmt) { StringConfigMap properties = mgmt.getConfig(); ldapUrl = properties.getConfig(BrooklynWebConfig.LDAP_URL); Strings.checkNonEmpty(ldapUrl, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_URL); ldapRealm = properties.getConfig(BrooklynWebConfig.LDAP_REALM); Strings.checkNonEmpty(ldapRealm, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_REALM); }
/** * accepts flags: port, * war (url of war file which is the root), * wars (map of context-prefix to url), * attrs (map of attribute-name : object pairs passed to the servlet) */ public BrooklynWebServer(Map flags, ManagementContext managementContext) { this.managementContext = managementContext; Map leftovers = FlagUtils.setFieldsFromFlags(flags, this); if (!leftovers.isEmpty()) log.warn("Ignoring unknown flags " + leftovers); String brooklynDataDir = checkNotNull(managementContext.getConfig().getConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR)); this.webappTempDir = new File(brooklynDataDir, "jetty"); }
public LdapSecurityProvider(ManagementContext mgmt) { StringConfigMap properties = mgmt.getConfig(); ldapUrl = properties.getConfig(BrooklynWebConfig.LDAP_URL); Strings.checkNonEmpty(ldapUrl, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_URL); ldapRealm = properties.getConfig(BrooklynWebConfig.LDAP_REALM); Strings.checkNonEmpty(ldapRealm, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_REALM); }
private synchronized void initialize() { if (allowedUsers!=null) return; StringConfigMap properties = mgmt.getConfig(); allowedUsers = new LinkedHashSet<String>(); String users = properties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS); if (users==null) { LOG.info("Web console allowing default user (admin)"); allowDefaultUsers = true; } else if ("*".equals(users)) { LOG.info("Web console allowing any users"); allowAnyUserWithValidPass = true; } else { LOG.info("Web console allowing users "+users); StringTokenizer t = new StringTokenizer(users, ","); while (t.hasMoreElements()) { allowedUsers.add((""+t.nextElement()).trim()); } } if (properties.getFirst(BrooklynServiceAttributes.BROOKLYN_AUTOLOGIN_USERNAME)!=null) { LOG.warn("Use of legacy AUTOLOGIN; replace with setting BrooklynSystemProperties.SECURITY_PROVIDER to "+AnyoneSecurityProvider.class.getCanonicalName()); allowAnyUser = true; } }
@SuppressWarnings("deprecation") private synchronized void initialize() { if (allowedUsers!=null) return; StringConfigMap properties = mgmt.getConfig(); allowedUsers = new LinkedHashSet<String>(); String users = properties.getConfig(BrooklynWebConfig.USERS); if (users==null) { users = properties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS); if (users!=null) LOG.warn("Using deprecated config key "+BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS.getName()+"; " + "use "+BrooklynWebConfig.USERS.getName()+" instead"); } if (users==null) { LOG.warn("Web console has no users configured; no one will be able to log in!"); } else if ("*".equals(users)) { LOG.info("Web console allowing any user (so long as valid password is set)"); allowAnyUserWithValidPass = true; } else { StringTokenizer t = new StringTokenizer(users, ","); while (t.hasMoreElements()) { allowedUsers.add((""+t.nextElement()).trim()); } LOG.info("Web console allowing users: "+allowedUsers); } }
String className = brooklynProperties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_CLASSNAME); log.info("Web console using security provider "+className);
String className = brooklynProperties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_CLASSNAME); log.info("Web console using security provider "+className);
public DownloadTargets apply(DownloadRequirement req) { Boolean enabled = config.getConfig(LOCAL_REPO_ENABLED); String path = config.getConfig(LOCAL_REPO_PATH); String url = String.format(LOCAL_REPO_URL_PATTERN, path); if (enabled) { Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req); String result = DownloadSubstituters.substitute(url, subs); return BasicDownloadTargets.builder().addPrimary(result).build(); } else { return BasicDownloadTargets.empty(); } } }
public DownloadTargets apply(DownloadRequirement req) { Boolean enabled = config.getConfig(CLOUDSOFT_REPO_ENABLED); String baseUrl = config.getConfig(CLOUDSOFT_REPO_URL); String url = String.format(CLOUDSOFT_REPO_URL_PATTERN, baseUrl); if (enabled) { Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req); String result = DownloadSubstituters.substitute(url, subs); return BasicDownloadTargets.builder().addPrimary(result).build(); } else { return BasicDownloadTargets.empty(); } } }
String catalogUrl = getConfig().getConfig(BROOKLYN_CATALOG_URL);
/** extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) * as declared on the entity, and inserts them in a map using the unprefixed state, for ssh. */ /* currently this is computed for each call, which may be wasteful, but it is reliable in the face of config changes. * we could cache the Map. note that we do _not_ cache (or even own) the SshTool; * the SshTool is created or re-used by the SshMachineLocation making use of these properties */ protected Map<String, Object> getSshFlags() { Map<String, Object> result = Maps.newLinkedHashMap(); StringConfigMap globalConfig = ((EntityInternal)getEntity()).getManagementContext().getConfig(); Map<ConfigKey<?>, Object> mgmtConfig = globalConfig.getAllConfig(); Map<ConfigKey<?>, Object> entityConfig = ((EntityInternal)getEntity()).getAllConfig(); Map<ConfigKey<?>, Object> allConfig = MutableMap.<ConfigKey<?>, Object>builder().putAll(mgmtConfig).putAll(entityConfig).build(); for (ConfigKey<?> key : allConfig.keySet()) { if (key.getName().startsWith(SshTool.BROOKLYN_CONFIG_KEY_PREFIX)) { // have to use raw config to test whether the config is set Object val = ((EntityInternal)getEntity()).getConfigMap().getRawConfig(key); if (val!=null) { val = getEntity().getConfig(key); } else { val = globalConfig.getRawConfig(key); if (val!=null) val = globalConfig.getConfig(key); } if (val!=null) { result.put(ConfigUtils.unprefixedKey(SshTool.BROOKLYN_CONFIG_KEY_PREFIX, key).getName(), val); } } } return result; }