# new AdaptiveStore()
Session store that persists data in the browser's localStorage
(see
LocalStorageStore) if that is available or in
a cookie (see CookieStore) if it is not.
This is the default store that Ember Simple Auth will use when the application doesn't define a custom store.
This session store does not work with FastBoot. In order to use Ember Simple Auth with FastBoot, configure the CookieStore as the application's session store.
Extends
Members
String
# static _cookieDomain
The domain to use for the cookie if localStorage
is not available, e.g.,
"example.com", ".example.com" (which includes all subdomains) or
"subdomain.example.com". If not explicitly set, the cookie domain defaults
to the domain the session was authenticated on.
Properties:
Name | Type | Description |
---|---|---|
cookieDomain |
- Default Value:
- null
Integer
# static _cookieExpirationTime
The expiration time for the cookie in seconds if localStorage
is not
available. A value of null
will make the cookie a session cookie that
expires and gets deleted when the browser is closed.
Properties:
Name | Type | Description |
---|---|---|
cookieExpirationTime |
- Default Value:
- null
String
# static _cookieName
The name of the cookie to use if localStorage
is not available.
Properties:
Name | Type | Description |
---|---|---|
cookieName |
- Default Value:
- ember_simple_auth-session
String
# static _cookiePath
The path to use for the cookie, e.g., "/", "/something".
Properties:
Name | Type | Description |
---|---|---|
cookiePath |
- Default Value:
- '/'
String
# static _sameSite
Allows servers to assert that a cookie ought not to be sent along with cross-site requests, which provides some protection against cross-site request forgery attacks (CSRF).
Available options:
- "Strict"
- "Lax"
Properties:
Name | Type | Description |
---|---|---|
sameSite |
- Default Value:
- null
String
# static localStorageKey
The localStorage
key the store persists data in if localStorage
is
available.
Properties:
Name | Type | Description |
---|---|---|
localStorageKey |
- Default Value:
- 'ember_simple_auth-session'
Methods
# static clear() → {Ember.RSVP.Promise}
Clears the store by deleting the
LocalStorageStore.key from
localStorage
if that is available or by deleting the cookie if it is not.
A promise that resolves when the store has been cleared successfully and rejects otherwise.
Ember.RSVP.Promise
# static persist(data) → {Ember.RSVP.Promise}
Persists the data
in the localStorage
if it is available or in a cookie
if it is not.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object
|
The data to persist |
A promise that resolves when the data has successfully been persisted and rejects otherwise.
Ember.RSVP.Promise
# static restore() → {Ember.RSVP.Promise}
Returns all data currently stored in the localStorage
if that is
available - or if it is not, in the cookie - as a plain object.
A promise that resolves with the data currently persisted in the store when the data has been restored successfully and rejects otherwise.
Ember.RSVP.Promise