Requests authentication. More...
#include <string.h>
#include <openssl/hmac.h>
#include "auth.h"
#include "debug.h"
#include "mutex.h"
#include "utils.h"
Functions | |
void | janus_auth_init (gboolean enabled, const char *secret) |
Method to initializing the token based authentication. | |
gboolean | janus_auth_is_enabled (void) |
Method to check whether the mechanism is enabled or not. | |
gboolean | janus_auth_is_stored_mode (void) |
Method to check whether the mechanism is in stored-token mode or not. | |
gboolean | janus_auth_is_signed_mode (void) |
Method to check whether the mechanism is in signed-token mode or not. | |
void | janus_auth_deinit (void) |
Method to de-initialize the mechanism. | |
gboolean | janus_auth_check_signature (const char *token, const char *realm) |
Method to check whether a signed token is valid. | |
gboolean | janus_auth_check_signature_contains (const char *token, const char *realm, const char *desc) |
Method to verify a signed token contains a descriptor. | |
gboolean | janus_auth_add_token (const char *token) |
Method to add a new valid token for authenticating. | |
gboolean | janus_auth_check_token (const char *token) |
Method to check whether a provided token is valid or not. | |
GList * | janus_auth_list_tokens (void) |
Method to return a list of the tokens. | |
gboolean | janus_auth_remove_token (const char *token) |
Method to invalidate an existing token. | |
gboolean | janus_auth_allow_plugin (const char *token, janus_plugin *plugin) |
Method to allow a token to use a plugin. | |
gboolean | janus_auth_check_plugin (const char *token, janus_plugin *plugin) |
Method to check whether a provided token can access a specified plugin. | |
GList * | janus_auth_list_plugins (const char *token) |
Method to return a list of the plugins a specific token has access to. | |
gboolean | janus_auth_disallow_plugin (const char *token, janus_plugin *plugin) |
Method to disallow a token to use a plugin. | |
Requests authentication.
Implementation of simple mechanisms for authenticating requests.
If enabled (it's disabled by default), each request must contain a valid token string, * or otherwise the request is rejected with an error.
When no token_auth_secret
is set, Stored-token mode is active. In this mode the Janus admin API can be used to specify valid string tokens. 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.
However, if a secret is set, the Signed-token mode is used. In this mode, no direct communication between the controlling application and Janus is necessary. Instead, the application signs tokens that Janus can verify using the secret key.
gboolean janus_auth_add_token | ( | const char * | token | ) |
Method to add a new valid token for authenticating.
[in] | token | The new valid token |
gboolean janus_auth_allow_plugin | ( | const char * | token, |
janus_plugin * | plugin ) |
Method to allow a token to use a plugin.
[in] | token | The token that can now access this plugin |
[in] | plugin | Opaque pointer to the janus_plugin instance this token can access |
gboolean janus_auth_check_plugin | ( | const char * | token, |
janus_plugin * | plugin ) |
Method to check whether a provided token can access a specified plugin.
[in] | token | The token to check |
[in] | plugin | The plugin to check as an opaque pointer to a janus_plugin instance |
gboolean janus_auth_check_signature | ( | const char * | token, |
const char * | realm ) |
Method to check whether a signed token is valid.
[in] | token | The token to validate |
[in] | realm | The token realm |
gboolean janus_auth_check_signature_contains | ( | const char * | token, |
const char * | realm, | ||
const char * | desc ) |
Method to verify a signed token contains a descriptor.
[in] | token | The token to validate |
[in] | realm | The token realm |
[in] | desc | The descriptor to search for |
gboolean janus_auth_check_token | ( | const char * | token | ) |
Method to check whether a provided token is valid or not.
[in] | token | The token to validate |
void janus_auth_deinit | ( | void | ) |
Method to de-initialize the mechanism.
gboolean janus_auth_disallow_plugin | ( | const char * | token, |
janus_plugin * | plugin ) |
Method to disallow a token to use a plugin.
[in] | token | The token this operation refers to |
[in] | plugin | Opaque pointer to the janus_plugin instance this token can not access anymore |
void janus_auth_init | ( | gboolean | enabled, |
const char * | secret ) |
Method to initializing the token based authentication.
[in] | enabled | Whether the authentication mechanism should be enabled or not |
[in] | secret | the secret to validate signed tokens against, or NULL to use stored tokens |
gboolean janus_auth_is_enabled | ( | void | ) |
Method to check whether the mechanism is enabled or not.
gboolean janus_auth_is_signed_mode | ( | void | ) |
Method to check whether the mechanism is in signed-token mode or not.
gboolean janus_auth_is_stored_mode | ( | void | ) |
Method to check whether the mechanism is in stored-token mode or not.
GList * janus_auth_list_plugins | ( | const char * | token | ) |
Method to return a list of the plugins a specific token has access to.
[in] | token | The token to get the list for |
GList * janus_auth_list_tokens | ( | void | ) |
Method to return a list of the tokens.
gboolean janus_auth_remove_token | ( | const char * | token | ) |
Method to invalidate an existing token.
[in] | token | The valid to invalidate |