authorize_start.h (3475B)
1 /* 2 This file is part of Challenger 3 Copyright (C) 2023 Taler Systems SA 4 5 Challenger is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 Challenger is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 Challenger; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file src/include/challenger-database/authorize_start.h 18 * @brief implementation of the authorize_start function for Postgres 19 * @author Christian Grothoff 20 * @author Bohdan Potuzhnyi 21 * @author Vlada Svirsh 22 */ 23 #ifndef CHALLENGER_DATABASE_AUTHORIZE_START_H 24 #define CHALLENGER_DATABASE_AUTHORIZE_START_H 25 26 #include <taler/taler_util.h> 27 #include <taler/taler_json_lib.h> 28 #include "challenger_util.h" 29 #include "challenger_database_lib.h" 30 31 32 /** 33 * Begin the authorization phase of a validation: record the client's OAuth2 34 * scope, state, redirect URI and PKCE code challenge on the validation 35 * identified by @a nonce, and return the current status (last address, 36 * remaining attempt counters, whether it is already solved). Succeeds only if 37 * the supplied @a client_redirect_uri matches the one registered for the client. 38 * 39 * @param cls 40 * @param nonce unique nonce to use to identify the validation 41 * @param client_id client that initiated the validation 42 * @param client_scope scope of the validation 43 * @param client_state state of the client 44 * @param client_redirect_uri where to redirect at the end, NULL to use a unique one registered for the client 45 * @param code_challenge PKCE code challenge 46 * @param code_challenge_method PKCE code challenge method enum 47 * @param[out] last_address set to the last address used 48 * @param[out] address_attempts_left set to number of address changing attempts left for this address 49 * @param[out] pin_transmissions_left set to number of times the PIN can still be re-requested 50 * @param[out] auth_attempts_left set to number of authentication attempts remaining 51 * @param[out] solved set to true if the challenge is already solved 52 * @param[out] last_tx_time set to the last time when we (presumably) send a PIN to @a last_address; 0 if never sent 53 * @return transaction status: 54 * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the validation exists and the 55 * OAuth2 scope/state/redirect/PKCE parameters were recorded 56 * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if no validation matches @a nonce and 57 * @a client_id, or the supplied @a client_redirect_uri does not match the 58 * redirect URI registered for the client 59 * #GNUNET_DB_STATUS_HARD_ERROR on failure 60 */ 61 enum GNUNET_DB_QueryStatus 62 CHALLENGERDB_authorize_start ( 63 struct CHALLENGERDB_PostgresContext *ctx, 64 const struct CHALLENGER_ValidationNonceP *nonce, 65 uint64_t client_id, 66 const char *client_scope, 67 const char *client_state, 68 const char *client_redirect_uri, 69 const char *code_challenge, 70 uint32_t code_challenge_method, 71 json_t **last_address, 72 uint32_t *address_attempts_left, 73 uint32_t *pin_transmissions_left, 74 uint32_t *auth_attempts_left, 75 bool *solved, 76 struct GNUNET_TIME_Absolute *last_tx_time); 77 78 79 #endif