package ez_api

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module EzSessionClient.MakeSource

Parameters

module _ : EzReq_S.S

Signature

Sourcetype user_id = S.user_id

See EzSession.TYPES.SessionArg.user_id.

Sourcetype user_info = S.user_info

See EzSession.TYPES.SessionArg.user_info.

See EzSession.TYPES.auth.

Sourcetype login_error = [
  1. | EzSession.TYPES.login_error
  2. | EzSession.TYPES.connect_error
  3. | EzSession.TYPES.logout_error
  4. | `Too_many_login_attempts
  5. | `Session_expired
]

Error that could be raised by login request.

Sourceval connect : EzAPI.base_url -> ?token:string -> (((S.user_id, S.user_info) EzSession.TYPES.auth option, EzSession.TYPES.connect_error) result -> unit) -> unit

Performs request to the server's authentication service if actual state is set to disconnected and calls callback on the response result. If state is set to connected or authenticated, then callback is called on actual connection/authentication status without performing request, unless token is specified.

Sourceval login : ?format:(string -> string) -> EzAPI.base_url -> ?login:string -> ?password:string -> ?foreign:(string * string) -> (((S.user_id, S.user_info) EzSession.TYPES.auth, login_error) result -> unit) -> unit

Performs request to the server's login service. If actual state is set to disconnected, then firstly, it performs connect request. If connect request returns authentication information for different user (if token or cookies wasn't updated) or if other user is already autenticated, it performs logout for this user, and retry logining. If user is connected but not authenticated, it constructs challenge reply by using user's login and password or uses foreign user information to authenticate. Calls callback on authentification status.

Sourceval logout : EzAPI.base_url -> token:string -> ((bool, EzSession.TYPES.logout_error) result -> unit) -> unit

Performs request to the server's logout service if actual state is set to authenticated. After this step, state is set to connected. Callback is called with Ok true if logout was successfully performed. If previous state wasn't set to authenticated, then callback is called with Ok false.

Sourceval disconnected : unit -> unit

Tell the network layer that we think that the session has ended (a request probably returned an error status for missing auth). Since the state is kept internally, we have to do this first to trigger a full reconnection by `login`.

Sourceval auth_headers : token:string -> (string * string) list

Returns authentication headers depending on S.token_kind for client requests. It doesn't include cookies because cookies are automatically added by browser.

Gets current authentication status, if exists.

OCaml

Innovation. Community. Security.