package ez_api
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ed68e0a33325ecf6a3319cafa636d62e
sha512=425c6289d568cf697e8d9977ac43e2ebcdeec8f04f5a17225824d5a37ac700961e5d1283b92aeaebaf58ccfb5b4261bcba1180ab11c267ade0de86b68fd6ca2d
doc/ez_api.session_client/EzSessionClient/Make/index.html
Module EzSessionClient.Make
Source
Parameters
module S : EzSession.TYPES.SessionArg
Signature
See EzSession.TYPES.SessionArg.user_info
.
See EzSession.TYPES.auth
.
See EzSession.Make
type login_error = [
| EzSession.TYPES.login_error
| EzSession.TYPES.connect_error
| EzSession.TYPES.logout_error
| `Too_many_login_attempts
| `Session_expired
]
Error that could be raised by login
request.
val 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.
val 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.
val 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
.
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`.
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.