class MockPrincipal extends java.lang.Object implements java.security.Principal
A mock of the user Principal for use in unit tests only. Provides the specified (optional) roles for the user.
| Type | Name and description |
|---|---|
private java.util.Map |
attributesThe attributes (simulates the attributes in AuthenticationJWTClaimsSetAdapter). |
private java.lang.String |
userNameThe Mock user name. |
| Constructor and description |
|---|
MockPrincipal
()Builds a mock principal for the user 'TEST' ( SecurityUtils#TEST_USER#TEST_USER ). |
MockPrincipal
(java.lang.String userName)Builds a mock principal for the given user (required). |
MockPrincipal
(java.lang.String userName, java.util.List<java.lang.String> roles)Builds a mock principal for the given user (required). |
MockPrincipal
(java.lang.String userName, java.lang.String role)Builds a mock principal for the given user (required). |
MockPrincipal
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.util.Map |
getAttributes()The mock attributes. |
|
java.lang.String |
getName()Returns the name of this principal. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The attributes (simulates the attributes in AuthenticationJWTClaimsSetAdapter).
The Mock user name.
Builds a mock principal for the user 'TEST' ( SecurityUtils#TEST_USER#TEST_USER ). No roles assigned.
Builds a mock principal for the given user (required). No roles assigned.
userName - The user name.Builds a mock principal for the given user (required).
userName - The user name.roles - The roles the mock user has.Builds a mock principal for the given user (required).
userName - The user name.role - The role the mock user has.Groovy Documentation