Skip to content

Commit e292d03

Browse files
committed
OAK-11610: Clarify null passwords in createUser(...)
1 parent 32d11a8 commit e292d03

File tree

1 file changed

+11
-5
lines changed
  • oak-jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user

1 file changed

+11
-5
lines changed

oak-jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ public interface UserManager {
167167
Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException;
168168

169169
/**
170-
* Creates an User for the given userID / password pair; neither of the
171-
* specified parameters can be <code>null</code>.<br>
170+
* Creates a user for the given userID / password pair.
171+
* <br>
172172
* Same as {@link #createUser(String,String,Principal,String)} where
173173
* the specified userID is equal to the principal name and the intermediate
174174
* path is <code>null</code>.
175-
*
175+
176176
* @param userID The ID of the new user.
177177
* @param password The initial password of this user.
178178
* @return The new <code>User</code>.
@@ -184,11 +184,15 @@ public interface UserManager {
184184
User createUser(@NotNull String userID, @Nullable String password) throws AuthorizableExistsException, RepositoryException;
185185

186186
/**
187-
* Creates an User for the given parameters. If the implementation is not
187+
* Creates a user for the given parameters. If the implementation is not
188188
* able to deal with the <code>intermediatePath</code> that parameter should
189189
* be ignored.
190-
* Except for the <code>intermediatePath</code>, neither of the specified
190+
* Except for the <code>intermediatePath</code> and <code>password</code>, neither of the specified
191191
* parameters can be <code>null</code>.
192+
* <p>
193+
* The given password may be {@code null} however the behavior
194+
* of such users depend on the implementation (usually those users cannot be used for authentication but only for impersonation).
195+
* Consider using {@link #createSystemUser(String, String)} rather than creating a user with a {@code null} password with this method.
192196
*
193197
* @param userID The ID of the new user.
194198
* @param password The initial password of the new user.
@@ -201,6 +205,8 @@ public interface UserManager {
201205
* in use or another Authorizable with the same principal name exists.
202206
* @throws RepositoryException If the current Session is
203207
* not allowed to create users or some another error occurs.
208+
*
209+
* @see #createSystemUser(String, String)
204210
*/
205211
@NotNull
206212
User createUser(@NotNull String userID, @Nullable String password, @NotNull Principal principal,

0 commit comments

Comments
 (0)