]> git.proxmox.com Git - ceph.git/blob - ceph/src/auth/AuthServer.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / auth / AuthServer.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #pragma once
5
6 #include "AuthRegistry.h"
7 #include "include/common_fwd.h"
8
9 #include <vector>
10
11 class Connection;
12
13 class AuthServer {
14 public:
15 AuthRegistry auth_registry;
16
17 AuthServer(CephContext *cct) : auth_registry(cct) {}
18 virtual ~AuthServer() {}
19
20 /// Get authentication methods and connection modes for the given peer type
21 virtual void get_supported_auth_methods(
22 int peer_type,
23 std::vector<uint32_t> *methods,
24 std::vector<uint32_t> *modes = nullptr) {
25 auth_registry.get_supported_methods(peer_type, methods, modes);
26 }
27
28 /// Get support connection modes for the given peer type and auth method
29 virtual void get_supported_con_modes(
30 int peer_type,
31 uint32_t auth_method,
32 std::vector<uint32_t> *modes) {
33 auth_registry.get_supported_modes(peer_type, auth_method, modes);
34 }
35
36 /// Get support connection modes for the given peer type and auth method
37 virtual uint32_t pick_con_mode(
38 int peer_type,
39 uint32_t auth_method,
40 const std::vector<uint32_t>& preferred_modes) {
41 return auth_registry.pick_mode(peer_type, auth_method, preferred_modes);
42 }
43
44 /// return an AuthAuthorizeHandler for the given peer type and auth method
45 AuthAuthorizeHandler *get_auth_authorize_handler(
46 int peer_type,
47 int auth_method) {
48 return auth_registry.get_handler(peer_type, auth_method);
49 }
50
51 /// Handle an authentication request on an incoming connection
52 virtual int handle_auth_request(
53 Connection *con,
54 AuthConnectionMeta *auth_meta,
55 bool more, ///< true if this is not the first part of the handshake
56 uint32_t auth_method,
57 const ceph::buffer::list& bl,
58 ceph::buffer::list *reply) = 0;
59 };