public interface SecurityContext
Modifier and Type | Method and Description |
---|---|
User |
getCachedUser()
Remote calls to
AuthenticationService are cached, such that calls
to this method can retrieve the logged in User from memory. |
boolean |
hasCachedUser() |
void |
invalidateCache()
Invalidate the cached
User . |
boolean |
isUserCacheValid() |
void |
navigateBackOrHome()
Navigate to the last page a user was redirected from (via this security context), or to the
DefaultPage if the user has not been redirected. |
void |
navigateBackOrToPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> pageType)
Navigate to the last page a user was redirected from (via this security context), or to the
given page if the user has not been redirected.
|
void |
redirectToLoginPage()
Navigate to the
LoginPage , caching the current page. |
void |
redirectToLoginPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> fromPage)
Navigate to the
LoginPage . |
void |
redirectToSecurityErrorPage()
Navigate to the
SecurityError , caching the current page. |
void |
redirectToSecurityErrorPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> fromPage)
Navigate to the
SecurityError page. |
void |
setCachedUser(User user)
Validate and set the cached user.
|
void redirectToLoginPage()
LoginPage
, caching the current page. This is the same as calling
redirectToLoginPage(Class)
with the argument Navigation.getCurrentPage().contentType()
.void redirectToLoginPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> fromPage)
LoginPage
.fromPage
- This Page
type is cached so that a subsequent call to
navigateBackOrHome()
or navigateBackOrToPage(Class)
will return to
the Page
of this type.void redirectToSecurityErrorPage()
SecurityError
, caching the current page. This is the same as calling
redirectToSecurityErrorPage(Class)
with the argument
Navigation.getCurrentPage().contentType()
.void redirectToSecurityErrorPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> fromPage)
SecurityError
page.fromPage
- This Page
type is cached so that a subsequent call to
navigateBackOrHome()
or navigateBackOrToPage(Class)
will return to
the Page
of this type.void navigateBackOrHome()
DefaultPage
if the user has not been redirected.void navigateBackOrToPage(Class<? extends com.google.gwt.user.client.ui.IsWidget> pageType)
pageType
- The type of the page to navigate to if the user has not been redirected. Must not be
null
.boolean hasCachedUser()
SecurityContext#isCacheValid()
is true and
getCachedUser()
will not return
User.ANONYMOUS
.User getCachedUser()
AuthenticationService
are cached, such that calls
to this method can retrieve the logged in User
from memory.User
. If no user is logged in (or
the cache is invalid
)
then User.ANONYMOUS
.void setCachedUser(User user)
getCachedUser()
will return the given user until
this method or invalidateCache()
is called.
Subsequent calls to SecurityContext#isCacheValid()
will return true
until invalidateCache()
is called.user
- The User
to cache. Must not be null
. To set no
user as logged in, user User.ANONYMOUS
.boolean isUserCacheValid()
getCachedUser()
accurately reflects the User
that would be returned from a
call to AuthenticationService.getUser()
.void invalidateCache()
User
. Subsequent calls to
isUserCacheValid()
will return false.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.