new Manager(logger, connector, storage, redirector, historyManager, providers, defaultProviderName, localTokenProviderName, autoLogin, autoUser, autoPassword, urlToken)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
logger |
olympe.logging.Channel | ||
connector |
olympe.auth.ServerConnector | ||
storage |
olympe.auth.TokenStorage |
<nullable> |
|
redirector |
olympe.auth.Redirector |
<nullable> |
|
historyManager |
olympe.host.HistoryManager |
<nullable> |
|
providers |
Array.<!olympe.auth.Provider> | ||
defaultProviderName |
string | ||
localTokenProviderName |
string | ||
autoLogin |
boolean | ||
autoUser |
string | ||
autoPassword |
string | ||
urlToken |
string |
Members
-
<static> LOGOUT_STEPS :string
-
Type:
- string
Properties:
Name Type Default Description ACCEPTED
string accepted IDP_REDIRECT
string redirect -
<static> REASON :string
-
Login reason
Type:
- string
Properties:
Name Type Default Description MANUAL
string manual AUTO
string auto TOKEN
string tokenOnFirstConnection -
<static> STATE :string
-
Connection states
Type:
- string
Properties:
Name Type Default Description INIT
string init DISCONNECTED
string disconnected GUEST
string guest AUTHENTICATING
string authenticating ERROR
string error AUTHENTICATED
string authenticated
Methods
-
getConfiguredIDPs()
-
Returns the supported SSOs.
Returns:
- Type
- Map.<string, string>
-
getCurrentState()
-
Gets the authentication manager state at the time of the method call
Returns:
- Type
- olympe.auth.Manager.STATE | undefined
-
getCurrentToken()
-
Gets the current Token, or null if none.
Returns:
- Type
- olympe.auth.Token
-
getErrorMessage()
-
Gets the last error message if any
Returns:
- Type
- olympe.df.POString
-
getFullToken()
-
Gets the full SAML token if it exists. It will be zipped & base64 encoded XML.
Returns:
- Type
- olympe.df.Proxy.<?string> | string
-
getLastConnectedTimestamp()
-
Return the timestamp of the last sign of connection we had from the orchestrator.
Returns:
- Type
- number
-
getRoleMembers(roleTag, callback)
-
Retrieve the users associated to the specified role.
Parameters:
Name Type Description roleTag
string callback
function -
getState()
-
Gets the authentication manager state
Returns:
-
getTokenNonce()
-
Gets the 'nonce' of the current user token.
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
getTokenPayload()
-
Gets the custom payload from the current user token.
Returns:
- Type
- !olympe.df.Proxy.<Object> | Object
-
getUser()
-
Gets the current user name
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
getUserFromNameId(nameId, callback)
-
Retrieve the user tag associated to the specified name ID.
Parameters:
Name Type Description nameId
string callback
function -
getUserFromToken(token, callback)
-
Return the user tag associated to the specified token in the specified callback.
Parameters:
Name Type Description token
string callback
function -
getUserRoles(callback)
-
Retrieve the roles of the current user.
Parameters:
Name Type Description callback
function -
getUserTag()
-
Gets the current user tag
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
isAuthenticated()
-
Returns true if the user is authenticated
- Deprecated:
-
- Use getState instead and perform an if === Authenticated on it.
Returns:
- Type
- olympe.df.POBoolean
-
isCurrentlyOnline()
-
Return true if the client is currently connected as a user (authenticated or guest user)
Returns:
- Type
- boolean
-
isOnline()
-
Return a flow that indicates if the client is online. The auth layer is ONLINE when
- in state GUEST
- in state AUTHENTICATED
- also in state AUTHENTICATING. Hence, even if no formal session is available during this state, the connection is still alive.
Returns:
- Type
- olympe.df.POBoolean
-
login(request [, providerName] [, callback])
-
Attempts to log a user in. This will cause the state of this manager to first transition to "authenticating" upon requesting the selected provider, and then either to authenticated if the provider accepts the login, or to guest if the login is unsuccessful
Parameters:
Name Type Argument Description request
olympe.auth.Request Authentication request
providerName
string <optional>
Authentication provider name, if not specified use the default one
callback
olympe.auth.Manager.AuthenticationCallback <optional>
Callback to be called when attempt is finished.
Throws:
-
If the provider is not correctly configured.
- Type
- Error
-
-
logout()
-
Logs the user out and call the registered logout callbacks when the answer has come. Calling logout will eventually cause the state to fallback into "guest"
-
offAuthentication(id)
-
Unregisters a callback on authentication attempts.
Parameters:
Name Type Description id
string Callback identifier
- Deprecated:
-
- Use getState instead and use a processFlows on it to detect authentication
-
offLogout(id)
-
Unregisters a callback on on logout.
Parameters:
Name Type Description id
string Callback identifier
-
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
- Deprecated:
-
- Use getState instead and use a processFlows on it to detect authentication
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
Returns:
Callback identifier
- Type
- string
-
sendKeepAlive()
-
Simulate activity for this session to refresh the expiration timer and keep the token valid.
-
updateState(newState)
-
Parameters:
Name Type Description newState
olympe.auth.Manager.STATE
Type Definitions
-
AuthenticationCallback(error, reason)
-
Parameters:
Name Type Argument Description error
Error <nullable>
reason
olympe.auth.Manager.REASON -
LogoutCallback(logoutStep, logoutData)
-
Parameters:
Name Type Description logoutStep
olympe.auth.Manager.LOGOUT_STEPS logoutData
Object Data that can be necessary for some application to proceed to a clean logout. (e.g.: SAML in carto need to redirect to a url).