new Manager(logger, connector, storage, redirector, defaultProviderName, localTokenProviderName, autoLogin, autoRelogin, autoDomain, autoUser, autoPassword, autoToken)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
logger |
olympe.logging.Channel | ||
connector |
olympe.auth.connectors.Manager | ||
storage |
olympe.auth.TokenStorage |
<nullable> |
|
redirector |
olympe.auth.Redirector |
<nullable> |
|
defaultProviderName |
string | ||
localTokenProviderName |
string | ||
autoLogin |
boolean | ||
autoRelogin |
boolean | ||
autoDomain |
string | ||
autoUser |
string | ||
autoPassword |
string | ||
autoToken |
string |
- Implements:
Methods
-
getCurrentState()
-
Gets the authentication manager state at the time of the method call
- Implements:
Returns:
-
getDomain()
-
Gets the current domain
- Implements:
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
getDomainTag()
-
Gets the current domain tag
- Implements:
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
getErrorMessage()
-
Gets the last error message if any
- Implements:
Returns:
- Type
- olympe.df.POString
-
getState()
-
Gets the authentication manager state
- Implements:
Returns:
-
getTokenNonce()
-
Gets the 'nonce' of the current user token.
- Implements:
Returns:
- Type
- olympe.df.POString
-
getUser()
-
Gets the current user name
- Implements:
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
getUserTag()
-
Gets the current user tag
- Implements:
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
isAuthenticated()
-
Returns true if the user is authenticated
- Implements:
Returns:
- Type
- olympe.df.POBoolean
-
isError()
-
Returns true if the last login attempt failed
- Implements:
Returns:
- Type
- olympe.df.POBoolean
-
login(request [, providerName])
-
Logs a user in
Parameters:
Name Type Argument Description request
olympe.auth.Request Authentication request
providerName
string <optional>
Authentication provider name, if not specified use the default one
- Implements:
-
loginWithLocalToken()
-
Automatically relogs the user from a locally stored token using the last provider
- Implements:
-
loginWithParams()
-
Login using the parameters passed to the Olympe configuration.
-
logout()
-
Logs the user out and call the registered logout callbacks when the answer has come.
- Implements:
-
offAuthentication(id)
-
Unregisters a callback on authentication attempts.
Parameters:
Name Type Description id
string Callback identifier
- Implements:
-
offLogout(id)
-
Unregisters a callback on on logout.
Parameters:
Name Type Description id
string Callback identifier
- Implements:
-
onAuthentication(callback [, id])
-
Registers a callback on each authentication attempt. Those callbacks are also called on automatic authentication after disconnection.
Parameters:
Name Type Argument Description callback
olympe.auth.Manager.AuthenticationCallback Callback function
id
string <optional>
Optional callback identifier
- Implements:
Returns:
Callback identifier
- Type
- string
-
onLogout(callback [, id])
-
Registers a callback on logout.
Parameters:
Name Type Argument Description callback
olympe.auth.Manager.LogoutCallback Callback function
id
string <optional>
Optional callback identifier
- Implements:
Returns:
Callback identifier
- Type
- string
-
registerProvider(provider)
-
Registers a login method
Parameters:
Name Type Description provider
olympe.auth.Provider Authentication provider
- Implements:
-
resetState()
-
Reset manager state in case a login failed or could not be performed due to missing information. This logs the user out if it was authenticated!