Skip to content

Instantly share code, notes, and snippets.

@lusabo
Last active May 1, 2018 20:32
Show Gist options
  • Save lusabo/a50c280035ef9801b640f58282807ee5 to your computer and use it in GitHub Desktop.
Save lusabo/a50c280035ef9801b640f58282807ee5 to your computer and use it in GitHub Desktop.
JwtUser
package com.eco.security;
// Imports
public class JwtUser implements UserDetails {
private Long id;
private String username;
private String password;
private Collection<? extends GrantedAuthority> authorities;
public JwtUser(Long id, String username, String password, Collection<? extends GrantedAuthority> authorities) {
this.id = id;
this.username = username;
this.password = password;
this.authorities = authorities;
}
public Long getId() {
return id;
}
@Override
public String getUsername() {
return username;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public String getPassword() {
return password;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
@Override
public boolean isEnabled() {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment