CCF
Loading...
Searching...
No Matches
all_of_auth.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
6
7#include <map>
8
9namespace ccf
10{
11 // To require _multiple_ authentication types, a conjoined policy can be
12 // formed. It will pass if and only if all of its member policies pass, and
13 // return all of their extracted identities.
15 {
16 std::map<std::string, std::unique_ptr<AuthnIdentity>> identities;
17
18 std::string get_conjoined_name() const;
19 };
20
22 {
23 public:
24 using Policies = std::map<std::string, std::shared_ptr<AuthnPolicy>>;
25
26 private:
27 Policies policies;
28 std::string scheme_name;
29
30 public:
31 // Provide policies with explicit names
32 AllOfAuthnPolicy(Policies _policies);
33
34 // Try to auto-select names, by calling get_security_scheme_name() on each
35 // policy. Will throw if it finds duplicate names.
37 const std::vector<std::shared_ptr<AuthnPolicy>>& _policies);
38
39 std::unique_ptr<AuthnIdentity> authenticate(
41 const std::shared_ptr<ccf::RpcContext>&,
42 std::string&) override;
43
45 std::shared_ptr<ccf::RpcContext>, std::string&&) override;
46
47 std::optional<OpenAPISecuritySchema> get_openapi_security_schema()
48 const override;
49
50 std::string get_security_scheme_name() override;
51 };
52}
Definition all_of_auth.h:22
std::map< std::string, std::shared_ptr< AuthnPolicy > > Policies
Definition all_of_auth.h:24
std::optional< OpenAPISecuritySchema > get_openapi_security_schema() const override
Definition all_of_auth.cpp:125
std::unique_ptr< AuthnIdentity > authenticate(ccf::kv::ReadOnlyTx &, const std::shared_ptr< ccf::RpcContext > &, std::string &) override
Definition all_of_auth.cpp:68
void set_unauthenticated_error(std::shared_ptr< ccf::RpcContext >, std::string &&) override
Definition all_of_auth.cpp:103
std::string get_security_scheme_name() override
Definition all_of_auth.cpp:130
Definition authentication_types.h:28
Definition tx.h:160
Definition app_interface.h:14
Definition all_of_auth.h:15
std::string get_conjoined_name() const
Definition all_of_auth.cpp:10
std::map< std::string, std::unique_ptr< AuthnIdentity > > identities
Definition all_of_auth.h:16
Definition authentication_types.h:19