1 /*------------------------------------------------------------------------------
2 Name: SecurityQos.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: The qos for the security (a subelement of connect qos)
6 ------------------------------------------------------------------------------*/
7
8 /**
9 * Parse the default security handling with loginName and password
10 * from the login qos xml std::string:
11 * <pre>
12 * <securityService type="simple" version="1.0">
13 * <user>aUser</user>
14 * <passwd>theUsersPwd</passwd>
15 * </securityService>
16 * </pre>
17 */
18 #ifndef _AUTHENTICATION_SECURITY_QOS_H
19 #define _AUTHENTICATION_SECURITY_QOS_H
20
21 #include <util/xmlBlasterDef.h>
22 #include <util/I_Log.h>
23 #include <string>
24
25 namespace org { namespace xmlBlaster { namespace authentication {
26
27 class Dll_Export SecurityQos
28 {
29 friend class SecurityQosFactory;
30 private:
31 const std::string ME;
32 org::xmlBlaster::util::Global& global_;
33 org::xmlBlaster::util::I_Log& log_;
34 std::string type_;
35 std::string version_;
36 std::string user_;
37 std::string passwd_;
38
39 void copy(const SecurityQos& securityQos)
40 {
41 type_ = securityQos.type_;
42 version_ = securityQos.version_;
43 user_ = securityQos.user_;
44 passwd_ = securityQos.passwd_;
45 }
46
47 public:
48 /**
49 * @param loginName The authentication user ID
50 * @param passwd The password (for name/password based credential plugins)
51 * @param pluginTypeVersion The authentication plugin to be used on server side, for example "htpasswd,1.0"
52 */
53 SecurityQos(org::xmlBlaster::util::Global& global,
54 const std::string& loginName="",
55 const std::string& password="",
56 const std::string& pluginTypeVersion="");
57
58 SecurityQos(const SecurityQos& securityQos);
59
60 SecurityQos& operator =(const SecurityQos& securityQos);
61
62 std::string getPluginVersion() const;
63
64 std::string getPluginType() const;
65
66 void setUserId(const std::string& userId);
67
68 std::string getUserId() const;
69
70 /**
71 * @param cred The password
72 */
73 void setCredential(const std::string& cred);
74
75 /**
76 * @return "" (empty std::string) (no password is delivered)
77 */
78 std::string getCredential() const;
79
80 /**
81 * Dump state of this object into a XML ASCII std::string.
82 * <br>
83 * @param extraOffset indenting of tags for nice output
84 * @return The xml representation
85 */
86 std::string toXml(const std::string& extraOffset="");
87 };
88
89 }}} // namespaces
90
91 #endif
syntax highlighted by Code2HTML, v. 0.9.1