}
return new CephxSessionHandler(cct, key, connection_secret, features);
case CEPH_AUTH_NONE:
- return new AuthNoneSessionHandler(cct, key, connection_secret);
+ return new AuthNoneSessionHandler();
case CEPH_AUTH_UNKNOWN:
- return new AuthUnknownSessionHandler(cct, key, connection_secret);
+ return new AuthUnknownSessionHandler();
#ifdef HAVE_GSSAPI
case CEPH_AUTH_GSS:
- return new KrbSessionHandler(cct, key, connection_secret);
+ return new KrbSessionHandler();
#endif
default:
return nullptr;
class Message;
struct AuthSessionHandler {
-protected:
- CephContext *cct;
- int protocol;
- CryptoKey key; // per mon authentication
- std::string connection_secret; // per connection
-
-public:
- explicit AuthSessionHandler(CephContext *cct_) : cct(cct_), protocol(CEPH_AUTH_UNKNOWN) {}
-
- AuthSessionHandler(CephContext *cct_, int protocol_,
- const CryptoKey& key_,
- const std::string& cs_)
- : cct(cct_),
- protocol(protocol_),
- key(key_),
- connection_secret(cs_) {}
- virtual ~AuthSessionHandler() { }
-
+ virtual ~AuthSessionHandler() = default;
virtual int sign_message(Message *message) = 0;
virtual int check_message_signature(Message *message) = 0;
virtual int encrypt_message(Message *message) = 0;
class Message;
class CephxSessionHandler : public AuthSessionHandler {
+ CephContext *cct;
+ int protocol;
+ CryptoKey key; // per mon authentication
+ std::string connection_secret; // per connection
uint64_t features;
public:
- CephxSessionHandler(CephContext *cct_,
+ CephxSessionHandler(CephContext *cct,
const CryptoKey& session_key,
const std::string& connection_secret,
- uint64_t features)
- : AuthSessionHandler(cct_, CEPH_AUTH_CEPHX, session_key, connection_secret),
- features(features) {}
- ~CephxSessionHandler() override {}
+ const uint64_t features)
+ : cct(cct),
+ protocol(CEPH_AUTH_CEPHX),
+ key(session_key),
+ connection_secret(connection_secret),
+ features(features) {
+ }
+ ~CephxSessionHandler() override = default;
int _calc_signature(Message *m, uint64_t *psig);
#define dout_subsys ceph_subsys_auth
-
-class CephContext;
class Message;
class KrbSessionHandler : public AuthSessionHandler {
public:
- KrbSessionHandler(CephContext* ceph_ctx,
- const CryptoKey& session_key,
- const std::string& connection_secret) :
- AuthSessionHandler(ceph_ctx, CEPH_AUTH_GSS, session_key,
- connection_secret) { }
+ KrbSessionHandler() = default;
~KrbSessionHandler() override = default;
// No security
#include "auth/AuthSessionHandler.h"
#include "msg/Message.h"
-class CephContext;
-
-class AuthNoneSessionHandler : public AuthSessionHandler {
+class AuthNoneSessionHandler : public AuthSessionHandler {
public:
- AuthNoneSessionHandler(CephContext *cct_,
- const CryptoKey& session_key,
- const std::string& connection_secret)
- : AuthSessionHandler(cct_, CEPH_AUTH_NONE, session_key, connection_secret) {}
- ~AuthNoneSessionHandler() override {}
+ AuthNoneSessionHandler() = default;
+ ~AuthNoneSessionHandler() override = default;
// The None suite neither signs nor encrypts messages, so these functions just return success.
// Since nothing was signed or encrypted, don't increment the stats. PLR
#define dout_subsys ceph_subsys_auth
-class CephContext;
-
-class AuthUnknownSessionHandler : public AuthSessionHandler {
+class AuthUnknownSessionHandler : public AuthSessionHandler {
public:
- AuthUnknownSessionHandler(CephContext *cct_,
- const CryptoKey& session_key,
- const std::string& connection_secret)
- : AuthSessionHandler(cct_, CEPH_AUTH_UNKNOWN,
- session_key, connection_secret) {}
- ~AuthUnknownSessionHandler() override {}
+ AuthUnknownSessionHandler() = default;
+ ~AuthUnknownSessionHandler() override = default;
// The Unknown suite neither signs nor encrypts messages, so these functions just return success.
// Since nothing was signed or encrypted, don't increment the stats. PLR