LCOV - code coverage report
Current view: top level - challengerdb - validation_get_pkce.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2026-06-09 21:00:27 Functions: 100.0 % 1 1

            Line data    Source code
       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/challengerdb/validation_get_pkce.c
      18              :  * @brief Implementation of the validation_get_pkce function for Postgres
      19              :  * @author Bohdan Potuzhnyi
      20              :  * @author Vlada Svirsh
      21              :  */
      22              : #include "platform.h"
      23              : #include <taler/taler_error_codes.h>
      24              : #include <taler/taler_dbevents.h>
      25              : #include <taler/taler_pq_lib.h>
      26              : #include "validation_get_pkce.h"
      27              : #include "pg_helper.h"
      28              : 
      29              : enum GNUNET_DB_QueryStatus
      30            3 : CHALLENGERDB_validation_get_pkce (struct CHALLENGERDB_PostgresContext *ctx,
      31              :                       const struct CHALLENGER_ValidationNonceP *nonce,
      32              :                       char **client_secret,
      33              :                       json_t **address,
      34              :                       char **client_scope,
      35              :                       char **client_state,
      36              :                       char **client_redirect_uri,
      37              :                       char **code_challenge,
      38              :                       uint32_t *code_challenge_method)
      39              : {
      40            3 :   struct GNUNET_PQ_QueryParam params[] = {
      41            3 :     GNUNET_PQ_query_param_auto_from_type (nonce),
      42              :     GNUNET_PQ_query_param_end
      43              :   };
      44            3 :   struct GNUNET_PQ_ResultSpec rs[] = {
      45            3 :     GNUNET_PQ_result_spec_string ("client_secret",
      46              :                                   client_secret),
      47            3 :     GNUNET_PQ_result_spec_allow_null (
      48              :       TALER_PQ_result_spec_json ("address",
      49              :                                  address),
      50              :       NULL),
      51            3 :     GNUNET_PQ_result_spec_allow_null (
      52              :       GNUNET_PQ_result_spec_string ("client_scope",
      53              :                                     client_scope),
      54              :       NULL),
      55            3 :     GNUNET_PQ_result_spec_allow_null (
      56              :       GNUNET_PQ_result_spec_string ("client_state",
      57              :                                     client_state),
      58              :       NULL),
      59            3 :     GNUNET_PQ_result_spec_string ("redirect_uri",
      60              :                                   client_redirect_uri),
      61            3 :     GNUNET_PQ_result_spec_allow_null (
      62              :       GNUNET_PQ_result_spec_string ("code_challenge",
      63              :                                     code_challenge),
      64              :       NULL),
      65            3 :     GNUNET_PQ_result_spec_allow_null (
      66              :       GNUNET_PQ_result_spec_uint32 ("code_challenge_method",
      67              :                                     code_challenge_method),
      68              :       NULL),
      69              :     GNUNET_PQ_result_spec_end
      70              :   };
      71              : 
      72            3 :   *client_scope = NULL;
      73            3 :   *client_state = NULL;
      74            3 :   *address = NULL;
      75            3 :   PREPARE (ctx,
      76              :            "validation_get_pkce",
      77              :            "SELECT "
      78              :            "  client_secret"
      79              :            " ,address"
      80              :            " ,client_scope"
      81              :            " ,client_state"
      82              :            " ,COALESCE(client_redirect_uri,uri) AS redirect_uri"
      83              :            " ,code_challenge"
      84              :            " ,code_challenge_method"
      85              :            " FROM validations"
      86              :            " JOIN clients "
      87              :            "  USING (client_serial_id)"
      88              :            " WHERE nonce=$1");
      89            3 :   return GNUNET_PQ_eval_prepared_singleton_select (ctx->conn,
      90              :                                                    "validation_get_pkce",
      91              :                                                    params,
      92              :                                                    rs);
      93              : }
        

Generated by: LCOV version 2.0-1