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{
15 enum class JwtIssuerKeyFilter : uint8_t
16 {
17 All
18 };
19
21
23 {
25 std::optional<std::string> ca_cert_bundle_name;
27 bool auto_refresh = false;
28 };
29
33 JwtIssuerMetadata, ca_cert_bundle_name, auto_refresh);
34
35 using JwtIssuer = std::string;
36 using JwtKeyId = std::string;
37 using Cert = std::vector<uint8_t>;
38 using ECPublicKey = std::vector<uint8_t>;
39
41 {
44 std::optional<JwtIssuer> constraint;
45 };
49
52
54 {
57 std::optional<JwtIssuer> constraint;
58 };
62
65
67
68 namespace Tables
69 {
70 static constexpr auto JWT_ISSUERS = "public:ccf.gov.jwt.issuers";
71
72 static constexpr auto JWT_PUBLIC_SIGNING_KEYS_METADATA =
73 "public:ccf.gov.jwt.public_signing_keys_metadata_v2";
74 }
75
77 {
78 std::vector<ccf::crypto::JsonWebKeyData> keys;
79
80 bool operator!=(const JsonWebKeySet& rhs) const
81 {
82 return keys != rhs.keys;
83 }
84 };
85 DECLARE_JSON_TYPE(JsonWebKeySet)
86 DECLARE_JSON_REQUIRED_FIELDS(JsonWebKeySet, keys)
87}
Definition map.h:30
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:718
#define DECLARE_JSON_TYPE(TYPE)
Definition json.h:667
#define DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(TYPE)
Definition json.h:694
#define DECLARE_JSON_OPTIONAL_FIELDS(TYPE,...)
Definition json.h:790
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:841
Definition app_interface.h:14
std::vector< uint8_t > Cert
Definition jwt.h:37
std::string JwtIssuer
Definition jwt.h:35
JwtIssuerKeyFilter
Definition jwt.h:16
std::vector< uint8_t > ECPublicKey
Definition jwt.h:38
std::string JwtKeyId
Definition jwt.h:36
Definition jwt.h:77
std::vector< ccf::crypto::JsonWebKeyData > keys
Definition jwt.h:78
bool operator!=(const JsonWebKeySet &rhs) const
Definition jwt.h:80
Definition jwt.h:23
bool auto_refresh
Whether to auto-refresh keys from the issuer.
Definition jwt.h:27
std::optional< std::string > ca_cert_bundle_name
Optional CA bundle name used for authentication when auto-refreshing.
Definition jwt.h:25
Definition jwt.h:54
Cert cert
Definition jwt.h:55
std::optional< JwtIssuer > constraint
Definition jwt.h:57
JwtIssuer issuer
Definition jwt.h:56
Definition jwt.h:41
JwtIssuer issuer
Definition jwt.h:43
ECPublicKey public_key
Definition jwt.h:42
std::optional< JwtIssuer > constraint
Definition jwt.h:44