CCF
Loading...
Searching...
No Matches
jwt.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
5#include "ccf/crypto/jwk.h"
6#include "ccf/ds/json.h"
7#include "ccf/service/map.h"
8
9#include <map>
10#include <optional>
11#include <string>
12
13namespace ccf
14{
16 {
19 std::optional<std::map<std::string, std::string>> sgx_claims;
20
21 bool operator!=(const JwtIssuerKeyPolicy& rhs) const
22 {
23 return rhs.sgx_claims != sgx_claims;
24 }
25 };
26
29
31 {
32 All,
33 SGX
34 };
35
39
41 {
45 std::optional<JwtIssuerKeyPolicy> key_policy;
47 std::optional<std::string> ca_cert_bundle_name;
49 bool auto_refresh = false;
50 };
51
55 JwtIssuerMetadata, key_policy, ca_cert_bundle_name, auto_refresh);
56
57 using JwtIssuer = std::string;
58 using JwtKeyId = std::string;
59 using Cert = std::vector<uint8_t>;
60
62 {
65 std::optional<JwtIssuer> constraint;
66 };
70
74
75 namespace Tables
76 {
77 static constexpr auto JWT_ISSUERS = "public:ccf.gov.jwt.issuers";
78
79 static constexpr auto JWT_PUBLIC_SIGNING_KEYS_METADATA =
80 "public:ccf.gov.jwt.public_signing_keys_metadata";
81
82 namespace Legacy
83 {
84 static constexpr auto JWT_PUBLIC_SIGNING_KEYS =
85 "public:ccf.gov.jwt.public_signing_key";
86 static constexpr auto JWT_PUBLIC_SIGNING_KEY_ISSUER =
87 "public:ccf.gov.jwt.public_signing_key_issuer";
88
93 }
94 }
95
97 {
98 std::vector<ccf::crypto::JsonWebKey> keys;
99
100 bool operator!=(const JsonWebKeySet& rhs) const
101 {
102 return keys != rhs.keys;
103 }
104 };
105 DECLARE_JSON_TYPE(JsonWebKeySet)
106 DECLARE_JSON_REQUIRED_FIELDS(JsonWebKeySet, keys)
107}
Definition map.h:30
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:712
#define DECLARE_JSON_TYPE(TYPE)
Definition json.h:661
#define DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(TYPE)
Definition json.h:688
#define DECLARE_JSON_OPTIONAL_FIELDS(TYPE,...)
Definition json.h:784
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:835
ccf::kv::RawCopySerialisedMap< JwtKeyId, JwtIssuer > JwtPublicSigningKeyIssuer
Definition jwt.h:92
ccf::kv::RawCopySerialisedMap< JwtKeyId, Cert > JwtPublicSigningKeys
Definition jwt.h:90
TypedMap< K, V, ccf::kv::serialisers::BlitSerialiser< K >, ccf::kv::serialisers::BlitSerialiser< V > > RawCopySerialisedMap
Definition map.h:105
Definition app_interface.h:15
std::vector< uint8_t > Cert
Definition jwt.h:59
std::string JwtIssuer
Definition jwt.h:57
ServiceMap< JwtIssuer, JwtIssuerMetadata > JwtIssuers
Definition jwt.h:71
JwtIssuerKeyFilter
Definition jwt.h:31
ServiceMap< JwtKeyId, std::vector< OpenIDJWKMetadata > > JwtPublicSigningKeys
Definition jwt.h:73
std::string JwtKeyId
Definition jwt.h:58
Definition jwt.h:97
std::vector< ccf::crypto::JsonWebKey > keys
Definition jwt.h:98
bool operator!=(const JsonWebKeySet &rhs) const
Definition jwt.h:100
Definition jwt.h:16
std::optional< std::map< std::string, std::string > > sgx_claims
Definition jwt.h:19
bool operator!=(const JwtIssuerKeyPolicy &rhs) const
Definition jwt.h:21
Definition jwt.h:41
bool auto_refresh
Whether to auto-refresh keys from the issuer.
Definition jwt.h:49
std::optional< std::string > ca_cert_bundle_name
Optional CA bundle name used for authentication when auto-refreshing.
Definition jwt.h:47
std::optional< JwtIssuerKeyPolicy > key_policy
Optional Key Policy.
Definition jwt.h:45
JwtIssuerKeyFilter key_filter
JWT issuer key filter.
Definition jwt.h:43
Definition jwt.h:62
JwtIssuer issuer
Definition jwt.h:64
Cert cert
Definition jwt.h:63
std::optional< JwtIssuer > constraint
Definition jwt.h:65