Package org.wildfly.security.http.oidc
Class OidcCookieTokenStore
- java.lang.Object
-
- org.wildfly.security.http.oidc.OidcCookieTokenStore
-
- All Implemented Interfaces:
OidcTokenStore
public class OidcCookieTokenStore extends Object implements OidcTokenStore
- Author:
- Pedro Igor
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ACCESS_TOKEN_INDEX
private static String
DELIM
private static int
EXPECTED_NUM_TOKENS
private OidcHttpFacade
httpFacade
private static int
ID_TOKEN_INDEX
private static String
LEGACY_DELIM
private static int
REFRESH_TOKEN_INDEX
-
Constructor Summary
Constructors Constructor Description OidcCookieTokenStore(OidcHttpFacade httpFacade)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkCurrentToken()
Check if the current token exists.(package private) static String
getContextPath(OidcHttpFacade facade)
(package private) static String
getCookiePath(OidcClientConfiguration deployment, OidcHttpFacade facade)
static OidcPrincipal<RefreshableOidcSecurityContext>
getPrincipalFromCookie(OidcClientConfiguration deployment, OidcHttpFacade facade, OidcCookieTokenStore tokenStore)
boolean
isCached(RequestAuthenticator authenticator)
Check if we are already logged in (i.e., check if we have a valid and successfully refreshed access token).void
logout()
Handle logout on store side and possibly propagate logout call to the OIDC provider.void
logout(boolean glo)
void
logoutAll()
void
logoutHttpSessions(List<String> ids)
void
refreshCallback(RefreshableOidcSecurityContext securityContext)
Callback invoked after a successful token refresh.static void
removeCookie(OidcClientConfiguration deployment, OidcHttpFacade facade)
boolean
restoreRequest()
Restore the request.void
saveAccountInfo(OidcAccount account)
Finish a successful login and store the validated account.void
saveRequest()
Save the request.static void
setTokenCookie(OidcClientConfiguration deployment, OidcHttpFacade facade, RefreshableOidcSecurityContext session)
-
-
-
Field Detail
-
httpFacade
private final OidcHttpFacade httpFacade
-
DELIM
private static final String DELIM
- See Also:
- Constant Field Values
-
LEGACY_DELIM
private static final String LEGACY_DELIM
- See Also:
- Constant Field Values
-
EXPECTED_NUM_TOKENS
private static final int EXPECTED_NUM_TOKENS
- See Also:
- Constant Field Values
-
ACCESS_TOKEN_INDEX
private static final int ACCESS_TOKEN_INDEX
- See Also:
- Constant Field Values
-
ID_TOKEN_INDEX
private static final int ID_TOKEN_INDEX
- See Also:
- Constant Field Values
-
REFRESH_TOKEN_INDEX
private static final int REFRESH_TOKEN_INDEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OidcCookieTokenStore
public OidcCookieTokenStore(OidcHttpFacade httpFacade)
-
-
Method Detail
-
checkCurrentToken
public void checkCurrentToken()
Description copied from interface:OidcTokenStore
Check if the current token exists. Refresh the token if it exists but is expired.- Specified by:
checkCurrentToken
in interfaceOidcTokenStore
-
isCached
public boolean isCached(RequestAuthenticator authenticator)
Description copied from interface:OidcTokenStore
Check if we are already logged in (i.e., check if we have a valid and successfully refreshed access token). If so, establish the security context.- Specified by:
isCached
in interfaceOidcTokenStore
- Parameters:
authenticator
- used for actual request authentication- Returns:
true
if we are logged in already;false
otherwise
-
saveAccountInfo
public void saveAccountInfo(OidcAccount account)
Description copied from interface:OidcTokenStore
Finish a successful login and store the validated account.- Specified by:
saveAccountInfo
in interfaceOidcTokenStore
- Parameters:
account
- the validated account
-
logout
public void logout()
Description copied from interface:OidcTokenStore
Handle logout on store side and possibly propagate logout call to the OIDC provider.- Specified by:
logout
in interfaceOidcTokenStore
-
refreshCallback
public void refreshCallback(RefreshableOidcSecurityContext securityContext)
Description copied from interface:OidcTokenStore
Callback invoked after a successful token refresh.- Specified by:
refreshCallback
in interfaceOidcTokenStore
- Parameters:
securityContext
- context where refresh was performed
-
saveRequest
public void saveRequest()
Description copied from interface:OidcTokenStore
Save the request.- Specified by:
saveRequest
in interfaceOidcTokenStore
-
restoreRequest
public boolean restoreRequest()
Description copied from interface:OidcTokenStore
Restore the request.- Specified by:
restoreRequest
in interfaceOidcTokenStore
- Returns:
true
if the request was successfully restored;false
otherwise
-
logout
public void logout(boolean glo)
- Specified by:
logout
in interfaceOidcTokenStore
-
logoutAll
public void logoutAll()
- Specified by:
logoutAll
in interfaceOidcTokenStore
-
logoutHttpSessions
public void logoutHttpSessions(List<String> ids)
- Specified by:
logoutHttpSessions
in interfaceOidcTokenStore
-
removeCookie
public static void removeCookie(OidcClientConfiguration deployment, OidcHttpFacade facade)
-
setTokenCookie
public static void setTokenCookie(OidcClientConfiguration deployment, OidcHttpFacade facade, RefreshableOidcSecurityContext session)
-
getCookiePath
static String getCookiePath(OidcClientConfiguration deployment, OidcHttpFacade facade)
-
getContextPath
static String getContextPath(OidcHttpFacade facade)
-
getPrincipalFromCookie
public static OidcPrincipal<RefreshableOidcSecurityContext> getPrincipalFromCookie(OidcClientConfiguration deployment, OidcHttpFacade facade, OidcCookieTokenStore tokenStore)
-
-