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 {
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 PublicKey = 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 namespace Legacy
76 {
77 static constexpr auto JWT_PUBLIC_SIGNING_KEYS =
78 "public:ccf.gov.jwt.public_signing_key";
79 static constexpr auto JWT_PUBLIC_SIGNING_KEY_ISSUER =
80 "public:ccf.gov.jwt.public_signing_key_issuer";
81 static constexpr auto JWT_PUBLIC_SIGNING_KEYS_METADATA =
82 "public:ccf.gov.jwt.public_signing_keys_metadata";
83
88 }
89 }
90
92 {
93 std::vector<ccf::crypto::JsonWebKeyData> keys;
94
95 bool operator!=(const JsonWebKeySet& rhs) const
96 {
97 return keys != rhs.keys;
98 }
99 };
100 DECLARE_JSON_TYPE(JsonWebKeySet)
101 DECLARE_JSON_REQUIRED_FIELDS(JsonWebKeySet, keys)
102}
Definition map.h:30
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:714
#define DECLARE_JSON_TYPE(TYPE)
Definition json.h:663
#define DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(TYPE)
Definition json.h:690
#define DECLARE_JSON_OPTIONAL_FIELDS(TYPE,...)
Definition json.h:786
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:837
Definition app_interface.h:14
std::vector< uint8_t > Cert
Definition jwt.h:37
std::string JwtIssuer
Definition jwt.h:35
std::vector< uint8_t > PublicKey
Definition jwt.h:38
JwtIssuerKeyFilter
Definition jwt.h:16
std::string JwtKeyId
Definition jwt.h:36
Definition jwt.h:92
std::vector< ccf::crypto::JsonWebKeyData > keys
Definition jwt.h:93
bool operator!=(const JsonWebKeySet &rhs) const
Definition jwt.h:95
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
PublicKey public_key
Definition jwt.h:42
std::optional< JwtIssuer > constraint
Definition jwt.h:44