Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package com.example.demo.security;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. /**
  7. *
  8. * @author KMaji
  9. *
  10. */
  11. public class AppUser{
  12.  
  13. private String userName;
  14. private String password;
  15. private List<String> role;
  16.  
  17. public String[] getRole() {
  18. if (null == role || role.isEmpty()) {
  19. return null;
  20. }
  21. return role.toArray(new String[role.size()]);
  22. }
  23.  
  24. public void setRole(List<String> role) {
  25. this.role = role;
  26. }
  27.  
  28. public String getUserName() {
  29. return userName;
  30. }
  31.  
  32. public String getPassword() {
  33. return password;
  34. }
  35.  
  36. public void setPassword(String password) {
  37. this.password = password;
  38. }
  39.  
  40. public AppUser(String userName, String password, String... roles) {
  41. this.userName = userName;
  42. this.password = password;
  43. if (null != roles)
  44. this.role = new ArrayList<>();
  45. for (String eachRole : roles)
  46. role.add(eachRole);
  47. }
  48.  
  49. @Override
  50. public String toString() {
  51. return "AppUser [userName=" + userName + ", password=" + password + ", role=" + role + "]";
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement