# Module Netsys_sasl.Client

    module Client: sig .. end

    type session

    val create_session : mech:Netsys_sasl.sasl_mechanism ->
           user:string ->
           authz:string ->
           creds:Netsys_sasl.credentials ->
           params:(string * string * bool) list -> unit -> session

The new client session authenticate as `user` and authorizes as `authz` (empty string if not applicable). The credentials are `creds`.

`user` and `authz` must be encoded in UTF-8.

The parameters are given as list `(name,value,critical)`. Critical parameters must be interpreted by the mechanism, and unknown critical parameters must be rejected by a `Failure` exception. Non-critical parameters are ignored if they are unknown to the mechanism.

    val state : session -> Netsys_sasl_types.client_state

report the state (whether expecting challenges or responding)

    val configure_channel_binding : session -> Netsys_sasl_types.cb -> unit

Configure GS2-style channel binding

    val restart : session -> unit

Restart the session for another authentication round. The session must be in state ``OK`.

    val process_challenge : session -> string -> unit

Process the challenge from the server. The state must be ``Wait`. As an exception, this function can also be called for the initial challenge from the server, even if the state is ``Emit`.

    val emit_response : session -> string

Emit a new response. The state must be ``Emit`.

    val channel_binding : session -> Netsys_sasl_types.cb

Whether the client suggests or demands channel binding

    val user_name : session -> string

The user name

    val authz_name : session -> string

The authorization name

    val stash_session : session -> string

Serializes the session as string

    val resume_session : Netsys_sasl.sasl_mechanism -> string -> session

Unserializes the session

    val session_id : session -> string option

Optionally return a string that can be used to identify the client session. Not all mechanisms support this.

    val prop : session -> string -> string

Get a mechanism-specific property of the session. E.g. this can be the "realm" sent by the server.

    val gssapi_props : session -> Netsys_gssapi.client_props

Get the GSSAPI props, or raise `Not_found`