Guest User

Untitled

a guest
Jun 26th, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. package com.wazootix.security;
  2.  
  3. import java.util.Collection;
  4.  
  5. import org.springframework.security.core.GrantedAuthority;
  6. import org.springframework.security.core.userdetails.UserDetails;
  7.  
  8. import com.fasterxml.jackson.annotation.JsonIgnore;
  9.  
  10. /**
  11. * @author Vishal
  12. *
  13. */
  14. public class JwtUser implements UserDetails {
  15.  
  16. private static final long serialVersionUID = 1L;
  17. private final String id;
  18. private final String username;
  19. private final String fullname;
  20. private final String password;
  21. private final Collection<? extends GrantedAuthority> authorities;
  22.  
  23. public JwtUser(String id, String username, String fullname, String password,
  24. Collection<? extends GrantedAuthority> authorities) {
  25. this.id = id;
  26. this.username = username;
  27. this.fullname = fullname;
  28. this.password = password;
  29. this.authorities = authorities;
  30. }
  31.  
  32. @JsonIgnore
  33. public String getId() {
  34. return id;
  35. }
  36.  
  37. @Override
  38. public String getUsername() {
  39. return username;
  40. }
  41.  
  42. @JsonIgnore
  43. @Override
  44. public boolean isAccountNonExpired() {
  45. return true;
  46. }
  47.  
  48. @JsonIgnore
  49. @Override
  50. public boolean isAccountNonLocked() {
  51. return true;
  52. }
  53.  
  54. @JsonIgnore
  55. @Override
  56. public boolean isCredentialsNonExpired() {
  57. return true;
  58. }
  59.  
  60. public String getFullname() {
  61. return fullname;
  62. }
  63.  
  64. @JsonIgnore
  65. @Override
  66. public String getPassword() {
  67. return password;
  68. }
  69.  
  70. @Override
  71. public Collection<? extends GrantedAuthority> getAuthorities() {
  72. return authorities;
  73. }
  74.  
  75. @Override
  76. public boolean isEnabled() {
  77. return true;
  78. }
  79.  
  80.  
  81.  
  82. }
Add Comment
Please, Sign In to add comment