28 namespace RobotRaconteur
30 class ROBOTRACONTEUR_CORE_API UserAuthenticator;
31 class ROBOTRACONTEUR_CORE_API ServerContext;
56 RR_SHARED_PTR<UserAuthenticator> Authenticator;
57 std::map<std::string, std::string> Policies;
74 const std::map<std::string, std::string>& Policies);
89 std::string m_Username;
90 std::vector<std::string> m_Privileges;
91 std::vector<std::string> m_Properties;
92 boost::posix_time::ptime m_LoginTime;
93 boost::posix_time::ptime m_LastAccessTime;
95 boost::mutex m_LastAccessTime_lock;
97 RR_WEAK_PTR<ServerContext> context;
133 const std::vector<std::string>& properties,
const RR_SHARED_PTR<ServerContext>& context);
172 boost::string_ref username,
const std::map<std::string, RR_INTRUSIVE_PTR<RRValue> >& credentials,
173 const RR_SHARED_PTR<ServerContext>& context,
const RR_SHARED_PTR<ITransportConnection>& transport) = 0;
204 class ROBOTRACONTEUR_CORE_API User
207 std::string username;
208 std::string passwordhash;
209 std::vector<std::string> privileges;
210 std::vector<NodeID> allowed_client_nodeid;
213 std::map<std::string, RR_SHARED_PTR<User> > validusers;
214 bool require_verified_client;
234 void load(boost::string_ref data);
237 RR_OVIRTUAL RR_SHARED_PTR<AuthenticatedUser> AuthenticateUser(
238 boost::string_ref username,
const std::map<std::string, RR_INTRUSIVE_PTR<RRValue> >& credentials,
239 const RR_SHARED_PTR<ServerContext>& context,
const RR_SHARED_PTR<ITransportConnection>& transport) RR_OVERRIDE;
241 static std::string MD5Hash(boost::string_ref text);
244 #ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
boost::shared_ptr< ServiceSecurityPolicy > ServiceSecurityPolicyPtr
Convenience alias for ServiceSecurityPolicy shared_ptr.
Definition: Security.h:246
boost::shared_ptr< PasswordFileUserAuthenticator > PasswordFileUserAuthenticatorPtr
Convenience alias for PasswordFileUserAuthenticator shared_ptr.
Definition: Security.h:252
boost::shared_ptr< AuthenticatedUser > AuthenticatedUserPtr
Convenience alias for AuthenticatedUser shared_ptr.
Definition: Security.h:248
boost::shared_ptr< UserAuthenticator > UserAuthenticatorPtr
Convenience alias for UserAuthenticator shared_ptr.
Definition: Security.h:250
Class representing an authenticated user.
Definition: Security.h:87
virtual boost::posix_time::ptime GetLoginTime()
The user login time.
virtual void UpdateLastAccess()
Update the last access time to now.
virtual std::vector< std::string > GetPrivileges()
The user privileges.
virtual std::string GetUsername()
The authenticated username.
virtual boost::posix_time::ptime GetLastAccessTime()
The user last access time.
virtual std::vector< std::string > GetProperties()
The user properties.
AuthenticatedUser(boost::string_ref username, const std::vector< std::string > &privileges, const std::vector< std::string > &properties, const boost::shared_ptr< ServerContext > &context)
Construct a new AuthenticatedUser.
Simple authenticator using a list of username, password hash, and privileges stored in a file or stri...
Definition: Security.h:201
PasswordFileUserAuthenticator(std::istream &file, bool require_verified_client=false)
Construct a new PasswordFileUserAuthenticator using text supplied as a stream.
PasswordFileUserAuthenticator(boost::string_ref data, bool require_verified_client=false)
Construct a new PasswordFileUserAuthenticator using text supplied as a string.
Security policy for Robot Raconteur service.
Definition: Security.h:54
ServiceSecurityPolicy()
Construct an empty ServiceSecurityPolicy.
ServiceSecurityPolicy(const boost::shared_ptr< UserAuthenticator > &Authenticator, const std::map< std::string, std::string > &Policies)
Construct a ServiceSecurityPolicy.
Base class for user authenticators.
Definition: Security.h:151
virtual boost::shared_ptr< AuthenticatedUser > AuthenticateUser(boost::string_ref username, const std::map< std::string, boost::intrusive_ptr< RRValue > > &credentials, const boost::shared_ptr< ServerContext > &context, const boost::shared_ptr< ITransportConnection > &transport)=0
Authenticate a user using username and credentials.