Wrapper for Cyrus SASL library.
More...
#include <SimpleLoginManager.h>
|
bool | login () |
| Perform SASL login step. More...
|
|
virtual std::string | getAuthname () |
| Callback to get login name.
|
|
virtual std::string | getPassword () |
| Callback to get password.
|
|
virtual std::string | getRealm (const std::vector< const char *> &) |
| Callback to get realm.
|
|
virtual std::string | getOption (const char *, const char *) |
| SASL get option callback.
|
|
virtual std::string | interact (unsigned long, const char *, const char *, const char *) |
| SASL interact callback.
|
|
virtual void | completed (LoginResult result)=0 |
| Authentification completed callback. More...
|
|
virtual void | log (int level, const char *message) |
| Log callback. More...
|
|
void | logout () |
| Logout from server.
|
|
bool | loginStep (const char *mech, const char *clientData) |
| Perform SASL login step. More...
|
|
void | logout () |
| Logout from server.
|
|
|
class | impl::SimpleLoginManager |
|
Wrapper for Cyrus SASL library.
This class provides a nice interface to enable simple authentification. All you have to do is overriding some of the callbacks below. First, register your instance to the Process using Process::setAuthManager(). After that, call login(). Then, call Process::asyncData() until completed() is called. During this process, you're being asked to enter credentials via the given callbacks.
- Examples:
- sasl_example.cpp.
◆ LoginResult
Result of login operation.
Enumerator |
---|
NoSaslMechanism | No matching SASL Mechanism found on client machine.
|
◆ SimpleLoginManager()
PdCom::SimpleLoginManager::SimpleLoginManager |
( |
const char * |
remote_host, |
|
|
sasl_callback * |
additional_callbacks = nullptr |
|
) |
| |
Constructor.
- Parameters
-
remote_host | Remote hostname. |
additional_callbacks | NULL-terminated list of additional callback handlers. |
◆ completed()
virtual void PdCom::SimpleLoginManager::completed |
( |
LoginResult |
result | ) |
|
|
protectedpure virtual |
Authentification completed callback.
- Parameters
-
result | Outcome of login operation. |
- Examples:
- sasl_example.cpp.
◆ InitLibrary()
static void PdCom::SimpleLoginManager::InitLibrary |
( |
const char * |
plugin_path = nullptr | ) |
|
|
static |
Sasl global initialization.
Call this at startup of your application to initialize the underlying sasl library.
- Exceptions
-
- Examples:
- sasl_example.cpp.
◆ log()
virtual void PdCom::SimpleLoginManager::log |
( |
int |
level, |
|
|
const char * |
message |
|
) |
| |
|
protectedvirtual |
Log callback.
- Parameters
-
level | Log level, 0 to 7. 7 may contain passwords. |
message | Message. |
◆ login()
bool PdCom::SimpleLoginManager::login |
( |
| ) |
|
|
protected |
Perform SASL login step.
- Parameters
-
mech | SASL mechanism |
clientData | Base64 encoded SASL output data to server |
Setting both mech
and clientData
to NULL will initate the login process.
Every call to login() is answered by a loginReply(), unless login is not supported. When login is mandatory, loginReply() will be called automatically.
- Returns
- false if login is not supported
- Examples:
- sasl_example.cpp.
The documentation for this class was generated from the following file: