## CamelSasl

CamelSasl

## Synopsis

                        CamelSasl;
    GByteArray *        camel_sasl_challenge                (CamelSasl *sasl,
                                                             GByteArray *token,
                                                             GError **error);
    gchar *             camel_sasl_challenge_base64         (CamelSasl *sasl,
                                                             const gchar *token,
                                                             GError **error);
    CamelSasl *         camel_sasl_new                      (const gchar *service_name,
                                                             const gchar *mechanism,
                                                             CamelService *service);
    gboolean            camel_sasl_get_authenticated        (CamelSasl *sasl);
    void                camel_sasl_set_authenticated        (CamelSasl *sasl,
                                                             gboolean authenticated);
    const gchar *       camel_sasl_get_mechanism            (CamelSasl *sasl);
    CamelService *      camel_sasl_get_service              (CamelSasl *sasl);
    const gchar *       camel_sasl_get_service_name         (CamelSasl *sasl);
    GList *             camel_sasl_authtype_list            (gboolean include_plain);
    CamelServiceAuthType * camel_sasl_authtype              (const gchar *mechanism);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelSasl
                   +----CamelSaslAnonymous
                   +----CamelSaslCramMd5
                   +----CamelSaslDigestMd5
                   +----CamelSaslGssapi
                   +----CamelSaslLogin
                   +----CamelSaslNTLM
                   +----CamelSaslPlain
                   +----CamelSaslPOPB4SMTP

## Properties

      "authenticated"            gboolean              : Read / Write
      "mechanism"                gchar*                : Read / Write / Construct Only
      "service"                  CamelService*         : Read / Write / Construct Only
      "service-name"             gchar*                : Read / Write / Construct Only

## Description

## Details

### CamelSasl

    typedef struct _CamelSasl CamelSasl;

### camel_sasl_challenge ()

    GByteArray *        camel_sasl_challenge                (CamelSasl *sasl,
                                                             GByteArray *token,
                                                             GError **error);

If `token` is `NULL`, generate the initial SASL message to send to the server. (This will be `NULL` if the client doesn't initiate the exchange.) Otherwise, `token` is a challenge from the server, and the return value is the response.

`sasl` : | a CamelSasl object
`token` : | a token, or `NULL`
`error` : | return location for a GError, or `NULL`
Returns : | the SASL response or `NULL`. If an error occurred, `ex` will also be set.

### camel_sasl_challenge_base64 ()

    gchar *             camel_sasl_challenge_base64         (CamelSasl *sasl,
                                                             const gchar *token,
                                                             GError **error);

As with camel_sasl_challenge, but the challenge `token` and the response are both base64-encoded.

`sasl` : | a CamelSasl object
`token` : | a base64-encoded token
`error` : | return location for a GError, or `NULL`
Returns : | the base64 encoded challenge string

### camel_sasl_new ()

    CamelSasl *         camel_sasl_new                      (const gchar *service_name,
                                                             const gchar *mechanism,
                                                             CamelService *service);

`service_name` : | the SASL service name
`mechanism` : | the SASL mechanism
`service` : | the CamelService that will be using this SASL
Returns : | a new CamelSasl object for the given `service_name`, `mechanism`, and `service`, or `NULL` if the mechanism is not supported.

### camel_sasl_get_authenticated ()

    gboolean            camel_sasl_get_authenticated        (CamelSasl *sasl);

`sasl` : | a CamelSasl object
Returns : | whether or not `sasl` has successfully authenticated the user. This will be `TRUE` after it returns the last needed response. The caller must still pass that information on to the server and verify that it has accepted it.

### camel_sasl_set_authenticated ()

    void                camel_sasl_set_authenticated        (CamelSasl *sasl,
                                                             gboolean authenticated);

`sasl` : | a CamelSasl
`authenticated` : | whether we have successfully authenticated

Since 2.32

### camel_sasl_get_mechanism ()

    const gchar *       camel_sasl_get_mechanism            (CamelSasl *sasl);

`sasl` : | a CamelSasl
Returns : |

Since 2.32

### camel_sasl_get_service ()

    CamelService *      camel_sasl_get_service              (CamelSasl *sasl);

`sasl` : | a CamelSasl
Returns : |

Since 2.32

### camel_sasl_get_service_name ()

    const gchar *       camel_sasl_get_service_name         (CamelSasl *sasl);

`sasl` : | a CamelSasl
Returns : |

Since 2.32

### camel_sasl_authtype_list ()

    GList *             camel_sasl_authtype_list            (gboolean include_plain);

`include_plain` : | whether or not to include the PLAIN mechanism
Returns : | a GList of SASL-supported authtypes. The caller must free the list, but not the contents.

### camel_sasl_authtype ()

    CamelServiceAuthType * camel_sasl_authtype              (const gchar *mechanism);

`mechanism` : | the SASL mechanism to get an authtype for
Returns : | a CamelServiceAuthType for the given mechanism, if it is supported.

## Property Details

### The `"authenticated"` property

      "authenticated"            gboolean              : Read / Write

Default value: FALSE

### The `"mechanism"` property

      "mechanism"                gchar*                : Read / Write / Construct Only

Default value: NULL

### The `"service"` property

      "service"                  CamelService*         : Read / Write / Construct Only

### The `"service-name"` property

      "service-name"             gchar*                : Read / Write / Construct Only

Default value: NULL