MySQL 9.1.0
Source Code Documentation
authentication_openid_connect_client_plugin.cc File Reference
#include <my_dir.h>
#include <my_sys.h>
#include <mysql/client_plugin.h>
#include <mysql/service_mysql_alloc.h>
#include <fstream>
#include <iostream>
#include "mysql_com.h"

Macros

#define MAX_MESSAGE_SIZE   20000
 

Functions

void log_error (const std::string &message)
 Log error message to client. More...
 
void free_plugin_option (char *&option)
 Free plugin option. More...
 
bool get_part (std::string &jwt, std::string &part)
 Extract a part from JWT. More...
 
bool get_jwt_parts (std::string jwt, std::string &head, std::string &body, std::string &sig)
 Extract head, body and signature from JWT. More...
 
static int openid_connect_authentication_client_plugin (MYSQL_PLUGIN_VIO *vio, MYSQL *)
 client auth function More...
 
static int initialize_plugin (char *, size_t, int, va_list)
 
static int authentication_openid_connect_client_option (const char *option, const void *val)
 authentication_openid_connect_client_option plugin API to allow server to pass optional data for plugin to process More...
 
 mysql_declare_client_plugin (AUTHENTICATION) "authentication_openid_connect_client"
 

Variables

static char * s_id_token_location = nullptr
 
static const int s_max_token_size = 10000
 
static constexpr const char * base64url_chars
 
 MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE
 
OpenID Connect Client Authentication Plugin
 
OpenID Connect Client Authentication COMMUNITY
 
OpenID Connect Client Authentication nullptr
 
OpenID Connect Client Authentication initialize_plugin
 
OpenID Connect Client Authentication deinitialize_plugin
 
OpenID Connect Client Authentication authentication_openid_connect_client_option
 
OpenID Connect Client Authentication openid_connect_authentication_client_plugin
 
OpenID Connect Client Authentication nullptr mysql_end_client_plugin
 

Macro Definition Documentation

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   20000

Function Documentation

◆ authentication_openid_connect_client_option()

static int authentication_openid_connect_client_option ( const char *  option,
const void *  val 
)
static

authentication_openid_connect_client_option plugin API to allow server to pass optional data for plugin to process

◆ free_plugin_option()

void free_plugin_option ( char *&  option)
inline

Free plugin option.

Parameters
[in]optionPlugin option to be freed

◆ get_jwt_parts()

bool get_jwt_parts ( std::string  jwt,
std::string &  head,
std::string &  body,
std::string &  sig 
)

Extract head, body and signature from JWT.

Parameters
[in]jwtJSON Web Token
[out]headToken's head
[out]bodyToken's body
[out]sigToken's signature
Returns
Success status
Return values
falseSuccess
trueFailure

◆ get_part()

bool get_part ( std::string &  jwt,
std::string &  part 
)

Extract a part from JWT.

Parameters
[in]jwtJSON Web Token
[out]partPart extracted
Returns
Success status
Return values
falseSuccess
trueFailure

◆ initialize_plugin()

static int initialize_plugin ( char *  ,
size_t  ,
int  ,
va_list   
)
static

◆ log_error()

void log_error ( const std::string &  message)

Log error message to client.

Parameters
[in]messageMessage to be displayed

◆ mysql_declare_client_plugin()

mysql_declare_client_plugin ( AUTHENTICATION  )

◆ openid_connect_authentication_client_plugin()

static int openid_connect_authentication_client_plugin ( MYSQL_PLUGIN_VIO vio,
MYSQL  
)
static

client auth function

read stuff via the VIO. try to read first get (login) data from the MYSQL handle: mysql->user, mysql->passwd return CR_OK on success, CR_ERROR on failure

Step 1: Read the id token.

Step 2: Check if connection is secure.

Step 3: Send the id token to the server for verification.

Variable Documentation

◆ authentication_openid_connect_client_option

OpenID Connect Client Authentication authentication_openid_connect_client_option

◆ base64url_chars

constexpr const char* base64url_chars
staticconstexpr
Initial value:
{
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+/-_="}

◆ COMMUNITY

OpenID Connect Client Authentication COMMUNITY

◆ deinitialize_plugin

OpenID Connect Client Authentication deinitialize_plugin

◆ initialize_plugin

OpenID Connect Client Authentication initialize_plugin

◆ MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

◆ mysql_end_client_plugin

OpenID Connect Client Authentication nullptr mysql_end_client_plugin

◆ nullptr

OpenID Connect Client Authentication nullptr

◆ openid_connect_authentication_client_plugin

OpenID Connect Client Authentication openid_connect_authentication_client_plugin

◆ Plugin

OpenID Connect Client Authentication Plugin

◆ s_id_token_location

char* s_id_token_location = nullptr
static

◆ s_max_token_size

const int s_max_token_size = 10000
static