## AgsAuthenticationManager

AgsAuthenticationManager — singleton pattern to organize authentication

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_LOGIN_INFO()
#define | AGS_AUTHENTICATION_MANAGER_GET_OBJ_MUTEX()
AgsLoginInfo * | ags_login_info_alloc ()
void | ags_login_info_free ()
void | ags_login_info_ref ()
void | ags_login_info_unref ()
GList * | ags_authentication_manager_get_authentication ()
void | ags_authentication_manager_add_authentication ()
void | ags_authentication_manager_remove_authentication ()
gint64 | ags_authentication_manager_get_session_timeout ()
AgsLoginInfo * | ags_authentication_manager_lookup_login ()
void | ags_authentication_manager_insert_login ()
void | ags_authentication_manager_remove_login ()
gboolean | ags_authentication_manager_login ()
gboolean | ags_authentication_manager_logout ()
gchar * | ags_authentication_manager_get_digest ()
gboolean | ags_authentication_manager_is_session_active ()
AgsAuthenticationManager * | ags_authentication_manager_get_instance ()
AgsAuthenticationManager * | ags_authentication_manager_new ()

## Types and Values

#define | AGS_AUTHENTICATION_MANAGER_DEFAULT_SESSION_TIMEOUT
struct | AgsLoginInfo

## Object Hierarchy

        GObject
        ╰── AgsAuthenticationManager

## Includes

    #include <ags/server/security/ags_authentication_manager.h>

## Description

The AgsAuthenticationManager manages your authentication.

## Functions

### AGS_LOGIN_INFO()

    #define AGS_LOGIN_INFO(ptr) ((AgsLoginInfo *) ptr)

### AGS_AUTHENTICATION_MANAGER_GET_OBJ_MUTEX()

    #define AGS_AUTHENTICATION_MANAGER_GET_OBJ_MUTEX(obj) (&(((AgsAuthenticationManager *) obj)->obj_mutex))

### ags_login_info_alloc ()

    AgsLoginInfo *
    ags_login_info_alloc ();

Alloc AgsLoginInfo.

#### Returns

the newly allocated AgsLoginInfo.

[type gpointer][transfer none]

Since: 3.0.0

### ags_login_info_free ()

    void
    ags_login_info_free (AgsLoginInfo *login_info);

Free `login_info` .

#### Parameters

login_info | the AgsLoginInfo. | [type gpointer]

Since: 3.0.0

### ags_login_info_ref ()

    void
    ags_login_info_ref (AgsLoginInfo *login_info);

Increase ref-count of `login_info` .

#### Parameters

login_info | the AgsLoginInfo. | [type gpointer]

Since: 3.0.0

### ags_login_info_unref ()

    void
    ags_login_info_unref (AgsLoginInfo *login_info);

Decrease ref-count of `login_info` and free it if ref-count drops to 0.

#### Parameters

login_info | the AgsLoginInfo. | [type gpointer]

Since: 3.0.0

### ags_authentication_manager_get_authentication ()

    GList *
    ags_authentication_manager_get_authentication
                                   (AgsAuthenticationManager *authentication_manager);

Get authentication.

#### Parameters

authentication_manager | the AgsAuthenticationManager |

#### Returns

the GList containing GObject implementing AgsAuthentication.

[element-type GObject][transfer full]

Since: 3.0.0

### ags_authentication_manager_add_authentication ()

    void
    ags_authentication_manager_add_authentication
                                   (AgsAuthenticationManager *authentication_manager,
                                    GObject *authentication);

Add `authentication` to `authentication_manager` .

#### Parameters

authentication_manager | the AgsAuthenticationManager |
authentication | the GObject implementing AgsAuthentication |

Since: 3.0.0

### ags_authentication_manager_remove_authentication ()

    void
    ags_authentication_manager_remove_authentication
                                   (AgsAuthenticationManager *authentication_manager,
                                    GObject *authentication);

Remove `authentication` from `authentication_manager` .

#### Parameters

authentication_manager | the AgsAuthenticationManager |
authentication | the GObject implementing AgsAuthentication |

Since: 3.0.0

### ags_authentication_manager_get_session_timeout ()

    gint64
    ags_authentication_manager_get_session_timeout
                                   (AgsAuthenticationManager *authentication_manager);

Get session timeout.

#### Parameters

authentication_manager | the AgsAuthenticationManager |

#### Returns

the session timeout

Since: 3.0.0

### ags_authentication_manager_lookup_login ()

    AgsLoginInfo *
    ags_authentication_manager_lookup_login
                                   (AgsAuthenticationManager *authentication_manager,
                                    gchar *login);

Lookup `login` .

#### Parameters

authentication_manager | the AgsAuthenticationManager |
login | the login |

#### Returns

the user AgsLoginInfo or `NULL`.

[type gpointer][transfer none]

Since: 3.0.0

### ags_authentication_manager_insert_login ()

    void
    ags_authentication_manager_insert_login
                                   (AgsAuthenticationManager *authentication_manager,
                                    gchar *login,
                                    AgsLoginInfo *login_info);

Insert `login` as key and `login_info` as its value.

#### Parameters

authentication_manager | the AgsAuthenticationManager |
login | the login |
login_info | the AgsLoginInfo |

Since: 3.0.0

### ags_authentication_manager_remove_login ()

    void
    ags_authentication_manager_remove_login
                                   (AgsAuthenticationManager *authentication_manager,
                                    gchar *login);

Remove `login` .

#### Parameters

authentication_manager | the AgsAuthenticationManager |
login | the login |

Since: 3.0.0

### ags_authentication_manager_login ()

    gboolean
    ags_authentication_manager_login (AgsAuthenticationManager *authentication_manager,
                                      gchar *authentication_module,
                                      gchar *login,
                                      gchar *password,
                                      gchar **user_uuid,
                                      gchar **security_token);

Login.

#### Parameters

authentication_manager | the AgsAuthenticationManager |
authentication_module | the authentication module |
login | the login |
password | the password |
user_uuid | return location of user UUID. | [out][transfer full]
security_token | return location of security token. | [out][transfer full]

#### Returns

`TRUE` if login was successful, otherwise `FALSE`

Since: 3.0.0

### ags_authentication_manager_logout ()

    gboolean
    ags_authentication_manager_logout (AgsAuthenticationManager *authentication_manager,
                                       GObject *security_context,
                                       gchar *login,
                                       gchar *security_token);

Logout.

#### Parameters

authentication_manager | the AgsAuthenticationManager |
security_context | the AgsSecurityContext |
login | the login |
security_token | the security token |

#### Returns

`TRUE` if logout was successful, otherwise `FALSE`

Since: 3.0.0

### ags_authentication_manager_get_digest ()

    gchar *
    ags_authentication_manager_get_digest (AgsAuthenticationManager *authentication_manager,
                                           gchar *authentication_module,
                                           gchar *realm,
                                           gchar *login,
                                           gchar *security_token);

Get digest of `login` .

#### Parameters

authentication_manager | the AgsAuthenticationManager |
authentication_module | the authentication module |
realm | the realm |
login | the login |
security_token | the security token |

#### Returns

the digest as string, or `NULL` if not available.

[transfer full]

Since: 3.0.0

### ags_authentication_manager_is_session_active ()

    gboolean
    ags_authentication_manager_is_session_active
                                   (AgsAuthenticationManager *authentication_manager,
                                    GObject *security_context,
                                    gchar *user_uuid,
                                    gchar *security_token);

Check if session is active.

#### Parameters

authentication_manager | the AgsAuthenticationManager |
security_context | the security context |
user_uuid | the user's UUID |
security_token | the security token |

#### Returns

`TRUE` if active, otherwise `FALSE`

Since: 3.0.0

### ags_authentication_manager_get_instance ()

    AgsAuthenticationManager *
    ags_authentication_manager_get_instance
                                   ();

Get instance.

#### Returns

the AgsAuthenticationManager.

[transfer none]

Since: 3.0.0

### ags_authentication_manager_new ()

    AgsAuthenticationManager *
    ags_authentication_manager_new ();

Creates an AgsAuthenticationManager

#### Returns

a new AgsAuthenticationManager

Since: 3.0.0

## Types and Values

### AGS_AUTHENTICATION_MANAGER_DEFAULT_SESSION_TIMEOUT

    #define AGS_AUTHENTICATION_MANAGER_DEFAULT_SESSION_TIMEOUT (2 * G_TIME_SPAN_HOUR)

### struct AgsLoginInfo

    struct AgsLoginInfo {
      gint ref_count;
      gint active_session_count;

      gchar *user_uuid;

      AgsSecurityContext *security_context;
    };