@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @Extension public final class UserDetailsCache extends Object
UserDetails
lookup.Constructor and Description |
---|
UserDetailsCache()
Constructor intended to be instantiated by Jenkins only.
|
Modifier and Type | Method and Description |
---|---|
static UserDetailsCache |
get()
The singleton instance registered in Jenkins.
|
org.springframework.security.core.userdetails.UserDetails |
getCached(String idOrFullName)
Gets the cached UserDetails for the given username.
|
void |
invalidate(String idOrFullName)
Discards any cached value for key.
|
void |
invalidateAll()
Discards all entries in the cache.
|
org.springframework.security.core.userdetails.UserDetails |
loadUserByUsername(String idOrFullName)
Locates the user based on the username, by first looking in the cache and then delegate to
SecurityRealm.loadUserByUsername2(String) . |
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public UserDetailsCache()
public static UserDetailsCache get()
@CheckForNull public org.springframework.security.core.userdetails.UserDetails getCached(String idOrFullName) throws org.springframework.security.core.userdetails.UsernameNotFoundException
loadUserByUsername(String)
except it doesn't perform the actual lookup if there is a cache miss.idOrFullName
- the usernamenull
if the cache doesn't contain any data for the key or the user details cached for the key.org.springframework.security.core.userdetails.UsernameNotFoundException
- if a previous lookup resulted in the same@NonNull public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String idOrFullName) throws org.springframework.security.core.userdetails.UsernameNotFoundException, ExecutionException
SecurityRealm.loadUserByUsername2(String)
.idOrFullName
- the usernameorg.springframework.security.core.userdetails.UsernameNotFoundException
- (normally a UserMayOrMayNotExistException2
)
if the user could not be found or the user has no GrantedAuthorityExecutionException
- if anything else went wrong in the cache lookup/retrievalpublic void invalidateAll()
public void invalidate(String idOrFullName)
idOrFullName
- the keyCopyright © 2004–2022. All rights reserved.