org.jboss.errai.security.client.local.context
Class BasicUserCacheImpl
java.lang.Object
org.jboss.errai.security.client.local.context.BasicUserCacheImpl
- All Implemented Interfaces:
- ActiveUserCache
@ApplicationScoped
public class BasicUserCacheImpl
- extends Object
- implements ActiveUserCache
- Author:
- Max Barkley
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BasicUserCacheImpl
public BasicUserCacheImpl()
getUser
public User getUser()
- Specified by:
getUser
in interface ActiveUserCache
- Returns:
- The currently logged in
User
. Never returns null
.
If no user is logged in, returns User.ANONYMOUS
.
setUser
public void setUser(User user)
- Description copied from interface:
ActiveUserCache
- Set the currently logged in
User
.
- Specified by:
setUser
in interface ActiveUserCache
- Parameters:
user
- The User
currently logged in.
isValid
public boolean isValid()
- Specified by:
isValid
in interface ActiveUserCache
- Returns:
- False if the cached
User
has been invalidated.
invalidateCache
public void invalidateCache()
- Description copied from interface:
ActiveUserCache
- Invalidate the cached
User
.
- Specified by:
invalidateCache
in interface ActiveUserCache
hasUser
public boolean hasUser()
- Description copied from interface:
ActiveUserCache
- When this returns
false
, calls to ActiveUserCache.getUser()
will return User.ANONYMOUS
.
- Specified by:
hasUser
in interface ActiveUserCache
- Returns:
- True iff there is a cached
User
available from a recent
login.
Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.