]>
git.proxmox.com Git - ceph.git/blob - ceph/src/auth/AuthClientHandler.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
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.
15 #ifndef CEPH_AUTHCLIENTHANDLER_H
16 #define CEPH_AUTHCLIENTHANDLER_H
19 #include "auth/Auth.h"
20 #include "include/common_fwd.h"
23 class RotatingKeyRing
;
25 class AuthClientHandler
{
35 explicit AuthClientHandler(CephContext
*cct_
)
36 : cct(cct_
), global_id(0), want(CEPH_ENTITY_TYPE_AUTH
), have(0), need(0)
38 virtual ~AuthClientHandler() {}
40 void init(const EntityName
& n
) { name
= n
; }
42 void set_want_keys(__u32 keys
) {
43 want
= keys
| CEPH_ENTITY_TYPE_AUTH
;
47 virtual int get_protocol() const = 0;
49 virtual void reset() = 0;
50 virtual void prepare_build_request() = 0;
51 virtual void build_initial_request(ceph::buffer::list
*bl
) const {
52 // this is empty for methods cephx and none.
54 virtual int build_request(ceph::buffer::list
& bl
) const = 0;
55 virtual int handle_response(int ret
, ceph::buffer::list::const_iterator
& iter
,
56 CryptoKey
*session_key
,
57 std::string
*connection_secret
) = 0;
58 virtual bool build_rotating_request(ceph::buffer::list
& bl
) const = 0;
60 virtual AuthAuthorizer
*build_authorizer(uint32_t service_id
) const = 0;
62 virtual bool need_tickets() = 0;
64 virtual void set_global_id(uint64_t id
) = 0;
66 static AuthClientHandler
* create(CephContext
* cct
, int proto
, RotatingKeyRing
* rkeys
);
68 virtual void validate_tickets() = 0;