]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | #ifndef CEPH_AUTHAUTHORIZEHANDLER_H | |
16 | #define CEPH_AUTHAUTHORIZEHANDLER_H | |
17 | ||
18 | #include "Auth.h" | |
19 | #include "AuthMethodList.h" | |
20 | #include "include/types.h" | |
21 | #include "common/Mutex.h" | |
22 | // Different classes of session crypto handling | |
23 | ||
24 | #define SESSION_CRYPTO_NONE 0 | |
25 | #define SESSION_SYMMETRIC_AUTHENTICATE 1 | |
26 | #define SESSION_SYMMETRIC_ENCRYPT 2 | |
27 | ||
28 | class CephContext; | |
29 | class KeyRing; | |
30 | class RotatingKeyRing; | |
31 | ||
32 | struct AuthAuthorizeHandler { | |
33 | virtual ~AuthAuthorizeHandler() {} | |
34 | virtual bool verify_authorizer(CephContext *cct, KeyStore *keys, | |
35 | bufferlist& authorizer_data, bufferlist& authorizer_reply, | |
36 | EntityName& entity_name, uint64_t& global_id, | |
28e407b8 AA |
37 | AuthCapsInfo& caps_info, CryptoKey& session_key, |
38 | uint64_t *auid, | |
39 | std::unique_ptr<AuthAuthorizerChallenge> *challenge) = 0; | |
7c673cae FG |
40 | virtual int authorizer_session_crypto() = 0; |
41 | }; | |
42 | ||
43 | class AuthAuthorizeHandlerRegistry { | |
44 | Mutex m_lock; | |
45 | map<int,AuthAuthorizeHandler*> m_authorizers; | |
46 | AuthMethodList supported; | |
47 | ||
48 | public: | |
49 | AuthAuthorizeHandlerRegistry(CephContext *cct_, std::string methods) | |
50 | : m_lock("AuthAuthorizeHandlerRegistry::m_lock"), supported(cct_, methods) | |
51 | {} | |
52 | ~AuthAuthorizeHandlerRegistry(); | |
53 | ||
54 | AuthAuthorizeHandler *get_handler(int protocol); | |
55 | }; | |
56 | ||
57 | #endif |