- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
authprovider.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2014 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6
7 #ifndef _QI_MESSAGING_AUTHPROVIDER_HPP_
8 #define _QI_MESSAGING_AUTHPROVIDER_HPP_
9
10 #include <string>
11 #include <map>
12 #include <stdexcept>
13
14 #include <boost/shared_ptr.hpp>
15
16 #include <qi/api.hpp>
17 #include <qi/anyvalue.hpp>
18
19 namespace qi
20 {
21 using CapabilityMap = std::map<std::string, AnyValue>;
22
23 class QI_API AuthProvider
24 {
25 public:
26 static const std::string State_Key;
27 enum State
28 {
29 State_Error = 1,
30 State_Cont,
31 State_Done,
32 };
33 static const std::string Error_Reason_Key;
34
35 static const std::string UserAuthPrefix;
36 static const std::string QiAuthPrefix;
37
38 virtual ~AuthProvider()
39 {
40 }
41 CapabilityMap processAuth(const CapabilityMap& authData);
42
43 protected:
44 /*
45 * Processes an authentication messages, then returns a map of values.
46 * The returned map MUST include an element at index `State_Key`,
47 * containing:
48 * - `State_Error` if the authentication attempt is unsuccessful; if a
49 * value exists at index `Error_Reason_Key` it will be sent to the client.
50 * - `State_Cont` if the authentication attempt needs further processing;
51 * the rest of the map will be sent to the client.
52 * - `State_Done` if the authentication succeeded. The rest of the map will
53 * be left unused.
54 * If this token is missing or yields an unknown value the server will QI_ASSERT()
55 * and terminate the client's connection.
56 */
57 virtual CapabilityMap _processAuth(const CapabilityMap& authData) = 0;
58 };
59
60 using AuthProviderPtr = boost::shared_ptr<AuthProvider>;
61 }
62
63 #endif
qi::AuthProvider::QiAuthPrefix
static const std::string QiAuthPrefix
Definition: authprovider.hpp:36
QI_API
#define QI_API
Definition: api.hpp:33
qi::AuthProvider::~AuthProvider
virtual ~AuthProvider()
Definition: authprovider.hpp:38
qi::AuthProvider
Definition: authprovider.hpp:23
qi::AuthProvider::State
State
Definition: authprovider.hpp:27
api.hpp
dll import/export and compiler message
qi::AuthProvider::State_Cont
Definition: authprovider.hpp:30
anyvalue.hpp
qi::AuthProvider::State_Key
static const std::string State_Key
Definition: authprovider.hpp:26
qi::AuthProviderPtr
boost::shared_ptr< AuthProvider > AuthProviderPtr
Definition: authprovider.hpp:60
qi::CapabilityMap
std::map< std::string, AnyValue > CapabilityMap
Definition: authprovider.hpp:21
qi::AuthProvider::Error_Reason_Key
static const std::string Error_Reason_Key
Definition: authprovider.hpp:33
qi::AuthProvider::State_Done
Definition: authprovider.hpp:31
qi::AuthProvider::UserAuthPrefix
static const std::string UserAuthPrefix
Definition: authprovider.hpp:35