@Test public void testDefault() throws Exception { final SwiftAuthenticationService s = new SwiftAuthenticationService(); final SwiftProtocol protocol = new SwiftProtocol() { @Override public String getContext() { return "/v1.0"; } }; final Host host = new Host(protocol, "myidentityservice.example.net"); assertEquals(URI.create("https: assertEquals(Client.AuthVersion.v10, s.getRequest(host, new DisabledLoginCallback()).iterator().next().getVersion()); assertEquals(Authentication10UsernameKeyRequest.class, s.getRequest(host, new DisabledLoginCallback()).iterator().next().getClass()); }
public Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt) throws LoginCanceledException { final StringBuilder url = new StringBuilder(); url.append(bookmark.getProtocol().getScheme().toString()).append(": url.append(bookmark.getHostname()); if(!(bookmark.getProtocol().getScheme().getPort() == bookmark.getPort())) { url.append(":").append(bookmark.getPort()); } final String context = PathNormalizer.normalize(bookmark.getProtocol().getContext()); url.append(context); if(bookmark.getProtocol().getDefaultHostname().endsWith("identity.api.rackspacecloud.com") || bookmark.getHostname().endsWith("identity.api.rackspacecloud.com")) { return Collections.singleton(new Authentication20RAXUsernameKeyRequest( URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword(), null) ); } final LoginOptions options = new LoginOptions(bookmark.getProtocol()).password(false).anonymous(false).publickey(false); if(context.contains("1.0")) { return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("1.1")) { return Collections.singleton(new Authentication11UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("2.0")) { final String user; final String tenant; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); tenant = parts[0]; user = parts[1]; } else { user = bookmark.getCredentials().getUsername(); tenant = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Tenant Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Tenant Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s", tenant, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication20UsernamePasswordRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20UsernamePasswordTenantIdRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20AccessKeySecretKeyRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant)); return requests; } else if(context.contains("3")) { final String user; final String project; final String domain; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); if(parts.length == 3) { project = parts[0]; domain = parts[1]; user = parts[2]; } else { project = parts[0]; user = parts[1]; domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } } else { user = bookmark.getCredentials().getUsername(); final Credentials projectName = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Name", "Mosso"))); if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(projectName.getUsername(), ':'); project = parts[0]; domain = parts[1]; } else { project = projectName.getUsername(); domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); } bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication3UsernamePasswordProjectRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), project, domain) ); return requests; } else { log.warn(String.format("Unknown context version in %s. Default to v1 authentication.", context)); return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } }
SwiftAuthenticationService { public Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt) throws LoginCanceledException { final StringBuilder url = new StringBuilder(); url.append(bookmark.getProtocol().getScheme().toString()).append(": url.append(bookmark.getHostname()); if(!(bookmark.getProtocol().getScheme().getPort() == bookmark.getPort())) { url.append(":").append(bookmark.getPort()); } final String context = PathNormalizer.normalize(bookmark.getProtocol().getContext()); url.append(context); if(bookmark.getProtocol().getDefaultHostname().endsWith("identity.api.rackspacecloud.com") || bookmark.getHostname().endsWith("identity.api.rackspacecloud.com")) { return Collections.singleton(new Authentication20RAXUsernameKeyRequest( URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword(), null) ); } final LoginOptions options = new LoginOptions(bookmark.getProtocol()).password(false).anonymous(false).publickey(false); if(context.contains("1.0")) { return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("1.1")) { return Collections.singleton(new Authentication11UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("2.0")) { final String user; final String tenant; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); tenant = parts[0]; user = parts[1]; } else { user = bookmark.getCredentials().getUsername(); tenant = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Tenant Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Tenant Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s", tenant, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication20UsernamePasswordRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20UsernamePasswordTenantIdRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20AccessKeySecretKeyRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant)); return requests; } else if(context.contains("3")) { final String user; final String project; final String domain; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); if(parts.length == 3) { project = parts[0]; domain = parts[1]; user = parts[2]; } else { project = parts[0]; user = parts[1]; domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } } else { user = bookmark.getCredentials().getUsername(); final Credentials projectName = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Name", "Mosso"))); if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(projectName.getUsername(), ':'); project = parts[0]; domain = parts[1]; } else { project = projectName.getUsername(); domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); } bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication3UsernamePasswordProjectRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), project, domain) ); return requests; } else { log.warn(String.format("Unknown context version in %s. Default to v1 authentication.", context)); return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } } }
SwiftAuthenticationService { public Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt) throws LoginCanceledException { final StringBuilder url = new StringBuilder(); url.append(bookmark.getProtocol().getScheme().toString()).append(": url.append(bookmark.getHostname()); if(!(bookmark.getProtocol().getScheme().getPort() == bookmark.getPort())) { url.append(":").append(bookmark.getPort()); } final String context = PathNormalizer.normalize(bookmark.getProtocol().getContext()); url.append(context); if(bookmark.getProtocol().getDefaultHostname().endsWith("identity.api.rackspacecloud.com") || bookmark.getHostname().endsWith("identity.api.rackspacecloud.com")) { return Collections.singleton(new Authentication20RAXUsernameKeyRequest( URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword(), null) ); } final LoginOptions options = new LoginOptions(bookmark.getProtocol()).password(false).anonymous(false).publickey(false); if(context.contains("1.0")) { return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("1.1")) { return Collections.singleton(new Authentication11UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("2.0")) { final String user; final String tenant; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); tenant = parts[0]; user = parts[1]; } else { user = bookmark.getCredentials().getUsername(); tenant = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Tenant Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Tenant Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s", tenant, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication20UsernamePasswordRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20UsernamePasswordTenantIdRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20AccessKeySecretKeyRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant)); return requests; } else if(context.contains("3")) { final String user; final String project; final String domain; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); if(parts.length == 3) { project = parts[0]; domain = parts[1]; user = parts[2]; } else { project = parts[0]; user = parts[1]; domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } } else { user = bookmark.getCredentials().getUsername(); final Credentials projectName = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Name", "Mosso"))); if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(projectName.getUsername(), ':'); project = parts[0]; domain = parts[1]; } else { project = projectName.getUsername(); domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); } bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication3UsernamePasswordProjectRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), project, domain) ); return requests; } else { log.warn(String.format("Unknown context version in %s. Default to v1 authentication.", context)); return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } }  }
SwiftAuthenticationService { public Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt) throws LoginCanceledException { final StringBuilder url = new StringBuilder(); url.append(bookmark.getProtocol().getScheme().toString()).append(": url.append(bookmark.getHostname()); if(!(bookmark.getProtocol().getScheme().getPort() == bookmark.getPort())) { url.append(":").append(bookmark.getPort()); } final String context = PathNormalizer.normalize(bookmark.getProtocol().getContext()); url.append(context); if(bookmark.getProtocol().getDefaultHostname().endsWith("identity.api.rackspacecloud.com") || bookmark.getHostname().endsWith("identity.api.rackspacecloud.com")) { return Collections.singleton(new Authentication20RAXUsernameKeyRequest( URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword(), null) ); } final LoginOptions options = new LoginOptions(bookmark.getProtocol()).password(false).anonymous(false).publickey(false); if(context.contains("1.0")) { return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("1.1")) { return Collections.singleton(new Authentication11UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("2.0")) { final String user; final String tenant; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); tenant = parts[0]; user = parts[1]; } else { user = bookmark.getCredentials().getUsername(); tenant = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Tenant Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Tenant Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s", tenant, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication20UsernamePasswordRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20UsernamePasswordTenantIdRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20AccessKeySecretKeyRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant)); return requests; } else if(context.contains("3")) { final String user; final String project; final String domain; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); if(parts.length == 3) { project = parts[0]; domain = parts[1]; user = parts[2]; } else { project = parts[0]; user = parts[1]; domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } } else { user = bookmark.getCredentials().getUsername(); final Credentials projectName = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Name", "Mosso"))); if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(projectName.getUsername(), ':'); project = parts[0]; domain = parts[1]; } else { project = projectName.getUsername(); domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); } bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication3UsernamePasswordProjectRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), project, domain) ); return requests; } else { log.warn(String.format("Unknown context version in %s. Default to v1 authentication.", context)); return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } }  Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt); }
SwiftAuthenticationService { public Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt) throws LoginCanceledException { final StringBuilder url = new StringBuilder(); url.append(bookmark.getProtocol().getScheme().toString()).append(": url.append(bookmark.getHostname()); if(!(bookmark.getProtocol().getScheme().getPort() == bookmark.getPort())) { url.append(":").append(bookmark.getPort()); } final String context = PathNormalizer.normalize(bookmark.getProtocol().getContext()); url.append(context); if(bookmark.getProtocol().getDefaultHostname().endsWith("identity.api.rackspacecloud.com") || bookmark.getHostname().endsWith("identity.api.rackspacecloud.com")) { return Collections.singleton(new Authentication20RAXUsernameKeyRequest( URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword(), null) ); } final LoginOptions options = new LoginOptions(bookmark.getProtocol()).password(false).anonymous(false).publickey(false); if(context.contains("1.0")) { return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("1.1")) { return Collections.singleton(new Authentication11UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } else if(context.contains("2.0")) { final String user; final String tenant; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); tenant = parts[0]; user = parts[1]; } else { user = bookmark.getCredentials().getUsername(); tenant = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Tenant Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Tenant Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s", tenant, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication20UsernamePasswordRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20UsernamePasswordTenantIdRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant) ); requests.add(new Authentication20AccessKeySecretKeyRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), tenant)); return requests; } else if(context.contains("3")) { final String user; final String project; final String domain; if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(bookmark.getCredentials().getUsername(), ':'); if(parts.length == 3) { project = parts[0]; domain = parts[1]; user = parts[2]; } else { project = parts[0]; user = parts[1]; domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } } else { user = bookmark.getCredentials().getUsername(); final Credentials projectName = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Name", "Mosso"))); if(StringUtils.contains(bookmark.getCredentials().getUsername(), ':')) { final String[] parts = StringUtils.splitPreserveAllTokens(projectName.getUsername(), ':'); project = parts[0]; domain = parts[1]; } else { project = projectName.getUsername(); domain = prompt.prompt(bookmark, bookmark.getCredentials().getUsername(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), LocaleFactory.localizedString("Project Domain Name", "Mosso"), options .usernamePlaceholder(LocaleFactory.localizedString("Project Domain Name", "Mosso"))).getUsername(); } bookmark.getCredentials().setUsername(String.format("%s:%s:%s", project, domain, bookmark.getCredentials().getUsername())); } final Set<AuthenticationRequest> requests = new LinkedHashSet<AuthenticationRequest>(); requests.add(new Authentication3UsernamePasswordProjectRequest( URI.create(url.toString()), user, bookmark.getCredentials().getPassword(), project, domain) ); return requests; } else { log.warn(String.format("Unknown context version in %s. Default to v1 authentication.", context)); return Collections.singleton(new Authentication10UsernameKeyRequest(URI.create(url.toString()), bookmark.getCredentials().getUsername(), bookmark.getCredentials().getPassword())); } }  Set<? extends AuthenticationRequest> getRequest(final Host bookmark, final LoginCallback prompt);  }