merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

taler-merchant-httpd_mfa.h (4418B)


      1 /*
      2   This file is part of TALER
      3   (C) 2025 Taler Systems SA
      4 
      5   TALER is free software; you can redistribute it and/or modify
      6   it under the terms of the GNU Affero General Public License as
      7   published by the Free Software Foundation; either version 3,
      8   or (at your option) any later version.
      9 
     10   TALER is distributed in the hope that it will be useful, but
     11   WITHOUT ANY WARRANTY; without even the implied warranty of
     12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13   GNU General Public License for more details.
     14 
     15   You should have received a copy of the GNU General Public
     16   License along with TALER; see the file COPYING.  If not,
     17   see <http://www.gnu.org/licenses/>
     18 */
     19 
     20 /**
     21  * @file src/backend/taler-merchant-httpd_mfa.h
     22  * @brief internal APIs for multi-factor authentication (MFA)
     23  * @author Christian Grothoff
     24  */
     25 #ifndef TALER_MERCHANT_HTTPD_MFA_H
     26 #define TALER_MERCHANT_HTTPD_MFA_H
     27 
     28 #include "taler-merchant-httpd.h"
     29 #include "taler/taler_merchant_util.h"
     30 
     31 
     32 /**
     33  * Parse the given @a challenge_id into its parts.
     34  *
     35  * @param[in,out] hc handler context with the connection to the client
     36  * @param challenge_id challenge of "$NUMBER-$H_BODY"
     37  * @param[out] challenge_serial set to $NUMBER
     38  * @param[out] h_body set to $H_BODY (decoded)
     39  * @return #GNUNET_OK on success,
     40  *         #GNUNET_NO if an error message was returned to the client
     41  *         #GNUNET_SYSERR to just close the connection
     42  */
     43 enum GNUNET_GenericReturnValue
     44 TMH_mfa_parse_challenge_id (struct TMH_HandlerContext *hc,
     45                             const char *challenge_id,
     46                             uint64_t *challenge_serial,
     47                             struct TALER_MERCHANT_MFA_BodyHash *h_body);
     48 
     49 
     50 /**
     51  * Check that a set of MFA challenges has been satisfied by the
     52  * client for the request in @a hc.
     53  *
     54  * @param[in,out] hc handler context with the connection to the client
     55  * @param instance_name instance name to use in the message to the customer
     56  * @param op operation for which we should check challenges for
     57  * @param combi_and true to tell the client to solve all challenges (AND),
     58  *       false means that any of the challenges will do (OR)
     59  * @param ... pairs of channel and address, terminated by
     60  *        #TALER_MERCHANT_MFA_CHANNEL_NONE
     61  * @return #GNUNET_OK on success (challenges satisfied)
     62  *         #GNUNET_NO if an error message was returned to the client
     63  *         #GNUNET_SYSERR to just close the connection
     64  */
     65 enum GNUNET_GenericReturnValue
     66 TMH_mfa_challenges_do (
     67   struct TMH_HandlerContext *hc,
     68   const char *instance_name,
     69   enum TALER_MERCHANT_MFA_CriticalOperation op,
     70   bool combi_and,
     71   ...);
     72 
     73 
     74 /**
     75  * Like #TMH_mfa_challenges_do() for the operation
     76  * #TALER_MERCHANT_MFA_CO_AUTH_CONFIGURATION.
     77  *
     78  * @param[in,out] hc handler context with the connection to the client
     79  * @param instance_name instance name to use in the message to the customer
     80  * @param password_reset true if this is an unauthenticated password
     81  *       reset (forgot-password): then new challenges are only started
     82  *       if the last password reset of @a instance_name was started at
     83  *       least 15 minutes ago, otherwise the client gets a 429
     84  * @param combi_and true to tell the client to solve all challenges (AND),
     85  *       false means that any of the challenges will do (OR)
     86  * @param ... pairs of channel and address, terminated by
     87  *        #TALER_MERCHANT_MFA_CHANNEL_NONE
     88  * @return #GNUNET_OK on success (challenges satisfied)
     89  *         #GNUNET_NO if an error message was returned to the client
     90  *         #GNUNET_SYSERR to just close the connection
     91  */
     92 enum GNUNET_GenericReturnValue
     93 TMH_mfa_auth_challenges_do (
     94   struct TMH_HandlerContext *hc,
     95   const char *instance_name,
     96   bool password_reset,
     97   bool combi_and,
     98   ...);
     99 
    100 
    101 /**
    102  * Check MFA for a simple operation that simply requires
    103  * a single additional factor (if any are configured).
    104  *
    105  * @param[in,out] hc handler context with the connection to the client
    106  * @param op operation for which we should check challenges for
    107  * @param mi instance to check authentication for
    108  * @return #GNUNET_OK on success (challenges satisfied)
    109  *         #GNUNET_NO if an error message was returned to the client
    110  *         #GNUNET_SYSERR to just close the connection
    111  */
    112 enum GNUNET_GenericReturnValue
    113 TMH_mfa_check_simple (
    114   struct TMH_HandlerContext *hc,
    115   enum TALER_MERCHANT_MFA_CriticalOperation op,
    116   struct TMH_MerchantInstance *mi);
    117 
    118 
    119 #endif