Iddawc: Get or set struct _i_session properties

Iddawc Handle the flow of OAuth2 and OpenID Connect authentication process from the client side.

Functions
Get or set struct _i_session properties

## Functions
int | i_set_response_type (struct _i_session *i_session, uint i_value)
int | i_set_result (struct _i_session *i_session, uint i_value)
int | i_set_int_parameter (struct _i_session *i_session, i_option option, uint i_value)
int | i_set_str_parameter (struct _i_session *i_session, i_option option, const char *s_value)
int | i_set_additional_parameter (struct _i_session *i_session, const char *s_key, const char *s_value)
int | i_set_additional_response (struct _i_session *i_session, const char *s_key, const char *s_value)
int | i_add_claim_request (struct _i_session *i_session, int target, const char *claim, int essential, const char *value)
int | i_remove_claim_request (struct _i_session *i_session, int target, const char *claim)
int | i_set_rich_authorization_request_json_t (struct _i_session *i_session, const char *type, json_t *j_value)
int | i_set_rich_authorization_request_str (struct _i_session *i_session, const char *type, const char *value)
int | i_remove_rich_authorization_request (struct _i_session *i_session, const char *type)
json_t * | i_get_rich_authorization_request_json_t (struct _i_session *i_session, const char *type)
char * | i_get_rich_authorization_request_str (struct _i_session *i_session, const char *type)
uint | i_get_response_type (struct _i_session *i_session)
uint | i_get_result (struct _i_session *i_session)
uint | i_get_int_parameter (struct _i_session *i_session, i_option option)
const char * | i_get_str_parameter (struct _i_session *i_session, i_option option)
const char * | i_get_additional_parameter (struct _i_session *i_session, const char *s_key)
const char * | i_get_additional_response (struct _i_session *i_session, const char *s_key)
json_t * | i_get_server_configuration (struct _i_session *i_session)
json_t * | i_get_server_jwks (struct _i_session *i_session)
int | i_set_server_jwks (struct _i_session *i_session, json_t *j_jwks)
json_t * | i_get_client_jwks (struct _i_session *i_session)
int | i_set_client_jwks (struct _i_session *i_session, json_t *j_jwks)
int | i_set_parameter_list (struct _i_session *i_session,...)
json_t * | i_export_session_json_t (struct _i_session *i_session)
int | i_import_session_json_t (struct _i_session *i_session, json_t *j_import)
char * | i_export_session_str (struct _i_session *i_session)
int | i_import_session_str (struct _i_session *i_session, const char *str_import)

## Detailed Description

Manipulates inner data of the session

## Function Documentation

## ◆ i_set_response_type()

int i_set_response_type | ( | struct _i_session * | i_session,
|  | uint | i_value
| ) |  |

Sets response type of a session

Parameters

  i_session | a reference to a struct _i_session *
  i_value | the response type values available are I_RESPONSE_TYPE_NONE, I_RESPONSE_TYPE_CODE, I_RESPONSE_TYPE_TOKEN, I_RESPONSE_TYPE_ID_TOKEN, I_RESPONSE_TYPE_PASSWORD, I_RESPONSE_TYPE_CLIENT_CREDENTIALS, I_RESPONSE_TYPE_REFRESH_TOKEN and I_RESPONSE_TYPE_DEVICE_CODE Values I_RESPONSE_TYPE_CODE, I_RESPONSE_TYPE_TOKEN and I_RESPONSE_TYPE_ID_TOKEN can be stacked if using hybrid flow, example: I_RESPONSE_TYPE_CODE | I_RESPONSE_TYPE_TOKEN | I_RESPONSE_TYPE_ID_TOKEN

Returns
  I_OK on success, an error value on error

## ◆ i_set_result()

int i_set_result | ( | struct _i_session * | i_session,
|  | uint | i_value
| ) |  |

Sets the result of a request

Parameters

  i_session | a reference to a struct _i_session *
  i_value | the result value Values available are I_OK, I_ERROR, I_ERROR_PARAM, I_ERROR_MEMORY, I_ERROR_UNAUTHORIZED orI_ERROR_SERVER

Returns
  I_OK on success, an error value on error

## ◆ i_set_int_parameter()

int i_set_int_parameter | ( | struct _i_session * | i_session,
|  | i_option | option,
|  | uint | i_value
| ) |  |

Sets an unsigned integer property value

Parameters

  i_session | a reference to a struct _i_session *
  option | the option to set options availble are I_OPT_RESULT, I_OPT_AUTH_METHOD, I_OPT_TOKEN_METHOD, I_OPT_EXPIRES_IN, I_OPT_EXPIRES_AT, I_OPT_STATE_GENERATE, I_OPT_NONCE_GENERATE, I_OPT_X5U_FLAGS, I_OPT_OPENID_CONFIG_STRICT, I_OPT_TOKEN_JTI_GENERATE, I_OPT_TOKEN_EXP, I_OPT_DEVICE_AUTH_EXPIRES_IN, I_OPT_DEVICE_AUTH_INTERVAL, I_OPT_PUSHED_AUTH_REQ_REQUIRED, I_OPT_PUSHED_AUTH_REQ_EXPIRES_IN, I_OPT_USE_DPOP, I_OPT_DECRYPT_CODE, I_OPT_DECRYPT_REFRESH_TOKEN, I_OPT_DECRYPT_ACCESS_TOKEN, I_OPT_REMOTE_CERT_FLAG, I_OPT_PKCE_CODE_VERIFIER_GENERATE, I_OPT_PKCE_METHOD
  i_value | The unsigned integer value to set

Returns
  I_OK on success, an error value on error

## ◆ i_set_str_parameter()

int i_set_str_parameter | ( | struct _i_session * | i_session,
|  | i_option | option,
|  | const char * | s_value
| ) |  |

Sets a char * property value

Parameters

  i_session | a reference to a struct _i_session *
  option | the option to set options available are I_OPT_SCOPE, I_OPT_SCOPE_APPEND, I_OPT_STATE, I_OPT_NONCE, I_OPT_REDIRECT_URI, I_OPT_REDIRECT_TO, I_OPT_CLIENT_ID, I_OPT_CLIENT_SECRET, I_OPT_AUTH_ENDPOINT, I_OPT_TOKEN_ENDPOINT, I_OPT_OPENID_CONFIG_ENDPOINT, I_OPT_OPENID_CONFIG, I_OPT_USERINFO_ENDPOINT, I_OPT_ERROR, I_OPT_ERROR_DESCRIPTION, I_OPT_ERROR_URI, I_OPT_CODE, I_OPT_REFRESH_TOKEN, I_OPT_ACCESS_TOKEN, I_OPT_ID_TOKEN, I_OPT_TOKEN_TYPE, I_OPT_USERNAME, I_OPT_USER_PASSWORD, I_OPT_ISSUER, I_OPT_USERINFO, I_OPT_SERVER_KID, I_OPT_SERVER_ENC_ALG, I_OPT_SERVER_ENC, I_OPT_CLIENT_KID, I_OPT_CLIENT_SIGN_ALG, I_OPT_CLIENT_ENC_ALG, I_OPT_CLIENT_ENC, I_OPT_TOKEN_JTI, I_OPT_TOKEN_TARGET, I_OPT_TOKEN_TARGET_TYPE_HINT, I_OPT_REVOCATION_ENDPOINT, I_OPT_INTROSPECTION_ENDPOINT, I_OPT_REGISTRATION_ENDPOINT, I_OPT_DEVICE_AUTHORIZATION_ENDPOINT, I_OPT_DEVICE_AUTH_CODE, I_OPT_DEVICE_AUTH_USER_CODE, I_OPT_DEVICE_AUTH_VERIFICATION_URI, I_OPT_DEVICE_AUTH_VERIFICATION_URI_COMPLETE, I_OPT_END_SESSION_ENDPOINT, I_OPT_CHECK_SESSION_IRAME, I_OPT_PUSHED_AUTH_REQ_ENDPOINT, I_OPT_PUSHED_AUTH_REQ_URI, I_OPT_DPOP_KID, I_OPT_DPOP_SIGN_ALG, I_OPT_TLS_KEY_FILE, I_OPT_TLS_CERT_FILE, I_OPT_PKCE_CODE_VERIFIER, I_OPT_RESOURCE_INDICATOR
  s_value | The const char * value to set

Returns
  I_OK on success, an error value on error

## ◆ i_set_additional_parameter()

int i_set_additional_parameter | ( | struct _i_session * | i_session,
|  | const char * | s_key,
|  | const char * | s_value
| ) |  |

Sets an additional parameter for auth or token requests

Parameters

  i_session | a reference to a struct _i_session *
  s_key | the key to set
  s_value | the value to set

Returns
  I_OK on success, an error value on error

## ◆ i_set_additional_response()

int i_set_additional_response | ( | struct _i_session * | i_session,
|  | const char * | s_key,
|  | const char * | s_value
| ) |  |

Sets an additional response value

Parameters

  i_session | a reference to a struct _i_session *
  s_key | the key to set
  s_value | the value to set

Returns
  I_OK on success, an error value on error

## ◆ i_add_claim_request()

int i_add_claim_request | ( | struct _i_session * | i_session,
|  | int | target,
|  | const char * | claim,
|  | int | essential,
|  | const char * | value
| ) |  |

Adds a claim to the request

Parameters

  i_session | a reference to a struct _i_session *
  target | where the claim should be returned, values available are I_CLAIM_TARGET_ALL, I_CLAIM_TARGET_USERINFO or I_CLAIM_TARGET_ID_TOKEN
  claim | the name of the claim
  essential | is the claim essential value set or null values available are I_CLAIM_ESSENTIAL_NULL, I_CLAIM_ESSENTIAL_TRUE, I_CLAIM_ESSENTIAL_FALSE or I_CLAIM_ESSENTIAL_IGNORE
  value | will override essential parameter if set, sets the claim value with the content of the value parsed in JSON

Returns
  I_OK on success, an error value on error

## ◆ i_remove_claim_request()

int i_remove_claim_request | ( | struct _i_session * | i_session,
|  | int | target,
|  | const char * | claim
| ) |  |

Removes a claim from the request

Parameters

  i_session | a reference to a struct _i_session *
  target | where the claim should be returned, values available are I_CLAIM_TARGET_ALL, I_CLAIM_TARGET_USERINFO or I_CLAIM_TARGET_ID_TOKEN
  claim | the name of the claim to remove

Returns
  I_OK on success, an error value on error

## ◆ i_set_rich_authorization_request_json_t()

int i_set_rich_authorization_request_json_t | ( | struct _i_session * | i_session,
|  | const char * | type,
|  | json_t * | j_value
| ) |  |

Adds an rich authorization request object in JSON format or replace it if the type already exists

Parameters

  i_session | a reference to a struct _i_session *
  type | the type of the authorization request
  j_value | the authorization request, must be a JSON object

Returns
  I_OK on success, an error value on error

## ◆ i_set_rich_authorization_request_str()

int i_set_rich_authorization_request_str | ( | struct _i_session * | i_session,
|  | const char * | type,
|  | const char * | value
| ) |  |

Adds an rich authorization request object in stringified JSON format or replace it if the type already exists

Parameters

  i_session | a reference to a struct _i_session *
  type | the type of the authorization request
  value | the authorization request, must be a stringified JSON object

Returns
  I_OK on success, an error value on error

## ◆ i_remove_rich_authorization_request()

int i_remove_rich_authorization_request | ( | struct _i_session * | i_session,
|  | const char * | type
| ) |  |

Remove an authorization request object based on the type

Parameters

  i_session | a reference to a struct _i_session *
  type | the type of the authorization request

Returns
  I_OK on success, an error value on error

## ◆ i_get_rich_authorization_request_json_t()

json_t * i_get_rich_authorization_request_json_t | ( | struct _i_session * | i_session,
|  | const char * | type
| ) |  |

Returns an authorization request object based on the type

Parameters

  i_session | a reference to a struct _i_session *
  type | the type of the authorization request

Returns
  a json_t * containing a JSON authorization request, or NULL if not found, must be i_free'd after use

## ◆ i_get_rich_authorization_request_str()

char * i_get_rich_authorization_request_str | ( | struct _i_session * | i_session,
|  | const char * | type
| ) |  |

Returns an authorization request object based on the type

Parameters

  i_session | a reference to a struct _i_session *
  type | the type of the authorization request

Returns
  a char * containing a JSON stringified authorization request, or NULL if not found, must be i_free'd after use

## ◆ i_get_response_type()

uint i_get_response_type | ( | struct _i_session * | i_session | ) |

Returns the response type of the current session

Parameters

  i_session | a reference to a struct _i_session *

Returns
  a value among the following: I_RESPONSE_TYPE_NONE, I_RESPONSE_TYPE_CODE, I_RESPONSE_TYPE_TOKEN, I_RESPONSE_TYPE_ID_TOKEN, I_RESPONSE_TYPE_PASSWORD, I_RESPONSE_TYPE_CLIENT_CREDENTIALS and I_RESPONSE_TYPE_REFRESH_TOKEN Values I_RESPONSE_TYPE_CODE, I_RESPONSE_TYPE_TOKEN and I_RESPONSE_TYPE_ID_TOKEN can be stacked if using hybrid flow, example: I_RESPONSE_TYPE_CODE | I_RESPONSE_TYPE_TOKEN | I_RESPONSE_TYPE_ID_TOKEN

## ◆ i_get_result()

uint i_get_result | ( | struct _i_session * | i_session | ) |

Returns the result of the last oauth2 request

Parameters

  i_session | a reference to a struct _i_session *

Returns
  I_OK on success, an error value on error

## ◆ i_get_int_parameter()

uint i_get_int_parameter | ( | struct _i_session * | i_session,
|  | i_option | option
| ) |  |

Returns the integer value of an option

Parameters

  i_session | a reference to a struct _i_session *
  option | the option to get options availble are I_OPT_RESULT, I_OPT_AUTH_METHOD, I_OPT_TOKEN_METHOD, I_OPT_EXPIRES_IN, I_OPT_EXPIRES_AT, I_OPT_STATE_GENERATE, I_OPT_NONCE_GENERATE, I_OPT_X5U_FLAGS, I_OPT_OPENID_CONFIG_STRICT, I_OPT_TOKEN_JTI_GENERATE, I_OPT_TOKEN_EXP, I_OPT_DEVICE_AUTH_EXPIRES_IN, I_OPT_DEVICE_AUTH_INTERVAL, I_OPT_PUSHED_AUTH_REQ_REQUIRED, I_OPT_PUSHED_AUTH_REQ_EXPIRES_IN, I_OPT_USE_DPOP, I_OPT_DECRYPT_CODE, I_OPT_DECRYPT_REFRESH_TOKEN, I_OPT_DECRYPT_ACCESS_TOKEN, I_OPT_REMOTE_CERT_FLAG, I_OPT_PKCE_CODE_VERIFIER_GENERATE, I_OPT_PKCE_METHOD

Returns
  the option value

## ◆ i_get_str_parameter()

const char * i_get_str_parameter | ( | struct _i_session * | i_session,
|  | i_option | option
| ) |  |

Returns the char * value of an option

Parameters

  i_session | a reference to a struct _i_session *
  option | the option to get options available are I_OPT_SCOPE, I_OPT_SCOPE_APPEND, I_OPT_STATE, I_OPT_NONCE, I_OPT_REDIRECT_URI, I_OPT_REDIRECT_TO, I_OPT_CLIENT_ID, I_OPT_CLIENT_SECRET, I_OPT_AUTH_ENDPOINT, I_OPT_TOKEN_ENDPOINT, I_OPT_OPENID_CONFIG_ENDPOINT, I_OPT_OPENID_CONFIG, I_OPT_USERINFO_ENDPOINT, I_OPT_ERROR, I_OPT_ERROR_DESCRIPTION, I_OPT_ERROR_URI, I_OPT_CODE, I_OPT_REFRESH_TOKEN, I_OPT_ACCESS_TOKEN, I_OPT_ID_TOKEN, I_OPT_TOKEN_TYPE, I_OPT_USERNAME, I_OPT_USER_PASSWORD, I_OPT_ISSUER, I_OPT_USERINFO, I_OPT_SERVER_KID, I_OPT_SERVER_ENC_ALG, I_OPT_SERVER_ENC, I_OPT_CLIENT_KID, I_OPT_CLIENT_SIGN_ALG, I_OPT_CLIENT_ENC_ALG, I_OPT_CLIENT_ENC, I_OPT_TOKEN_JTI, I_OPT_TOKEN_TARGET, I_OPT_TOKEN_TARGET_TYPE_HINT, I_OPT_REVOCATION_ENDPOINT, I_OPT_INTROSPECTION_ENDPOINT, I_OPT_REGISTRATION_ENDPOINT, I_OPT_DEVICE_AUTHORIZATION_ENDPOINT, I_OPT_DEVICE_AUTH_CODE, I_OPT_DEVICE_AUTH_USER_CODE, I_OPT_DEVICE_AUTH_VERIFICATION_URI, I_OPT_DEVICE_AUTH_VERIFICATION_URI_COMPLETE, I_OPT_END_SESSION_ENDPOINT, I_OPT_CHECK_SESSION_IRAME, I_OPT_PUSHED_AUTH_REQ_ENDPOINT, I_OPT_PUSHED_AUTH_REQ_URI, I_OPT_DPOP_KID, I_OPT_DPOP_SIGN_ALG, I_OPT_TLS_KEY_FILE, I_OPT_TLS_CERT_FILE, I_OPT_PKCE_CODE_VERIFIER, I_OPT_RESOURCE_INDICATOR

Returns
  the char * value of the option, NULL if no value set

## ◆ i_get_additional_parameter()

const char * i_get_additional_parameter | ( | struct _i_session * | i_session,
|  | const char * | s_key
| ) |  |

Gets an additional parameter for auth or token requests

Parameters

  i_session | a reference to a struct _i_session *
  s_key | the key to get

Returns
  the value

## ◆ i_get_additional_response()

const char * i_get_additional_response | ( | struct _i_session * | i_session,
|  | const char * | s_key
| ) |  |

Gets an additional response from auth or token requests

Parameters

  i_session | a reference to a struct _i_session *
  s_key | the key to get

Returns
  the value

## ◆ i_get_server_configuration()

json_t * i_get_server_configuration | ( | struct _i_session * | i_session | ) |

Gets the server configuration

Parameters

  i_session | a reference to a struct _i_session *

Returns
  the server configuration in json_t * format

## ◆ i_get_server_jwks()

json_t * i_get_server_jwks | ( | struct _i_session * | i_session | ) |

Gets the server configuration

Parameters

  i_session | a reference to a struct _i_session *

Returns
  the server public JWKS in json_t * format

## ◆ i_set_server_jwks()

int i_set_server_jwks | ( | struct _i_session * | i_session,
|  | json_t * | j_jwks
| ) |  |

Gets the server configuration

Parameters

  i_session | a reference to a struct _i_session *
  j_jwks | the server public JWKS in json_t * format

Returns
  I_OK on success, an error value on error

## ◆ i_get_client_jwks()

json_t * i_get_client_jwks | ( | struct _i_session * | i_session | ) |

Gets the client configuration

Parameters

  i_session | a reference to a struct _i_session *

Returns
  the client public JWKS in json_t * format

## ◆ i_set_client_jwks()

int i_set_client_jwks | ( | struct _i_session * | i_session,
|  | json_t * | j_jwks
| ) |  |

Gets the client configuration

Parameters

  i_session | a reference to a struct _i_session *
  j_jwks | the client public JWKS in json_t * format

Returns
  I_OK on success, an error value on error

## ◆ i_set_parameter_list()

int i_set_parameter_list | ( | struct _i_session * | i_session,
|  |  | ...
| ) |  |

Sets a list of parameters to a session

Parameters

  i_session | a reference to a struct _i_session * the list of parameters to set Uses a variable-length parameter list the syntax is the option followed by the value(s) required by the option The list must be ended by a I_OPT_NONE Example: i_set_parameter_list(i_session, I_OPT_RESPONSE_TYPE, I_RESPONSE_TYPE_CODE, I_OPT_SCOPE, "scope1", I_OPT_STATE, "abcd", I_OPT_CLIENT_ID, "client1", I_OPT_AUTH_ENDPOINT, "https://auth2.tld/auth", I_OPT_NONE);

Returns
  I_OK on success, an error value on error

## ◆ i_export_session_json_t()

json_t * i_export_session_json_t | ( | struct _i_session * | i_session | ) |

Exports a _i_session * into a json_t * object

Parameters

  i_session | a reference to a struct _i_session *

Returns
  a json_t * object containing all data set in the session

## ◆ i_import_session_json_t()

int i_import_session_json_t | ( | struct _i_session * | i_session,
|  | json_t * | j_import
| ) |  |

Imports a _i_session * from a json_t * object Imported data will overwrite existing data in i_session

Parameters

  i_session | a reference to a struct _i_session *
  j_import | a json_t * object in i_export_session_json_t format

Returns
  I_OK on success, an error value on error

## ◆ i_export_session_str()

char * i_export_session_str | ( | struct _i_session * | i_session | ) |

Exports a _i_session * into a json_t * object

Parameters

  i_session | a reference to a struct _i_session *

Returns
  a char * containing a JSON stringified exported session, must be i_free'd after use

## ◆ i_import_session_str()

int i_import_session_str | ( | struct _i_session * | i_session,
|  | const char * | str_import
| ) |  |

Imports a _i_session * from a json_t * object Imported data will overwrite existing data in i_session

Parameters

  i_session | a reference to a struct _i_session *
  str_import | a char * containing a JSON stringified session

Returns
  I_OK on success, an error value on error