Iddawc: include/iddawc.h Source File

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

iddawc.h
Go to the documentation of this file.
1
24 #ifndef __IDDAWC_H
25 #define __IDDAWC_H
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <jansson.h>
33 #include <orcania.h>
34 #include <ulfius.h>
35 #include <rhonabwy.h>
36 #include "iddawc-cfg.h"
37
44 #define I_OK 0
45 #define I_ERROR 1
46 #define I_ERROR_PARAM 2
47 #define I_ERROR_MEMORY 3
48 #define I_ERROR_UNAUTHORIZED 4
49 #define I_ERROR_SERVER 5
50
51 #define I_RESPONSE_TYPE_NONE 0x00000000
52 #define I_RESPONSE_TYPE_CODE 0x00000001
53 #define I_RESPONSE_TYPE_TOKEN 0x00000010
54 #define I_RESPONSE_TYPE_ID_TOKEN 0x00000100
55 #define I_RESPONSE_TYPE_PASSWORD 0x00001000
56 #define I_RESPONSE_TYPE_CLIENT_CREDENTIALS 0x00010000
57 #define I_RESPONSE_TYPE_REFRESH_TOKEN 0x00100000
58 #define I_RESPONSE_TYPE_DEVICE_CODE 0x01000000
59
60 #define I_AUTH_METHOD_GET 0x00000001
61 #define I_AUTH_METHOD_POST 0x00000010
62 #define I_AUTH_METHOD_JWT_SIGN_SECRET 0x00000100
63 #define I_AUTH_METHOD_JWT_SIGN_PRIVKEY 0x00001000
64 #define I_AUTH_METHOD_JWT_ENCRYPT_SECRET 0x00010000
65 #define I_AUTH_METHOD_JWT_ENCRYPT_PUBKEY 0x00100000
66
67 #define I_TOKEN_AUTH_METHOD_NONE 0x00000000
68 #define I_TOKEN_AUTH_METHOD_SECRET_BASIC 0x00000001
69 #define I_TOKEN_AUTH_METHOD_SECRET_POST 0x00000010
70 #define I_TOKEN_AUTH_METHOD_TLS_CERTIFICATE 0x00000100
71 #define I_TOKEN_AUTH_METHOD_JWT_SIGN_SECRET 0x00001000
72 #define I_TOKEN_AUTH_METHOD_JWT_SIGN_PRIVKEY 0x00010000
73 #define I_TOKEN_AUTH_METHOD_JWT_ENCRYPT_SECRET 0x00100000
74 #define I_TOKEN_AUTH_METHOD_JWT_ENCRYPT_PUBKEY 0x01000000
75
76 #define I_STRICT_NO 0
77 #define I_STRICT_YES 1
78
79 #define I_AUTH_SIGN_ALG_MAX_LENGTH 8
80
81 #define I_BEARER_TYPE_HEADER 0
82 #define I_BEARER_TYPE_BODY 1
83 #define I_BEARER_TYPE_URL 2
84
85 #define I_INTROSPECT_REVOKE_AUTH_NONE 0
86 #define I_INTROSPECT_REVOKE_AUTH_ACCESS_TOKEN 1
87 #define I_INTROSPECT_REVOKE_AUTH_CLIENT_TARGET 2
88
89 #define I_TOKEN_TYPE_ACCESS_TOKEN 0
90 #define I_TOKEN_TYPE_ID_TOKEN 1
91 #define I_TOKEN_TYPE_USERINFO 2
92 #define I_TOKEN_TYPE_INTROSPECTION 3
93
94 #define I_HEADER_PREFIX_BEARER "Bearer "
95 #define I_HEADER_AUTHORIZATION "Authorization"
96 #define I_BODY_URL_PARAMETER "access_token"
97 #define I_HEADER_DPOP "DPoP"
98
99 #define I_REMOTE_VERIFY_NONE 0x0000
100 #define I_REMOTE_HOST_VERIFY_PEER 0x0001
101 #define I_REMOTE_HOST_VERIFY_HOSTNAME 0x0010
102 #define I_REMOTE_PROXY_VERIFY_PEER 0x0100
103 #define I_REMOTE_PROXY_VERIFY_HOSTNAME 0x1000
104
105 #define I_PKCE_NONE 0
106 #define I_PKCE_METHOD_PLAIN 1
107 #define I_PKCE_METHOD_S256 2
108
109 #define I_CLAIM_TARGET_ALL 0
110 #define I_CLAIM_TARGET_USERINFO 1
111 #define I_CLAIM_TARGET_ID_TOKEN 2
112
113 #define I_CLAIM_ESSENTIAL_NULL 0
114 #define I_CLAIM_ESSENTIAL_TRUE 1
115 #define I_CLAIM_ESSENTIAL_FALSE 2
116 #define I_CLAIM_ESSENTIAL_IGNORE 3
117
123 typedef enum {
124 I_OPT_NONE = 0,
125 I_OPT_RESPONSE_TYPE = 1,
126 I_OPT_SCOPE = 2,
127 I_OPT_SCOPE_APPEND = 3,
128 I_OPT_STATE = 4,
129 I_OPT_NONCE = 5,
130 I_OPT_REDIRECT_URI = 6,
131 I_OPT_REDIRECT_TO = 7,
132 I_OPT_CLIENT_ID = 8,
133 I_OPT_CLIENT_SECRET = 9,
134 I_OPT_ADDITIONAL_PARAMETER = 10,
135 I_OPT_ADDITIONAL_RESPONSE = 11,
136 I_OPT_AUTH_ENDPOINT = 12,
137 I_OPT_TOKEN_ENDPOINT = 13,
138 I_OPT_OPENID_CONFIG_ENDPOINT = 14,
139 I_OPT_OPENID_CONFIG = 15,
140 I_OPT_OPENID_CONFIG_STRICT = 16,
141 I_OPT_USERINFO_ENDPOINT = 17,
142 I_OPT_RESULT = 18,
143 I_OPT_ERROR = 19,
144 I_OPT_ERROR_DESCRIPTION = 20,
145 I_OPT_ERROR_URI = 21,
146 I_OPT_CODE = 22,
147 I_OPT_REFRESH_TOKEN = 23,
148 I_OPT_ACCESS_TOKEN = 24,
149 I_OPT_ID_TOKEN = 25,
150 I_OPT_AUTH_METHOD = 28,
151 I_OPT_TOKEN_METHOD = 29,
152 I_OPT_TOKEN_TYPE = 30,
153 I_OPT_EXPIRES_IN = 31,
154 I_OPT_EXPIRES_AT = 32,
155 I_OPT_USERNAME = 33,
156 I_OPT_USER_PASSWORD = 34,
157 I_OPT_ISSUER = 35,
158 I_OPT_USERINFO = 36,
159 I_OPT_NONCE_GENERATE = 37,
160 I_OPT_STATE_GENERATE = 38,
161 I_OPT_X5U_FLAGS = 39,
162 I_OPT_SERVER_KID = 40,
163 I_OPT_SERVER_ENC_ALG = 41,
164 I_OPT_SERVER_ENC = 42,
165 I_OPT_CLIENT_KID = 43,
166 I_OPT_CLIENT_SIGN_ALG = 44,
167 I_OPT_CLIENT_ENC_ALG = 45,
168 I_OPT_CLIENT_ENC = 46,
169 I_OPT_TOKEN_JTI = 47,
170 I_OPT_TOKEN_JTI_GENERATE = 48,
171 I_OPT_TOKEN_EXP = 49,
172 I_OPT_TOKEN_TARGET = 50,
173 I_OPT_TOKEN_TARGET_TYPE_HINT = 51,
174 I_OPT_REVOCATION_ENDPOINT = 52,
175 I_OPT_INTROSPECTION_ENDPOINT = 53,
176 I_OPT_REGISTRATION_ENDPOINT = 54,
177 I_OPT_DEVICE_AUTHORIZATION_ENDPOINT = 55,
178 I_OPT_DEVICE_AUTH_CODE = 56,
179 I_OPT_DEVICE_AUTH_USER_CODE = 57,
180 I_OPT_DEVICE_AUTH_VERIFICATION_URI = 58,
181 I_OPT_DEVICE_AUTH_VERIFICATION_URI_COMPLETE = 59,
182 I_OPT_DEVICE_AUTH_EXPIRES_IN = 60,
183 I_OPT_DEVICE_AUTH_INTERVAL = 61,
184 I_OPT_END_SESSION_ENDPOINT = 62,
185 I_OPT_CHECK_SESSION_IRAME = 63,
186 I_OPT_PUSHED_AUTH_REQ_ENDPOINT = 64,
187 I_OPT_PUSHED_AUTH_REQ_REQUIRED = 65,
188 I_OPT_PUSHED_AUTH_REQ_EXPIRES_IN = 66,
189 I_OPT_PUSHED_AUTH_REQ_URI = 67,
190 I_OPT_USE_DPOP = 68,
191 I_OPT_DPOP_KID = 69,
192 I_OPT_DECRYPT_CODE = 70,
193 I_OPT_DECRYPT_REFRESH_TOKEN = 71,
194 I_OPT_DECRYPT_ACCESS_TOKEN = 72,
195 I_OPT_DPOP_SIGN_ALG = 73,
196 I_OPT_TLS_KEY_FILE = 74,
197 I_OPT_TLS_CERT_FILE = 75,
198 I_OPT_REMOTE_CERT_FLAG = 76,
199 I_OPT_PKCE_CODE_VERIFIER = 77,
200 I_OPT_PKCE_CODE_VERIFIER_GENERATE = 78,
201 I_OPT_PKCE_METHOD = 79,
202 I_OPT_RESOURCE_INDICATOR = 80
203 } i_option;
204
215 struct _i_session {
216 uint response_type;
217 char * scope;
218 char * state;
219 char * nonce;
220 char * redirect_uri;
221 char * redirect_to;
222 char * client_id;
223 char * client_secret;
224 char * username;
225 char * user_password;
226 struct _u_map additional_parameters;
227 struct _u_map additional_response;
228 char * authorization_endpoint;
229 char * token_endpoint;
230 char * openid_config_endpoint;
231 char * userinfo_endpoint;
232 char * revocation_endpoint;
233 char * introspection_endpoint;
234 char * end_session_endpoint;
235 char * check_session_iframe;
236 char * device_authorization_endpoint;
237 char * registration_endpoint;
238 char * pushed_authorization_request_endpoint;
239 uint result;
240 char * error;
241 char * error_description;
242 char * error_uri;
243 char * code;
244 char * refresh_token;
245 char * access_token;
246 json_t * access_token_payload;
247 char * token_target;
248 char * token_target_type_hint;
249 char * token_type;
250 uint expires_in;
251 time_t expires_at;
252 char * id_token;
253 json_t * id_token_payload;
254 uint auth_method;
255 uint token_method;
256 jwks_t * server_jwks;
257 char * server_kid;
258 jwa_alg server_enc_alg;
259 jwa_enc server_enc;
260 jwks_t * client_jwks;
261 char * client_kid;
262 jwa_alg client_sign_alg;
263 jwa_alg client_enc_alg;
264 jwa_enc client_enc;
265 int x5u_flags;
266 json_t * openid_config;
267 int openid_config_strict;
268 char * issuer;
269 char * userinfo;
270 json_t * j_userinfo;
271 char * token_jti;
272 uint token_exp;
273 json_t * j_authorization_details;
274 char * device_auth_code;
275 char * device_auth_user_code;
276 char * device_auth_verification_uri;
277 char * device_auth_verification_uri_complete;
278 uint device_auth_expires_in;
279 uint device_auth_interval;
280 uint require_pushed_authorization_requests;
281 uint pushed_authorization_request_expires_in;
282 char * pushed_authorization_request_uri;
283 int use_dpop;
284 char * dpop_kid;
285 jwa_alg dpop_sign_alg;
286 int decrypt_code;
287 int decrypt_refresh_token;
288 int decrypt_access_token;
289 char * key_file;
290 char * cert_file;
291 int remote_cert_flag;
292 char * pkce_code_verifier;
293 int pkce_method;
294 json_t * j_claims;
295 char * resource_indicator;
296 };
297
314 int i_global_init();
315
319 void i_global_close();
320
326 void i_free(void * data);
327
333 int i_init_session(struct _i_session * i_session);
334
339 void i_clean_session(struct _i_session * i_session);
340
363 int i_set_response_type(struct _i_session * i_session, uint i_value);
364
373 int i_set_result(struct _i_session * i_session, uint i_value);
374
389 int i_set_int_parameter(struct _i_session * i_session, i_option option, uint i_value);
390
416 int i_set_str_parameter(struct _i_session * i_session, i_option option, const char * s_value);
417
425 int i_set_additional_parameter(struct _i_session * i_session, const char * s_key, const char * s_value);
426
434 int i_set_additional_response(struct _i_session * i_session, const char * s_key, const char * s_value);
435
449 int i_add_claim_request(struct _i_session * i_session, int target, const char * claim, int essential, const char * value);
450
459 int i_remove_claim_request(struct _i_session * i_session, int target, const char * claim);
460
468 int i_set_rich_authorization_request_json_t(struct _i_session * i_session, const char * type, json_t * j_value);
469
477 int i_set_rich_authorization_request_str(struct _i_session * i_session, const char * type, const char * value);
478
485 int i_remove_rich_authorization_request(struct _i_session * i_session, const char * type);
486
493 json_t * i_get_rich_authorization_request_json_t(struct _i_session * i_session, const char * type);
494
501 char * i_get_rich_authorization_request_str(struct _i_session * i_session, const char * type);
502
514 uint i_get_response_type(struct _i_session * i_session);
515
521 uint i_get_result(struct _i_session * i_session);
522
536 uint i_get_int_parameter(struct _i_session * i_session, i_option option);
537
562 const char * i_get_str_parameter(struct _i_session * i_session, i_option option);
563
570 const char * i_get_additional_parameter(struct _i_session * i_session, const char * s_key);
571
578 const char * i_get_additional_response(struct _i_session * i_session, const char * s_key);
579
585 json_t * i_get_server_configuration(struct _i_session * i_session);
586
592 json_t * i_get_server_jwks(struct _i_session * i_session);
593
607 int i_set_parameter_list(struct _i_session * i_session, ...);
608
614 json_t * i_export_session_json_t(struct _i_session * i_session);
615
623 int i_import_session_json_t(struct _i_session * i_session, json_t * j_import);
624
630 char * i_export_session_str(struct _i_session * i_session);
631
639 int i_import_session_str(struct _i_session * i_session, const char * str_import);
640
656 int i_get_openid_config(struct _i_session * i_session);
657
664 int i_build_auth_url_get(struct _i_session * i_session);
665
672 int i_run_auth_request(struct _i_session * i_session);
673
681 int i_parse_redirect_to(struct _i_session * i_session);
682
689 int i_run_token_request(struct _i_session * i_session);
690
696 int i_verify_id_token(struct _i_session * i_session);
697
705 int i_verify_jwt_access_token(struct _i_session * i_session);
706
717 int i_get_userinfo(struct _i_session * i_session, int get_jwt);
718
732 int i_get_userinfo_custom(struct _i_session * i_session, const char * http_method, struct _u_map * additional_query, struct _u_map * additional_headers);
733
747 int i_get_token_introspection(struct _i_session * i_session, json_t ** j_result, int authentication, int get_jwt);
748
759 int i_revoke_token(struct _i_session * i_session, int authentication);
760
772 int i_register_client(struct _i_session * i_session, json_t * j_parameters, int update_session, json_t ** j_result);
773
785 int i_manage_registration_client(struct _i_session * i_session, json_t * j_parameters, int update_session, json_t ** j_result);
786
794 int i_get_registration_client(struct _i_session * i_session, json_t ** j_result);
795
805 char * i_generate_dpop_token(struct _i_session * i_session, const char * htm, const char * htu, time_t iat);
806
823 int i_perform_resource_service_request(struct _i_session * i_session, struct _u_request * http_request, struct _u_response * http_response, int refresh_if_expired, int bearer_type, int use_dpop, time_t dpop_iat);
824
831 int i_run_par_request(struct _i_session * i_session);
832
839 int i_run_device_auth_request(struct _i_session * i_session);
840
845 #ifdef __cplusplus
846 }
847 #endif
848
849 #endif // __IDDAWC_H_
i_option
i_option
Definition: iddawc.h:123
I_OPT_EXPIRES_AT
@ I_OPT_EXPIRES_AT
expires_at value after a succesfull auth or token request, time_t
Definition: iddawc.h:154
I_OPT_TOKEN_TYPE
@ I_OPT_TOKEN_TYPE
token_type value after a succesfull auth or token request, string
Definition: iddawc.h:152
I_OPT_PUSHED_AUTH_REQ_REQUIRED
@ I_OPT_PUSHED_AUTH_REQ_REQUIRED
are pushed authorization requests required, boolean
Definition: iddawc.h:187
I_OPT_TOKEN_EXP
@ I_OPT_TOKEN_EXP
JWT token request expiration time in seconds.
Definition: iddawc.h:171
I_OPT_DEVICE_AUTH_CODE
@ I_OPT_DEVICE_AUTH_CODE
device authorization code sent by the AS
Definition: iddawc.h:178
I_OPT_DPOP_SIGN_ALG
@ I_OPT_DPOP_SIGN_ALG
signature algorithm to use when the client signs a DPoP, values available are 'none',...
Definition: iddawc.h:195
I_OPT_ISSUER
@ I_OPT_ISSUER
issuer value, string
Definition: iddawc.h:157
I_OPT_REMOTE_CERT_FLAG
@ I_OPT_REMOTE_CERT_FLAG
Flags to use with remote connexions to ignore incorrect certificates, flags available are I_REMOTE_HO...
Definition: iddawc.h:198
I_OPT_ACCESS_TOKEN
@ I_OPT_ACCESS_TOKEN
access token given after a succesfull auth or token request using the proper response_type
Definition: iddawc.h:148
I_OPT_PUSHED_AUTH_REQ_ENDPOINT
@ I_OPT_PUSHED_AUTH_REQ_ENDPOINT
absolute url for the pushed authoization endpoint, string
Definition: iddawc.h:186
I_OPT_TOKEN_JTI
@ I_OPT_TOKEN_JTI
jti value, string
Definition: iddawc.h:169
I_OPT_TOKEN_TARGET
@ I_OPT_TOKEN_TARGET
access_token which is the target of a revocation or an introspection, string
Definition: iddawc.h:172
I_OPT_INTROSPECTION_ENDPOINT
@ I_OPT_INTROSPECTION_ENDPOINT
absolute url for the introspection endpoint, string
Definition: iddawc.h:175
I_OPT_TOKEN_TARGET_TYPE_HINT
@ I_OPT_TOKEN_TARGET_TYPE_HINT
access_token which is the target of a revocation or an introspection, string
Definition: iddawc.h:173
I_OPT_TOKEN_METHOD
@ I_OPT_TOKEN_METHOD
Authentication method to use with the token endpoint, values available are I_TOKEN_AUTH_METHOD_SECRET...
Definition: iddawc.h:151
I_OPT_PKCE_CODE_VERIFIER_GENERATE
@ I_OPT_PKCE_CODE_VERIFIER_GENERATE
Generate a random PKCE code verifier.
Definition: iddawc.h:200
I_OPT_X5U_FLAGS
@ I_OPT_X5U_FLAGS
x5u flage to apply when JWK used have a x5u property, values available are R_FLAG_IGNORE_SERVER_CERTI...
Definition: iddawc.h:161
I_OPT_TOKEN_JTI_GENERATE
@ I_OPT_TOKEN_JTI_GENERATE
Generate a random jti value.
Definition: iddawc.h:170
I_OPT_SERVER_KID
@ I_OPT_SERVER_KID
key id to use if multiple jwk are available on the server, string
Definition: iddawc.h:162
I_OPT_PKCE_METHOD
@ I_OPT_PKCE_METHOD
PKCE method to use, values available are I_PKCE_NONE (no PKCE, default), I_PKCE_METHOD_PLAIN or I_PKC...
Definition: iddawc.h:201
I_OPT_CODE
@ I_OPT_CODE
code given after a succesfull auth request using the response_type I_RESPONSE_TYPE_CODE
Definition: iddawc.h:146
I_OPT_PKCE_CODE_VERIFIER
@ I_OPT_PKCE_CODE_VERIFIER
PKCE code verifier, must be a string of 43 characters minumum only using the characters [A-Z] / [a-z]...
Definition: iddawc.h:199
I_OPT_USE_DPOP
@ I_OPT_USE_DPOP
Generate and use a DPoP when accessing endpoints userinfo, introspection and revocation.
Definition: iddawc.h:190
I_OPT_OPENID_CONFIG_ENDPOINT
@ I_OPT_OPENID_CONFIG_ENDPOINT
absolute url for the .well-known/openid-configuration endpoint, string
Definition: iddawc.h:138
I_OPT_ID_TOKEN
@ I_OPT_ID_TOKEN
id_token given after a succesfull auth or token request using the proper response_type
Definition: iddawc.h:149
I_OPT_DEVICE_AUTHORIZATION_ENDPOINT
@ I_OPT_DEVICE_AUTHORIZATION_ENDPOINT
absolute url for the pushed authorization endpoint, string
Definition: iddawc.h:177
I_OPT_OPENID_CONFIG
@ I_OPT_OPENID_CONFIG
result of the .well-known/openid-configuration
Definition: iddawc.h:139
I_OPT_NONE
@ I_OPT_NONE
Empty option to complete a i_set_parameter_list.
Definition: iddawc.h:124
I_OPT_CHECK_SESSION_IRAME
@ I_OPT_CHECK_SESSION_IRAME
absolute url for the check session iframe, string
Definition: iddawc.h:185
I_OPT_DEVICE_AUTH_EXPIRES_IN
@ I_OPT_DEVICE_AUTH_EXPIRES_IN
device authorization code expiration sent by the AS
Definition: iddawc.h:182
I_OPT_TLS_KEY_FILE
@ I_OPT_TLS_KEY_FILE
Path to the private key PEM file to use in a TLS authentication.
Definition: iddawc.h:196
I_OPT_DEVICE_AUTH_INTERVAL
@ I_OPT_DEVICE_AUTH_INTERVAL
device authorization code verification interval sent by the AS
Definition: iddawc.h:183
I_OPT_REDIRECT_URI
@ I_OPT_REDIRECT_URI
redirect_uri, string
Definition: iddawc.h:130
I_OPT_CLIENT_ENC_ALG
@ I_OPT_CLIENT_ENC_ALG
key encryption algorithm to use when the client encrypts a request in a JWT, values available are 'RS...
Definition: iddawc.h:167
I_OPT_ERROR_URI
@ I_OPT_ERROR_URI
error uri of a failed request, string
Definition: iddawc.h:145
I_OPT_CLIENT_KID
@ I_OPT_CLIENT_KID
key id to use if multiple jwk are available on the client, string
Definition: iddawc.h:165
I_OPT_REDIRECT_TO
@ I_OPT_REDIRECT_TO
url where the oauth2 is redirected to after a /auth request
Definition: iddawc.h:131
I_OPT_ADDITIONAL_RESPONSE
@ I_OPT_ADDITIONAL_RESPONSE
Definition: iddawc.h:135
I_OPT_DECRYPT_ACCESS_TOKEN
@ I_OPT_DECRYPT_ACCESS_TOKEN
Decrypt access token when received by the AS as a JWE.
Definition: iddawc.h:194
I_OPT_DECRYPT_REFRESH_TOKEN
@ I_OPT_DECRYPT_REFRESH_TOKEN
Decrypt refresh token when received by the AS as a JWE.
Definition: iddawc.h:193
I_OPT_NONCE
@ I_OPT_NONCE
nonce value, string
Definition: iddawc.h:129
I_OPT_DECRYPT_CODE
@ I_OPT_DECRYPT_CODE
Decrypt code when received by the AS as a JWE.
Definition: iddawc.h:192
I_OPT_RESOURCE_INDICATOR
@ I_OPT_RESOURCE_INDICATOR
Resource indicator as detailed in the RFC 8707.
Definition: iddawc.h:202
I_OPT_PUSHED_AUTH_REQ_EXPIRES_IN
@ I_OPT_PUSHED_AUTH_REQ_EXPIRES_IN
pushed authorization request expiration time in seconds
Definition: iddawc.h:188
I_OPT_USER_PASSWORD
@ I_OPT_USER_PASSWORD
password for password response_types, string
Definition: iddawc.h:156
I_OPT_PUSHED_AUTH_REQ_URI
@ I_OPT_PUSHED_AUTH_REQ_URI
request_uri sent by the par endpoint result, string
Definition: iddawc.h:189
I_OPT_REVOCATION_ENDPOINT
@ I_OPT_REVOCATION_ENDPOINT
absolute url for the revocation endpoint, string
Definition: iddawc.h:174
I_OPT_SERVER_ENC_ALG
@ I_OPT_SERVER_ENC_ALG
key id to use if multiple jwk are available on the server, string
Definition: iddawc.h:163
I_OPT_TOKEN_ENDPOINT
@ I_OPT_TOKEN_ENDPOINT
absolute url for the token endpoint, string
Definition: iddawc.h:137
I_OPT_REFRESH_TOKEN
@ I_OPT_REFRESH_TOKEN
refresh token given after a succesfull token request using the proper response_type
Definition: iddawc.h:147
I_OPT_TLS_CERT_FILE
@ I_OPT_TLS_CERT_FILE
Path to the certificate PEM file to use in a TLS authentication.
Definition: iddawc.h:197
I_OPT_STATE_GENERATE
@ I_OPT_STATE_GENERATE
Generate a random state value.
Definition: iddawc.h:160
I_OPT_CLIENT_SECRET
@ I_OPT_CLIENT_SECRET
client secret, string
Definition: iddawc.h:133
I_OPT_CLIENT_SIGN_ALG
@ I_OPT_CLIENT_SIGN_ALG
signature algorithm to use when the client signs a request in a JWT, values available are 'none',...
Definition: iddawc.h:166
I_OPT_SCOPE_APPEND
@ I_OPT_SCOPE_APPEND
append another scope value to the scope list, string
Definition: iddawc.h:127
I_OPT_DEVICE_AUTH_VERIFICATION_URI
@ I_OPT_DEVICE_AUTH_VERIFICATION_URI
device authorization verification URI sent by the AS
Definition: iddawc.h:180
I_OPT_REGISTRATION_ENDPOINT
@ I_OPT_REGISTRATION_ENDPOINT
absolute url for the client registration endpoint, string
Definition: iddawc.h:176
I_OPT_SERVER_ENC
@ I_OPT_SERVER_ENC
key id to use if multiple jwk are available on the server, string
Definition: iddawc.h:164
I_OPT_CLIENT_ENC
@ I_OPT_CLIENT_ENC
data encryption algorithm to use when the client encrypts a request in a JWT, values available are 'A...
Definition: iddawc.h:168
I_OPT_EXPIRES_IN
@ I_OPT_EXPIRES_IN
expires_in value after a succesfull auth or token request, integer
Definition: iddawc.h:153
I_OPT_CLIENT_ID
@ I_OPT_CLIENT_ID
client_id, string
Definition: iddawc.h:132
I_OPT_RESPONSE_TYPE
@ I_OPT_RESPONSE_TYPE
response_type, values available are I_RESPONSE_TYPE_CODE, I_RESPONSE_TYPE_TOKEN, I_RESPONSE_TYPE_ID_T...
Definition: iddawc.h:125
I_OPT_ERROR_DESCRIPTION
@ I_OPT_ERROR_DESCRIPTION
error description of a failed request, string
Definition: iddawc.h:144
I_OPT_AUTH_METHOD
@ I_OPT_AUTH_METHOD
Authentication method to use with the auth endpoint, values available are I_AUTH_METHOD_GET,...
Definition: iddawc.h:150
I_OPT_DEVICE_AUTH_USER_CODE
@ I_OPT_DEVICE_AUTH_USER_CODE
device authorization user code sent by the AS
Definition: iddawc.h:179
I_OPT_END_SESSION_ENDPOINT
@ I_OPT_END_SESSION_ENDPOINT
absolute url for the end session endpoint, string
Definition: iddawc.h:184
I_OPT_ERROR
@ I_OPT_ERROR
error value of a failed request, string
Definition: iddawc.h:143
I_OPT_USERINFO_ENDPOINT
@ I_OPT_USERINFO_ENDPOINT
absolute url for the userinfo endpoint or equivalent, string
Definition: iddawc.h:141
I_OPT_STATE
@ I_OPT_STATE
state value, string
Definition: iddawc.h:128
I_OPT_AUTH_ENDPOINT
@ I_OPT_AUTH_ENDPOINT
absolute url for the auth endpoint, string
Definition: iddawc.h:136
I_OPT_USERNAME
@ I_OPT_USERNAME
username for password response_types, string
Definition: iddawc.h:155
I_OPT_OPENID_CONFIG_STRICT
@ I_OPT_OPENID_CONFIG_STRICT
must the .well-known/openid-configuration parameters be strictly
Definition: iddawc.h:140
I_OPT_SCOPE
@ I_OPT_SCOPE
scope values, string, multiple scopes must be separated by a space character: "scope1 openid"
Definition: iddawc.h:126
I_OPT_NONCE_GENERATE
@ I_OPT_NONCE_GENERATE
Generate a random nonce value.
Definition: iddawc.h:159
I_OPT_USERINFO
@ I_OPT_USERINFO
userinfo result, string
Definition: iddawc.h:158
I_OPT_ADDITIONAL_PARAMETER
@ I_OPT_ADDITIONAL_PARAMETER
use this option to pass any additional parameter value in the /auth request
Definition: iddawc.h:134
I_OPT_DPOP_KID
@ I_OPT_DPOP_KID
key id to use when signing a DPoP
Definition: iddawc.h:191
I_OPT_RESULT
@ I_OPT_RESULT
result of a request
Definition: iddawc.h:142
I_OPT_DEVICE_AUTH_VERIFICATION_URI_COMPLETE
@ I_OPT_DEVICE_AUTH_VERIFICATION_URI_COMPLETE
device authorization verification URI complete sent by the AS
Definition: iddawc.h:181
i_init_session
int i_init_session(struct _i_session *i_session)
Definition: iddawc.c:1382
i_clean_session
void i_clean_session(struct _i_session *i_session)
Definition: iddawc.c:1495
i_global_init
int i_global_init()
Definition: iddawc.c:1364
i_free
void i_free(void *data)
Definition: iddawc.c:1378
i_global_close
void i_global_close()
Definition: iddawc.c:1373
i_get_int_parameter
uint i_get_int_parameter(struct _i_session *i_session, i_option option)
Definition: iddawc.c:2568
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)
Definition: iddawc.c:4623
i_get_result
uint i_get_result(struct _i_session *i_session)
Definition: iddawc.c:2564
i_set_additional_parameter
int i_set_additional_parameter(struct _i_session *i_session, const char *s_key, const char *s_value)
Definition: iddawc.c:2170
i_remove_claim_request
int i_remove_claim_request(struct _i_session *i_session, int target, const char *claim)
Definition: iddawc.c:2237
i_add_claim_request
int i_add_claim_request(struct _i_session *i_session, int target, const char *claim, int essential, const char *value)
Definition: iddawc.c:2194
i_export_session_str
char * i_export_session_str(struct _i_session *i_session)
Definition: iddawc.c:4397
i_import_session_json_t
int i_import_session_json_t(struct _i_session *i_session, json_t *j_import)
Definition: iddawc.c:4271
i_set_int_parameter
int i_set_int_parameter(struct _i_session *i_session, i_option option, uint i_value)
Definition: iddawc.c:1563
i_get_server_jwks
json_t * i_get_server_jwks(struct _i_session *i_session)
Definition: iddawc.c:2899
i_get_additional_parameter
const char * i_get_additional_parameter(struct _i_session *i_session, const char *s_key)
Definition: iddawc.c:2875
i_export_session_json_t
json_t * i_export_session_json_t(struct _i_session *i_session)
Definition: iddawc.c:4167
i_set_result
int i_set_result(struct _i_session *i_session, uint i_value)
Definition: iddawc.c:1559
i_get_additional_response
const char * i_get_additional_response(struct _i_session *i_session, const char *s_key)
Definition: iddawc.c:2883
i_set_parameter_list
int i_set_parameter_list(struct _i_session *i_session,...)
Definition: iddawc.c:2270
i_get_str_parameter
const char * i_get_str_parameter(struct _i_session *i_session, i_option option)
Definition: iddawc.c:2710
i_remove_rich_authorization_request
int i_remove_rich_authorization_request(struct _i_session *i_session, const char *type)
Definition: iddawc.c:4646
i_get_response_type
uint i_get_response_type(struct _i_session *i_session)
Definition: iddawc.c:2560
i_get_server_configuration
json_t * i_get_server_configuration(struct _i_session *i_session)
Definition: iddawc.c:2891
i_import_session_str
int i_import_session_str(struct _i_session *i_session, const char *str_import)
Definition: iddawc.c:4408
i_get_rich_authorization_request_str
char * i_get_rich_authorization_request_str(struct _i_session *i_session, const char *type)
Definition: iddawc.c:4683
i_set_response_type
int i_set_response_type(struct _i_session *i_session, uint i_value)
Definition: iddawc.c:1555
i_get_rich_authorization_request_json_t
json_t * i_get_rich_authorization_request_json_t(struct _i_session *i_session, const char *type)
Definition: iddawc.c:4666
i_set_str_parameter
int i_set_str_parameter(struct _i_session *i_session, i_option option, const char *s_value)
Definition: iddawc.c:1719
i_set_additional_response
int i_set_additional_response(struct _i_session *i_session, const char *s_key, const char *s_value)
Definition: iddawc.c:2182
i_set_rich_authorization_request_str
int i_set_rich_authorization_request_str(struct _i_session *i_session, const char *type, const char *value)
Definition: iddawc.c:4603
i_revoke_token
int i_revoke_token(struct _i_session *i_session, int authentication)
Definition: iddawc.c:3726
i_build_auth_url_get
int i_build_auth_url_get(struct _i_session *i_session)
Definition: iddawc.c:2907
i_perform_resource_service_request
int i_perform_resource_service_request(struct _i_session *i_session, struct _u_request *http_request, struct _u_response *http_response, int refresh_if_expired, int bearer_type, int use_dpop, time_t dpop_iat)
Definition: iddawc.c:4512
i_run_auth_request
int i_run_auth_request(struct _i_session *i_session)
Definition: iddawc.c:3071
i_generate_dpop_token
char * i_generate_dpop_token(struct _i_session *i_session, const char *htm, const char *htu, time_t iat)
Definition: iddawc.c:4426
i_get_userinfo_custom
int i_get_userinfo_custom(struct _i_session *i_session, const char *http_method, struct _u_map *additional_query, struct _u_map *additional_headers)
Definition: iddawc.c:2446
i_verify_jwt_access_token
int i_verify_jwt_access_token(struct _i_session *i_session)
Definition: iddawc.c:3697
i_get_userinfo
int i_get_userinfo(struct _i_session *i_session, int get_jwt)
Definition: iddawc.c:2429
i_run_device_auth_request
int i_run_device_auth_request(struct _i_session *i_session)
Definition: iddawc.c:4695
i_get_registration_client
int i_get_registration_client(struct _i_session *i_session, json_t **j_result)
Definition: iddawc.c:4023
i_verify_id_token
int i_verify_id_token(struct _i_session *i_session)
Definition: iddawc.c:3548
i_get_openid_config
int i_get_openid_config(struct _i_session *i_session)
Definition: iddawc.c:2385
i_parse_redirect_to
int i_parse_redirect_to(struct _i_session *i_session)
Definition: iddawc.c:2636
i_get_token_introspection
int i_get_token_introspection(struct _i_session *i_session, json_t **j_result, int authentication, int get_jwt)
Definition: iddawc.c:3819
i_manage_registration_client
int i_manage_registration_client(struct _i_session *i_session, json_t *j_parameters, int update_session, json_t **j_result)
Definition: iddawc.c:4092
i_run_par_request
int i_run_par_request(struct _i_session *i_session)
Definition: iddawc.c:4779
i_register_client
int i_register_client(struct _i_session *i_session, json_t *j_parameters, int update_session, json_t **j_result)
Definition: iddawc.c:3950
i_run_token_request
int i_run_token_request(struct _i_session *i_session)
Definition: iddawc.c:3190
_i_session
Definition: iddawc.h:215
_i_session::error_description
char * error_description
Definition: iddawc.h:241
_i_session::token_method
uint token_method
Definition: iddawc.h:255
_i_session::expires_at
time_t expires_at
Definition: iddawc.h:251
_i_session::additional_response
struct _u_map additional_response
Definition: iddawc.h:227
_i_session::device_authorization_endpoint
char * device_authorization_endpoint
Definition: iddawc.h:236
_i_session::additional_parameters
struct _u_map additional_parameters
Definition: iddawc.h:226
_i_session::client_enc_alg
jwa_alg client_enc_alg
Definition: iddawc.h:263
_i_session::token_target
char * token_target
Definition: iddawc.h:247
_i_session::pushed_authorization_request_expires_in
uint pushed_authorization_request_expires_in
Definition: iddawc.h:281
_i_session::access_token_payload
json_t * access_token_payload
Definition: iddawc.h:246
_i_session::device_auth_verification_uri
char * device_auth_verification_uri
Definition: iddawc.h:276
_i_session::result
uint result
Definition: iddawc.h:239
_i_session::device_auth_code
char * device_auth_code
Definition: iddawc.h:274
_i_session::redirect_to
char * redirect_to
Definition: iddawc.h:221
_i_session::server_enc
jwa_enc server_enc
Definition: iddawc.h:259
_i_session::token_jti
char * token_jti
Definition: iddawc.h:271
_i_session::token_target_type_hint
char * token_target_type_hint
Definition: iddawc.h:248
_i_session::resource_indicator
char * resource_indicator
Definition: iddawc.h:295
_i_session::x5u_flags
int x5u_flags
Definition: iddawc.h:265
_i_session::redirect_uri
char * redirect_uri
Definition: iddawc.h:220
_i_session::client_jwks
jwks_t * client_jwks
Definition: iddawc.h:260
_i_session::decrypt_access_token
int decrypt_access_token
Definition: iddawc.h:288
_i_session::pushed_authorization_request_uri
char * pushed_authorization_request_uri
Definition: iddawc.h:282
_i_session::openid_config_endpoint
char * openid_config_endpoint
Definition: iddawc.h:230
_i_session::remote_cert_flag
int remote_cert_flag
Definition: iddawc.h:291
_i_session::userinfo_endpoint
char * userinfo_endpoint
Definition: iddawc.h:231
_i_session::code
char * code
Definition: iddawc.h:243
_i_session::openid_config
json_t * openid_config
Definition: iddawc.h:266
_i_session::error
char * error
Definition: iddawc.h:240
_i_session::state
char * state
Definition: iddawc.h:218
_i_session::j_claims
json_t * j_claims
Definition: iddawc.h:294
_i_session::pkce_method
int pkce_method
Definition: iddawc.h:293
_i_session::j_userinfo
json_t * j_userinfo
Definition: iddawc.h:270
_i_session::expires_in
uint expires_in
Definition: iddawc.h:250
_i_session::userinfo
char * userinfo
Definition: iddawc.h:269
_i_session::client_id
char * client_id
Definition: iddawc.h:222
_i_session::refresh_token
char * refresh_token
Definition: iddawc.h:244
_i_session::revocation_endpoint
char * revocation_endpoint
Definition: iddawc.h:232
_i_session::cert_file
char * cert_file
Definition: iddawc.h:290
_i_session::user_password
char * user_password
Definition: iddawc.h:225
_i_session::id_token_payload
json_t * id_token_payload
Definition: iddawc.h:253
_i_session::j_authorization_details
json_t * j_authorization_details
Definition: iddawc.h:273
_i_session::token_exp
uint token_exp
Definition: iddawc.h:272
_i_session::decrypt_code
int decrypt_code
Definition: iddawc.h:286
_i_session::error_uri
char * error_uri
Definition: iddawc.h:242
_i_session::client_kid
char * client_kid
Definition: iddawc.h:261
_i_session::dpop_sign_alg
jwa_alg dpop_sign_alg
Definition: iddawc.h:285
_i_session::use_dpop
int use_dpop
Definition: iddawc.h:283
_i_session::token_type
char * token_type
Definition: iddawc.h:249
_i_session::token_endpoint
char * token_endpoint
Definition: iddawc.h:229
_i_session::openid_config_strict
int openid_config_strict
Definition: iddawc.h:267
_i_session::pkce_code_verifier
char * pkce_code_verifier
Definition: iddawc.h:292
_i_session::server_enc_alg
jwa_alg server_enc_alg
Definition: iddawc.h:258
_i_session::dpop_kid
char * dpop_kid
Definition: iddawc.h:284
_i_session::nonce
char * nonce
Definition: iddawc.h:219
_i_session::require_pushed_authorization_requests
uint require_pushed_authorization_requests
Definition: iddawc.h:280
_i_session::access_token
char * access_token
Definition: iddawc.h:245
_i_session::auth_method
uint auth_method
Definition: iddawc.h:254
_i_session::check_session_iframe
char * check_session_iframe
Definition: iddawc.h:235
_i_session::client_secret
char * client_secret
Definition: iddawc.h:223
_i_session::issuer
char * issuer
Definition: iddawc.h:268
_i_session::username
char * username
Definition: iddawc.h:224
_i_session::device_auth_interval
uint device_auth_interval
Definition: iddawc.h:279
_i_session::server_kid
char * server_kid
Definition: iddawc.h:257
_i_session::registration_endpoint
char * registration_endpoint
Definition: iddawc.h:237
_i_session::scope
char * scope
Definition: iddawc.h:217
_i_session::response_type
uint response_type
Definition: iddawc.h:216
_i_session::end_session_endpoint
char * end_session_endpoint
Definition: iddawc.h:234
_i_session::client_sign_alg
jwa_alg client_sign_alg
Definition: iddawc.h:262
_i_session::device_auth_user_code
char * device_auth_user_code
Definition: iddawc.h:275
_i_session::client_enc
jwa_enc client_enc
Definition: iddawc.h:264
_i_session::pushed_authorization_request_endpoint
char * pushed_authorization_request_endpoint
Definition: iddawc.h:238
_i_session::id_token
char * id_token
Definition: iddawc.h:252
_i_session::key_file
char * key_file
Definition: iddawc.h:289
_i_session::authorization_endpoint
char * authorization_endpoint
Definition: iddawc.h:228
_i_session::device_auth_expires_in
uint device_auth_expires_in
Definition: iddawc.h:278
_i_session::introspection_endpoint
char * introspection_endpoint
Definition: iddawc.h:233
_i_session::server_jwks
jwks_t * server_jwks
Definition: iddawc.h:256
_i_session::decrypt_refresh_token
int decrypt_refresh_token
Definition: iddawc.h:287
_i_session::device_auth_verification_uri_complete
char * device_auth_verification_uri_complete
Definition: iddawc.h:277