@Test public void testLookUpUserProperties() throws Exception { Authenticator authenticator = new Authenticator(connection); String username = "TestAccount1"; Map<String, Object> properties = authenticator.lookUpUserProperties(username); Assert.assertEquals(properties.get("Foo"), "Bar"); }
public Map<String, Object> lookUpUserProperties(String username) throws LoginException { Map<String, Object> properties = new HashMap<>(); try (ResultSet results = makePropertiesQuery(username)) { while (results.next()) { String propertyName = results.getString(PROPERTY_NAME); Object propertyValue = results.getObject(PROPERTY_VALUE); properties.put(propertyName, propertyValue); } } catch (SQLException e) { throw new LoginException("Unable to retrieve" + username + " properties because of SQL Exception.", e); } return properties; }
Authenticator { public Map<String, Object> lookUpUserProperties(String username) throws LoginException { Map<String, Object> properties = new HashMap<>(); try (ResultSet results = makePropertiesQuery(username)) { while (results.next()) { String propertyName = results.getString(PROPERTY_NAME); Object propertyValue = results.getObject(PROPERTY_VALUE); properties.put(propertyName, propertyValue); } } catch (SQLException e) { throw new LoginException("Unable to retrieve" + username + " properties because of SQL Exception.", e); } return properties; } }
Authenticator { public Map<String, Object> lookUpUserProperties(String username) throws LoginException { Map<String, Object> properties = new HashMap<>(); try (ResultSet results = makePropertiesQuery(username)) { while (results.next()) { String propertyName = results.getString(PROPERTY_NAME); Object propertyValue = results.getObject(PROPERTY_VALUE); properties.put(propertyName, propertyValue); } } catch (SQLException e) { throw new LoginException("Unable to retrieve" + username + " properties because of SQL Exception.", e); } return properties; } Authenticator(Connection dbConnection); }
Authenticator { public Map<String, Object> lookUpUserProperties(String username) throws LoginException { Map<String, Object> properties = new HashMap<>(); try (ResultSet results = makePropertiesQuery(username)) { while (results.next()) { String propertyName = results.getString(PROPERTY_NAME); Object propertyValue = results.getObject(PROPERTY_VALUE); properties.put(propertyName, propertyValue); } } catch (SQLException e) { throw new LoginException("Unable to retrieve" + username + " properties because of SQL Exception.", e); } return properties; } Authenticator(Connection dbConnection); static String getSaltedSHA256String(String input, String salt); User logInUser(String username, String password); User lookUpUser(String username); Map<String, Object> lookUpUserProperties(String username); User logOutUser(String username); Object lookUpUserProperty(String username, String propertyName); static boolean isWrapperType(Class<?> clazz); }
Authenticator { public Map<String, Object> lookUpUserProperties(String username) throws LoginException { Map<String, Object> properties = new HashMap<>(); try (ResultSet results = makePropertiesQuery(username)) { while (results.next()) { String propertyName = results.getString(PROPERTY_NAME); Object propertyValue = results.getObject(PROPERTY_VALUE); properties.put(propertyName, propertyValue); } } catch (SQLException e) { throw new LoginException("Unable to retrieve" + username + " properties because of SQL Exception.", e); } return properties; } Authenticator(Connection dbConnection); static String getSaltedSHA256String(String input, String salt); User logInUser(String username, String password); User lookUpUser(String username); Map<String, Object> lookUpUserProperties(String username); User logOutUser(String username); Object lookUpUserProperty(String username, String propertyName); static boolean isWrapperType(Class<?> clazz); static final int HEX_CONVERSION_CONSTANT; }