public class MockUserKeyService extends Object implements UserKeyService
| Constructor and Description |
|---|
MockUserKeyService() |
| Modifier and Type | Method and Description |
|---|---|
String |
getKeyForUser(ApplicationUser user)
This convenience method is equivalent to
getKeyForUsername(user.getName()), except that
it is null-safe. |
String |
getKeyForUsername(String username)
Returns the key that is associated with the given username.
|
String |
getUsernameForKey(String key)
Returns the (lower-cased) username that is associated with the given key.
|
void |
setMapping(String key,
String username) |
public String getUsernameForKey(String key)
UserKeyServiceNote that this returns the lower-case of the username (because username must act case-insensitive in our key->username map).
getUsernameForKey in interface UserKeyServicekey - the key to resolve to a username (may be null)null if key
is null or unmapped. Note that a non-null result does not guarantee that
the user still exists.public String getKeyForUsername(String username)
UserKeyServicegetKeyForUsername in interface UserKeyServiceusername - the username to resolve to a key (may be null)null if username
is null or unmapped. Note that a non-null result does not guarantee that
the user still exists.public String getKeyForUser(ApplicationUser user)
UserKeyServicegetKeyForUsername(user.getName()), except that
it is null-safe.getKeyForUser in interface UserKeyServiceuser - the user to resolve to a key (may be null)UserKeyService.getKeyForUsername(String)Copyright © 2002-2021 Atlassian. All Rights Reserved.