Fork me on GitHub
Functions
auth.c File Reference

Requests authentication. More...

#include "auth.h"
#include "debug.h"
#include "mutex.h"
Include dependency graph for auth.c:

Functions

void janus_auth_init (gboolean enabled)
 Method to initializing the token based authentication. More...
 
gboolean janus_auth_is_enabled (void)
 Method to check whether the mechanism is enabled or not. More...
 
void janus_auth_deinit (void)
 Method to de-initialize the mechanism. More...
 
gboolean janus_auth_add_token (const char *token)
 Method to add a new valid token for authenticating. More...
 
gboolean janus_auth_check_token (const char *token)
 Method to check whether a provided token is valid or not. More...
 
GList * janus_auth_list_tokens (void)
 Method to return a list of the tokens. More...
 
gboolean janus_auth_remove_token (const char *token)
 Method to invalidate an existing token. More...
 
gboolean janus_auth_allow_plugin (const char *token, void *plugin)
 Method to allow a token to use a plugin. More...
 
gboolean janus_auth_check_plugin (const char *token, void *plugin)
 Method to check whether a provided token can access a specified plugin. More...
 
GList * janus_auth_list_plugins (const char *token)
 Method to return a list of the plugins a specific token has access to. More...
 
gboolean janus_auth_disallow_plugin (const char *token, void *plugin)
 Method to disallow a token to use a plugin. More...
 

Detailed Description

Requests authentication.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of a simple mechanism for authenticating requests. If enabled (it's disabled by default), the Janus admin API can be used to specify valid tokens; each request must then contain a valid token string, or otherwise the request is rejected with an error. Whether tokens should be shared across users or not is completely up to the controlling application: these tokens are completely opaque to Janus, and treated as strings, which means Janus will only check if the token exists or not when asked.

Core

Function Documentation

◆ janus_auth_add_token()

gboolean janus_auth_add_token ( const char *  token)

Method to add a new valid token for authenticating.

Parameters
[in]tokenThe new valid token
Returns
true if the operation was successful, false otherwise

◆ janus_auth_allow_plugin()

gboolean janus_auth_allow_plugin ( const char *  token,
void *  plugin 
)

Method to allow a token to use a plugin.

Parameters
[in]tokenThe token that can now access this plugin
[in]pluginOpaque pointer to the janus_plugin instance this token can access
Returns
true if the operation was successful, false otherwise

◆ janus_auth_check_plugin()

gboolean janus_auth_check_plugin ( const char *  token,
void *  plugin 
)

Method to check whether a provided token can access a specified plugin.

Parameters
[in]tokenThe token to check
[in]pluginThe plugin to check as an opaque pointer to a janus_plugin instance
Returns
true if the token is allowed to access the plugin, false otherwise

◆ janus_auth_check_token()

gboolean janus_auth_check_token ( const char *  token)

Method to check whether a provided token is valid or not.

Parameters
[in]tokenThe token to validate
Returns
true if the token is valid, false otherwise

◆ janus_auth_deinit()

void janus_auth_deinit ( void  )

Method to de-initialize the mechanism.

◆ janus_auth_disallow_plugin()

gboolean janus_auth_disallow_plugin ( const char *  token,
void *  plugin 
)

Method to disallow a token to use a plugin.

Parameters
[in]tokenThe token this operation refers to
[in]pluginOpaque pointer to the janus_plugin instance this token can not access anymore
Returns
true if the operation was successful, false otherwise

◆ janus_auth_init()

void janus_auth_init ( gboolean  enabled)

Method to initializing the token based authentication.

Parameters
[in]enabledWhether the authentication mechanism should be enabled or not

◆ janus_auth_is_enabled()

gboolean janus_auth_is_enabled ( void  )

Method to check whether the mechanism is enabled or not.

◆ janus_auth_list_plugins()

GList* janus_auth_list_plugins ( const char *  token)

Method to return a list of the plugins a specific token has access to.

Note
It's the caller responsibility to free the list (but NOT the values)
Parameters
[in]tokenThe token to get the list for
Returns
A pointer to a GList instance containing the liist

◆ janus_auth_list_tokens()

GList* janus_auth_list_tokens ( void  )

Method to return a list of the tokens.

Note
It's the caller responsibility to free the list and its values
Returns
A pointer to a GList instance containing the tokens

◆ janus_auth_remove_token()

gboolean janus_auth_remove_token ( const char *  token)

Method to invalidate an existing token.

Parameters
[in]tokenThe valid to invalidate
Returns
true if the operation was successful, false otherwise