LassoSession

## LassoSession LassoSession — Principal Session |

## Synopsis

    struct              LassoSession;
    LassoSession *      lasso_session_new                   (void);
    LassoSession *      lasso_session_new_from_dump         (const gchar *dump);
    gchar *             lasso_session_dump                  (LassoSession *session);
    void                lasso_session_destroy               (LassoSession *session);
    GList *             lasso_session_get_assertions        (LassoSession *session,
                                                             const char *provider_id);
    LassoNode *         lasso_session_get_assertion         (LassoSession *session,
                                                             const gchar *providerID);
    lasso_error_t       lasso_session_remove_assertion      (LassoSession *session,
                                                             const gchar *providerID);
    lasso_error_t       lasso_session_add_assertion         (LassoSession *session,
                                                             const char *providerID,
                                                             LassoNode *assertion);
    gchar *             lasso_session_get_provider_index    (LassoSession *session,
                                                             gint index);
    gboolean            lasso_session_is_empty              (LassoSession *session);

## Description

## Details

### struct LassoSession

    struct LassoSession {
    	LassoNode parent;

    	/* Can actually contain LassoSamlAssertion or LassoSaml2Assertion */
    	GHashTable *assertions; /* of LassoNode */
    	gboolean is_dirty;
    };

LassoSession stores the assertions received or emitted during the current session. It stores state for using profiles like LassoLogin or LassoLogout.

LassoNode `parent`; |
GHashTable *`assertions`; | a hashtable of LassoSamlAssertion or LassoSaml2Assertion, indexed by provider ids,. [element-type string LassoNode]
gboolean `is_dirty`; | whether this session object has been modified since its creation.

### lasso_session_new ()

    LassoSession *      lasso_session_new                   (void);

Creates a new LassoSession.

Returns : | a newly created LassoSession

### lasso_session_new_from_dump ()

    LassoSession *      lasso_session_new_from_dump         (const gchar *dump);

Restores the `dump` to a new LassoSession.

`dump` : | XML server dump
Returns : | a newly created LassoSession; or NULL if an error occured

### lasso_session_dump ()

    gchar *             lasso_session_dump                  (LassoSession *session);

Dumps `session` content to an XML string.

`session` : | a LassoSession
Returns : | the dump string. It must be freed by the caller. [transfer full]

### lasso_session_destroy ()

    void                lasso_session_destroy               (LassoSession *session);

Destroys a session.

`session` : | a LassoSession

### lasso_session_get_assertions ()

    GList *             lasso_session_get_assertions        (LassoSession *session,
                                                             const char *provider_id);

Gets the assertions for the given `provider_id`.

`session` : | a LassoSession
`provider_id` : | the provider ID
Returns : | a list of LassoSamlAssertion. [allow-none][transfer container][element-type LassoNode]

### lasso_session_get_assertion ()

    LassoNode *         lasso_session_get_assertion         (LassoSession *session,
                                                             const gchar *providerID);

Gets the assertion for the given `providerID`.

`session` : | a LassoSession
`providerID` : | the provider ID
Returns : | the assertion or NULL if it didn't exist. This LassoSamlAssertion is internally allocated and must not be freed by the caller. [transfer none][allow-none]

### lasso_session_remove_assertion ()

    lasso_error_t       lasso_session_remove_assertion      (LassoSession *session,
                                                             const gchar *providerID);

Removes assertion for `providerID` from `session`.

`session` : | a LassoSession
`providerID` : | the provider ID
Returns : | 0 on success; or a negative value otherwise.

### lasso_session_add_assertion ()

    lasso_error_t       lasso_session_add_assertion         (LassoSession *session,
                                                             const char *providerID,
                                                             LassoNode *assertion);

Adds `assertion` to the principal session. This function also add the assertion to the index by assertionID.

`session` : | a LassoSession
`providerID` : | the provider ID
`assertion` : | the assertion
Returns : | 0 on success; or a negative value otherwise.

### lasso_session_get_provider_index ()

    gchar *             lasso_session_get_provider_index    (LassoSession *session,
                                                             gint index);

Looks up and returns the nth provider id.

`session` : | a LassoSession
`index` : | index of requested provider
Returns : | the provider id; or NULL if there were no nth provider. This string must be freed by the caller. [transfer full][allow-none]

### lasso_session_is_empty ()

    gboolean            lasso_session_is_empty              (LassoSession *session);

Returns `TRUE` if session is empty.

`session` : | a LassoSession
Returns : | `TRUE` if empty