-
- All Implemented Interfaces:
-
com.gigya.android.sdk.session.ISessionService
public class SessionService implements ISessionService
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclearCookies
-
Constructor Summary
Constructors Constructor Description SessionService(Context context, Config config, IPersistenceService psService, SessionStateHandler observable)
-
Method Summary
Modifier and Type Method Description voidsetClearCookies(boolean clear)StringencryptSession(String plain, Key key)StringdecryptSession(String encrypted, Key key)voidsave(SessionInfo sessionInfo)Persist session info using current encryption algorithm. voidload()Load current persistent session. SessionInfogetSession()Get current available session. voidsetSession(SessionInfo sessionInfo)External session setter interface.Will override the current session with given session info.Session will be also persist. booleanisValid()Check id current session validity.Validity is evaluated via theses constraints:#1 - Session object reference is not null.#2 - Session contains token and secret.#3 - If session contains expiration, check if not yet expired. voidclear(boolean clearStorage)Clear session from memory. voidclearCookiesOnLogout()voidregisterExpirationObserver(SessionStateObserver observer)voidremoveExpirationObserver(SessionStateObserver observer)voidcancelSessionCountdownTimer()Cancel running timer if reference is not null. voidaddInterceptor(GigyaInterceptor interceptor)Add custom session interception. voidrefreshSessionExpiration()Refresh the current session expiration timestamp.For internal use. voidstartSessionCountdownTimerIfNeeded()Check if session countdown is required. -
-
Constructor Detail
-
SessionService
SessionService(Context context, Config config, IPersistenceService psService, SessionStateHandler observable)
-
-
Method Detail
-
setClearCookies
void setClearCookies(boolean clear)
-
encryptSession
@Nullable() String encryptSession(String plain, Key key)
-
decryptSession
@Nullable() String decryptSession(String encrypted, Key key)
-
save
void save(SessionInfo sessionInfo)
Persist session info using current encryption algorithm.
- Parameters:
sessionInfo- Provided session.
-
load
void load()
Load current persistent session.
-
getSession
SessionInfo getSession()
Get current available session.
-
setSession
void setSession(SessionInfo sessionInfo)
External session setter interface.Will override the current session with given session info.Session will be also persist.
- Parameters:
sessionInfo- Provided session.
-
isValid
boolean isValid()
Check id current session validity.Validity is evaluated via theses constraints:#1 - Session object reference is not null.#2 - Session contains token and secret.#3 - If session contains expiration, check if not yet expired.
-
clear
void clear(boolean clearStorage)
Clear session from memory.
- Parameters:
clearStorage- Set True if session should be cleared from persistence as well.
-
clearCookiesOnLogout
void clearCookiesOnLogout()
-
registerExpirationObserver
void registerExpirationObserver(SessionStateObserver observer)
-
removeExpirationObserver
void removeExpirationObserver(SessionStateObserver observer)
-
cancelSessionCountdownTimer
void cancelSessionCountdownTimer()
Cancel running timer if reference is not null.
-
addInterceptor
void addInterceptor(GigyaInterceptor interceptor)
Add custom session interception.Interception will apply when you set a new session using setSession setSession
- Parameters:
interceptor- Provided interceptor implementation.
-
refreshSessionExpiration
void refreshSessionExpiration()
Refresh the current session expiration timestamp.For internal use.
-
startSessionCountdownTimerIfNeeded
void startSessionCountdownTimerIfNeeded()
Check if session countdown is required. Initiate if needed.
-
-
-
-