You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IAuthenticationManager.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright 2013 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit.manager;
  17. import javax.servlet.http.HttpServletRequest;
  18. import javax.servlet.http.HttpServletResponse;
  19. import com.gitblit.models.TeamModel;
  20. import com.gitblit.models.UserModel;
  21. public interface IAuthenticationManager extends IManager {
  22. /**
  23. * Authenticate a user based on HTTP request parameters.
  24. *
  25. * Authentication by X509Certificate is tried first and then by cookie.
  26. *
  27. * @param httpRequest
  28. * @return a user object or null
  29. */
  30. UserModel authenticate(HttpServletRequest httpRequest);
  31. /**
  32. * Authenticate a user based on HTTP request parameters.
  33. *
  34. * Authentication by X509Certificate, servlet container principal, cookie,
  35. * and BASIC header.
  36. *
  37. * @param httpRequest
  38. * @param requiresCertificate
  39. * @return a user object or null
  40. */
  41. UserModel authenticate(HttpServletRequest httpRequest, boolean requiresCertificate);
  42. /**
  43. * Authenticate a user based on a username and password.
  44. *
  45. * @see IUserService.authenticate(String, char[])
  46. * @param username
  47. * @param password
  48. * @return a user object or null
  49. */
  50. UserModel authenticate(String username, char[] password);
  51. /**
  52. * Sets a cookie for the specified user.
  53. *
  54. * @param response
  55. * @param user
  56. */
  57. void setCookie(HttpServletResponse response, UserModel user);
  58. /**
  59. * Logout a user.
  60. *
  61. * @param user
  62. */
  63. void logout(HttpServletResponse response, UserModel user);
  64. /**
  65. * Does the user service support changes to credentials?
  66. *
  67. * @return true or false
  68. * @since 1.0.0
  69. */
  70. boolean supportsCredentialChanges(UserModel user);
  71. /**
  72. * Returns true if the user's display name can be changed.
  73. *
  74. * @param user
  75. * @return true if the user service supports display name changes
  76. */
  77. boolean supportsDisplayNameChanges(UserModel user);
  78. /**
  79. * Returns true if the user's email address can be changed.
  80. *
  81. * @param user
  82. * @return true if the user service supports email address changes
  83. */
  84. boolean supportsEmailAddressChanges(UserModel user);
  85. /**
  86. * Returns true if the user's team memberships can be changed.
  87. *
  88. * @param user
  89. * @return true if the user service supports team membership changes
  90. */
  91. boolean supportsTeamMembershipChanges(UserModel user);
  92. /**
  93. * Returns true if the team memberships can be changed.
  94. *
  95. * @param user
  96. * @return true if the team memberships can be changed
  97. */
  98. boolean supportsTeamMembershipChanges(TeamModel team);
  99. }