/usr/include/Wt/Auth/Login is in libwt-dev 3.3.4+dfsg-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_AUTH_LOGIN_H_
#define WT_AUTH_LOGIN_H_
#include <Wt/WObject>
#include <Wt/WSignal>
#include <Wt/Auth/User>
namespace Wt {
namespace Auth {
class User;
/*! \brief Enumeration for a login state.
*
* \sa Login::state()
*
* \ingroup auth
*/
enum LoginState {
/*! \brief No user is currently identified.
*/
LoggedOut,
/*! \brief The identified user was refused to login.
*
* This is caused by for example User::status() returning
* User::Disabled, or if email verification is required but the
* email hasn't been verified yet.
*/
DisabledLogin,
/*! \brief A user is weakly authenticated.
*
* The authentication method was weak, typically this means that a secondary
* authentication system was used (e.g. an authentication cookie) instead
* of a primary mechanism (like a password).
*
* You may want to allow certain operations, but request to authenticate
* fully before more senstive operations.
*/
WeakLogin,
/*! \brief A user is strongly authenticated.
*/
StrongLogin
};
/*! \class Login Wt/Auth/Login
* \brief A class that manages the current login state.
*
* This is a model class which is typically associated with a single
* session, for the duration of the session.
*
* Widgets that implement authentication (and thus produce
* authentication changes), will indicate their result in this object
* using the login() or logout() methods.
*
* Widgets that want to react to login state changes (typically, as
* user logging in or out) should listen to the changed() signal of
* this object.
*
* \sa AuthWidget
*
* \ingroup auth
*/
class WT_API Login : public WObject
{
public:
/*! \brief Default constructor.
*
* Creates a login object in the LoggedOut state.
*/
Login();
/*! \brief Logs a user in.
*
* A user can be logged in using either a DisabledLogin, WeakLogin
* or StrongLogin \p state. The login state is forced to DisabledLogin if
* User::status() returns Disabled.
*
* \sa logout(), loggedIn()
*/
void login(const User& user, LoginState state = StrongLogin);
/*! \brief Logs the current user out.
*
* Sets the state to LoggedOut.
*/
void logout();
/*! \brief Returns the current login state.
*
* \sa login(), logout()
*/
LoginState state() const;
/*! \brief Returns whether a user has successfully logged in.
*
* This returns \c true only if the state is WeakLogin or StrongLogin.
*
* \sa state()
*/
bool loggedIn() const;
/*! \brief Returns the user currently identified.
*
* Returns the user currently identified.
*
* \note This may also be a user whose account is currently disabled.
*/
const User& user() const;
/*! \brief %Signal that indicates login changes.
*
* This signal is emitted as a result of login() or logout().
*/
Signal<>& changed() { return changed_; }
private:
Signal<> changed_;
User user_;
LoginState state_;
};
}
}
#endif // WT_AUTH_LOGIN
|