net.nemerosa.ontrack.model.security.AccountUserDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.security;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
@Data
public class AccountUserDetails implements UserDetails, AccountHolder {
private final Account account;
@Override
public Collection extends GrantedAuthority> getAuthorities() {
return AuthorityUtils.createAuthorityList(account.getRole().getRoleName());
}
@Override
public String getPassword() {
return null;
}
@Override
public String getUsername() {
return account.getName();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy