/src/main/java/net/sf/sail/webapp/domain/authentication/MutableUserDetails.java

https://github.com/WISEngineering-Dev-Group/webapp · Java · 139 lines · 21 code · 21 blank · 97 comment · 0 complexity · fe0dd5f30ca3f73cdcc520b62d92be41 MD5 · raw file

  1. /**
  2. * Copyright (c) 2006 Encore Research Group, University of Toronto
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. package net.sf.sail.webapp.domain.authentication;
  19. import java.util.Date;
  20. import org.springframework.security.GrantedAuthority;
  21. import org.springframework.security.userdetails.UserDetails;
  22. import net.sf.sail.webapp.domain.Persistable;
  23. /**
  24. * This interface extends Acegi Security's <code>UserDetails</code> and
  25. * provides mutator methods to the properties. <code>UserDetails</code>
  26. * represents user information.
  27. *
  28. * @author Cynick Young
  29. * @author Laurel Williams
  30. *
  31. * @version $Id$
  32. * @see org.acegisecurity.userdetails.UserDetails
  33. *
  34. */
  35. public interface MutableUserDetails extends UserDetails, Persistable {
  36. /**
  37. * Sets an array of <code>GrantedAuthority</code> for this user. A
  38. * <code>GrantedAuthority</code> represents a role that can be given
  39. * specific access permissions. An example could be Admin, User, Manager,
  40. * and BankTeller roles.
  41. *
  42. * @param authorities
  43. * @see org.acegisecurity.GrantedAuthority
  44. */
  45. public void setAuthorities(GrantedAuthority[] authorities);
  46. /**
  47. * Sets the user's password. This may or may not be plaintext. It will be up
  48. * to the implementor to decide if encryption is required. If encryption is
  49. * used, it must be representable as a <code>String</code>.
  50. *
  51. * @param password
  52. */
  53. public void setPassword(String password);
  54. /**
  55. * Sets the user's name.
  56. *
  57. * @param username
  58. */
  59. public void setUsername(String username);
  60. /**
  61. * Sets the user's email address.
  62. *
  63. * @param emailAddress
  64. */
  65. public void setEmailAddress(String emailAddress);
  66. /**
  67. * Gets the user's email address.
  68. *
  69. * @return emailAddress
  70. */
  71. public String getEmailAddress();
  72. /**
  73. * Adds a GrantedAuthority to a user.
  74. *
  75. * @param authority
  76. */
  77. public void addAuthority(GrantedAuthority authority);
  78. /**
  79. * Returns true iff this user has the specified GrantedAuthority
  80. * @return
  81. */
  82. public boolean hasGrantedAuthority(String role);
  83. /**
  84. * Gets the id for this user details object in the persistent store
  85. *
  86. * @return The id of this user details object
  87. */
  88. public Long getId();
  89. /**
  90. * Enables/Disables account.
  91. * This does not update the row in the database; only this object.
  92. */
  93. public void setEnabled(boolean enabled);
  94. /**
  95. * Get the recent failed login timestamp
  96. * @return
  97. */
  98. public Date getRecentFailedLoginTime();
  99. /**
  100. * Set the recent failed login timestamp
  101. * @param recentFailedLoginTime
  102. */
  103. public void setRecentFailedLoginTime(Date recentFailedLoginTime);
  104. /**
  105. * Get the number of recent failed login attempts
  106. * @return
  107. */
  108. public Integer getNumberOfRecentFailedLoginAttempts();
  109. /**
  110. * Set the number of recent failed login attempts
  111. * @param numberOfFailedLoginAttempts
  112. */
  113. public void setNumberOfRecentFailedLoginAttempts(Integer numberOfFailedLoginAttempts);
  114. /**
  115. * Increase the number of recent failed login attempts by 1
  116. */
  117. public void incrementNumberOfRecentFailedLoginAttempts();
  118. }