@Test public void testWithDoubleDomainname() { LoginResponse response = createMock(LoginResponse.class); SessionApi client = createMock(SessionApi.class); expect(client.loginUserInDomainWithHashOfPassword(eq("User"), eq("Test/Domain"), (String) anyObject())).andReturn(response); replay(client); LoginWithPasswordCredentials obj = new LoginWithPasswordCredentials(client); Credentials cred = new Credentials("Test/Domain/User", "koffiedik"); obj.load(cred); }
@Override public LoginResponse load(Credentials input) { String username = input.identity; String domain = ""; if (username.indexOf('/') != -1) { domain = username.substring(0, username.lastIndexOf('/')); username = username.substring(username.lastIndexOf('/') + 1, username.length()); } String hashedPassword = base16().lowerCase().encode(md5().hashString(input.credential, UTF_8).asBytes()); return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); }
LoginWithPasswordCredentials extends CacheLoader<Credentials, LoginResponse> { @Override public LoginResponse load(Credentials input) { String username = input.identity; String domain = ""; if (username.indexOf('/') != -1) { domain = username.substring(0, username.lastIndexOf('/')); username = username.substring(username.lastIndexOf('/') + 1, username.length()); } String hashedPassword = base16().lowerCase().encode(md5().hashString(input.credential, UTF_8).asBytes()); return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); } }
LoginWithPasswordCredentials extends CacheLoader<Credentials, LoginResponse> { @Override public LoginResponse load(Credentials input) { String username = input.identity; String domain = ""; if (username.indexOf('/') != -1) { domain = username.substring(0, username.lastIndexOf('/')); username = username.substring(username.lastIndexOf('/') + 1, username.length()); } String hashedPassword = base16().lowerCase().encode(md5().hashString(input.credential, UTF_8).asBytes()); return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); } @Inject  LoginWithPasswordCredentials(SessionApi client); }
LoginWithPasswordCredentials extends CacheLoader<Credentials, LoginResponse> { @Override public LoginResponse load(Credentials input) { String username = input.identity; String domain = ""; if (username.indexOf('/') != -1) { domain = username.substring(0, username.lastIndexOf('/')); username = username.substring(username.lastIndexOf('/') + 1, username.length()); } String hashedPassword = base16().lowerCase().encode(md5().hashString(input.credential, UTF_8).asBytes()); return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); } @Inject  LoginWithPasswordCredentials(SessionApi client); @Override LoginResponse load(Credentials input); @Override String toString(); }
LoginWithPasswordCredentials extends CacheLoader<Credentials, LoginResponse> { @Override public LoginResponse load(Credentials input) { String username = input.identity; String domain = ""; if (username.indexOf('/') != -1) { domain = username.substring(0, username.lastIndexOf('/')); username = username.substring(username.lastIndexOf('/') + 1, username.length()); } String hashedPassword = base16().lowerCase().encode(md5().hashString(input.credential, UTF_8).asBytes()); return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); } @Inject  LoginWithPasswordCredentials(SessionApi client); @Override LoginResponse load(Credentials input); @Override String toString();  }