summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_rest_oidc_provider.h
blob: e64243a4e727e5ad4a29e2bfd462eb22eec716c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp

#pragma once

#include "rgw_rest.h"
#include "rgw_oidc_provider.h"

class RGWRestOIDCProvider : public RGWRESTOp {
  const uint64_t action;
  const uint32_t perm;
protected:
  rgw::ARN resource; // must be initialized before verify_permission()

  int check_caps(const RGWUserCaps& caps) override;

  RGWRestOIDCProvider(uint64_t action, uint32_t perm)
    : action(action), perm(perm) {}
public:
  int verify_permission(optional_yield y) override;
  void send_response() override;
};

class RGWCreateOIDCProvider : public RGWRestOIDCProvider {
  RGWOIDCProviderInfo info;
 public:
  RGWCreateOIDCProvider();

  int init_processing(optional_yield y) override;
  void execute(optional_yield y) override;
  const char* name() const override { return "create_oidc_provider"; }
  RGWOpType get_type() override { return RGW_OP_CREATE_OIDC_PROVIDER; }
};

class RGWDeleteOIDCProvider : public RGWRestOIDCProvider {
  std::string url;
 public:
  RGWDeleteOIDCProvider();

  int init_processing(optional_yield y) override;
  void execute(optional_yield y) override;
  const char* name() const override { return "delete_oidc_provider"; }
  RGWOpType get_type() override { return RGW_OP_DELETE_OIDC_PROVIDER; }
};

class RGWGetOIDCProvider : public RGWRestOIDCProvider {
  std::string url;
 public:
  RGWGetOIDCProvider();

  int init_processing(optional_yield y) override;
  void execute(optional_yield y) override;
  const char* name() const override { return "get_oidc_provider"; }
  RGWOpType get_type() override { return RGW_OP_GET_OIDC_PROVIDER; }
};

class RGWListOIDCProviders : public RGWRestOIDCProvider {
 public:
  RGWListOIDCProviders();

  void execute(optional_yield y) override;
  const char* name() const override { return "list_oidc_providers"; }
  RGWOpType get_type() override { return RGW_OP_LIST_OIDC_PROVIDERS; }
};

class RGWAddClientIdToOIDCProvider : public RGWRestOIDCProvider {
  std::string url;
  std::string client_id;
public:
  RGWAddClientIdToOIDCProvider();

  int init_processing(optional_yield y);
  void execute(optional_yield y) override;
  const char* name() const override { return "add_client_id_to_oidc_provider"; }
  RGWOpType get_type() override { return RGW_OP_ADD_CLIENTID_TO_OIDC_PROVIDER; }
};

class RGWUpdateOIDCProviderThumbprint : public RGWRestOIDCProvider {
  std::string url;
  std::vector<std::string> thumbprints;
public:
  RGWUpdateOIDCProviderThumbprint();

  int init_processing(optional_yield y);
  void execute(optional_yield y) override;
  const char* name() const override { return "update_oidc_provider_thumbprint"; }
  RGWOpType get_type() override { return RGW_OP_UPDATE_OIDC_PROVIDER_THUMBPRINT; }
};