]> git.proxmox.com Git - ceph.git/blob - ceph/src/auth/AuthSessionHandler.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / auth / AuthSessionHandler.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15
16 #ifndef CEPH_AUTHSESSIONHANDLER_H
17 #define CEPH_AUTHSESSIONHANDLER_H
18
19 #include "include/common_fwd.h"
20 #include "include/types.h"
21 #include "Auth.h"
22
23 #define SESSION_SIGNATURE_FAILURE -1
24
25 // Defines the security applied to ongoing messages in a session, once the session is established. PLR
26
27 class Message;
28
29 struct AuthSessionHandler {
30 virtual ~AuthSessionHandler() = default;
31 virtual int sign_message(Message *message) = 0;
32 virtual int check_message_signature(Message *message) = 0;
33 };
34
35 struct DummyAuthSessionHandler : AuthSessionHandler {
36 int sign_message(Message*) final {
37 return 0;
38 }
39 int check_message_signature(Message*) final {
40 return 0;
41 }
42 };
43
44 struct DecryptionError : public std::exception {};
45
46 extern AuthSessionHandler *get_auth_session_handler(
47 CephContext *cct, int protocol,
48 const CryptoKey& key,
49 uint64_t features);
50
51 #endif