/** * Login. * * @param username connection username * @param authResponse connection auth response * @return login success or failure */ public boolean login(final String username, final byte[] authResponse) { Authentication authentication = GLOBAL_REGISTRY.getAuthentication(); if (Strings.isNullOrEmpty(authentication.getPassword())) { return authentication.getUsername().equals(username); } return authentication.getUsername().equals(username) && Arrays.equals(getAuthCipherBytes(authentication.getPassword()), authResponse); }
/** * Login. * * @param username connection username * @param authResponse connection auth response * @return login success or failure */ public boolean login(final String username, final byte[] authResponse) { Authentication authentication = GLOBAL_REGISTRY.getAuthentication(); if (Strings.isNullOrEmpty(authentication.getPassword())) { return authentication.getUsername().equals(username); } return authentication.getUsername().equals(username) && Arrays.equals(getAuthCipherBytes(authentication.getPassword()), authResponse); }
@Override public String dump(final Authentication authentication) { YamlAuthentication yamlAuthentication = new YamlAuthentication(); yamlAuthentication.setUsername(authentication.getUsername()); yamlAuthentication.setPassword(authentication.getPassword()); return new Yaml(new DefaultYamlRepresenter()).dumpAsMap(yamlAuthentication); } }