Skip to content

Commit f610669

Browse files
authored
Improve Javadoc of InMemorySecurityRealm (#10797)
* the documentation enhanced for InMemorySecurityRealm.java * the documentation enhanced for InMemorySecurityRealm.java - more documentation added * code review comments are incorporated * code review comments * paragraphs added to comments * Code Review Comments addressed * Code Review Comments Addressed
1 parent 8eeb6ef commit f610669

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/src/test/java/test/security/realm/InMemorySecurityRealm.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,21 @@
3636
import org.springframework.security.core.userdetails.UsernameNotFoundException;
3737

3838
/**
39-
* Accept any password
40-
* Allow creation and removal of users
39+
* This class provides an in-memory implementation of Jenkins's {@link hudson.security.SecurityRealm} for
40+
* testing.
41+
* <p>
42+
* It allows the creation and removal of users, and accepts any password for authentication.
43+
* It maintains an in-memory storage of user accounts.
44+
* <p>
45+
* The user also gets authenticated with any password as the only thing validated is presence
46+
* of username entry in the hashmap.
47+
* The {@link #createAccount(String)} is used to populate the in-memory storage.
48+
* It implements the {@link #loadUserByUsername2(String)} method which simply returns the user from the
49+
* in memory storage based on username passed.
50+
* <p>
51+
* A dummy implementation for {@link InMemorySecurityRealm} is provided in class {@link InMemorySecurityRealm}
52+
* which contains no roles and only username is returned.
53+
*
4154
*/
4255
public class InMemorySecurityRealm extends AbstractPasswordBasedSecurityRealm {
4356
private Map<String, UserDetails> userStorage = new HashMap<>();

0 commit comments

Comments
 (0)