Commit 47f70c1b authored by Sreenidhi Iyangar's avatar Sreenidhi Iyangar
Browse files

Changing corresponding variable

parent 7590f1a0
......@@ -38,12 +38,12 @@ public class CustomAuthoritiesExtractor implements AuthoritiesExtractor {
@Override
public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) {
String email = (String) map.get("email");
RegistryUser user = registryUserRepository.findByEmail(email);
if (user == null) {
user = new RegistryUser(email, RegistryUser.Role.ROLE_USER);
registryUserRepository.save(user);
RegistryUser registryUser = registryUserRepository.findByEmail(email);
if (registryUser == null) {
registryUser = new RegistryUser(email, RegistryUser.Role.ROLE_USER);
registryUserRepository.save(registryUser);
return Arrays.asList(new SimpleGrantedAuthority(RegistryUser.Role.ROLE_USER.name()));
}
return Arrays.asList(new SimpleGrantedAuthority(user.getRole().toString()));
return Arrays.asList(new SimpleGrantedAuthority(registryUser.getRole().toString()));
}
}
......@@ -25,7 +25,7 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
/*
User is a reserved word in PostgreSQL. Hence defining a new name RegistryUser
User is a reserved word in PostgreSQL. Hence using class name RegistryUser
*/
@Entity
public class RegistryUser {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment