use of org.springframework.security.userdetails.memory.UserMap in project gocd by gocd.
the class FileAuthenticationProvider method retrieveUser.
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
final String passwordFilePath = goConfigService.security().passwordFileConfig().path();
try {
UserMap userMap = UserMapEditor.addUsersFromProperties(new UserMap(), addDummyRoleToPropertiesIfRequired(stripShaFromPasswordsIfRequired(loadPasswordFile(passwordFilePath))));
final UserDetails details = userMap.getUser(username);
return userStrippedOfAnyAuthoritiesSpecifiedInFile(username, details);
} catch (IOException e) {
throw new UsernameNotFoundException("Trying to authenticate user " + username + " but could not open file: " + passwordFilePath);
}
}
Aggregations