Session-lock + authentication host for Phosphor-based desktop shells. More...
#include <PhosphorServiceLock/LockService.h>
Public Types | |
| enum class | State { Unlocked , Locking , Locked , Authenticating , Releasing } |
| The lock lifecycle. More... | |
Signals | |
| void | stateChanged () |
| state() changed. | |
| void | authenticationFailed (const QString &reason) |
An unlock() attempt was rejected; reason is a human-readable, non-sensitive explanation. | |
| void | aboutToUnlock () |
| Authentication succeeded and the lock is about to be released. | |
| void | unlocked () |
| The session was successfully unlocked after authentication. | |
Public Member Functions | |
| LockService (QObject *parent=nullptr) | |
| ~LockService () override | |
| QString | userName () const |
| The same local account that PAM authenticates, resolved from the process uid. | |
| bool | isSupported () const |
| Whether the compositor advertises the ext-session-lock-v1 protocol this service builds on. | |
| State | state () const |
| The current lock state. | |
| bool | isLocked () const |
| True while the session is locked (whether idle or authenticating). | |
| void | lock () |
| Request that the compositor lock the session. | |
| void | unlock (const QString &password) |
Attempt to unlock by authenticating the session user with password. | |
| void | finishUnlock () |
| Release the compositor lock after a successful authentication. | |
Session-lock + authentication host for Phosphor-based desktop shells.
Authenticates the session user through PAM and coordinates the ext-session-lock-v1 lock state with the compositor through phosphor-wayland's SessionLock client. It is the policy / state-machine layer over the raw client and the authentication backend; it composes them rather than binding the protocol or talking to PAM in its public surface, so the host is a clean Qt/QML type with no Wayland or PAM types leaking out.
Flow: lock() asks the compositor to lock (state Locking); the compositor confirms (Locked). unlock(password) authenticates the session user (Authenticating); on success the lock is released (Unlocked, unlocked()), on failure the state returns to Locked and authenticationFailed() fires.
Lock surfaces (the per-output graphics shown while locked) are a shell concern wired in a later phase; this service owns authentication and the lock lifecycle, not rendering.
|
strong |
The lock lifecycle.
| Enumerator | |
|---|---|
| Unlocked | No lock; the session is usable. |
| Locking | lock() issued; awaiting the compositor's reply. |
| Locked | The compositor locked the session; awaiting authentication. |
| Authenticating | An unlock() attempt is verifying credentials. |
| Releasing | Authenticated; the lock surfaces get a moment to leave before the compositor lock is released. |
|
explicit |
|
override |
|
signal |
Authentication succeeded and the lock is about to be released.
The surfaces are still mapped; call finishUnlock() when they are done.
|
signal |
An unlock() attempt was rejected; reason is a human-readable, non-sensitive explanation.
The session stays locked.
| void PhosphorServiceLock::LockService::finishUnlock | ( | ) |
Release the compositor lock after a successful authentication.
The service enters Releasing and emits aboutToUnlock() instead of releasing at once, so a lock surface can play its exit while it is still on screen; the surface calls this when done. A no-op unless currently Releasing. If nobody calls it, the service releases on its own after a short failsafe, so a lock can never outlive a successful login.
|
nodiscard |
True while the session is locked (whether idle or authenticating).
|
nodiscard |
Whether the compositor advertises the ext-session-lock-v1 protocol this service builds on.
When false the service constructs but cannot lock.
| void PhosphorServiceLock::LockService::lock | ( | ) |
Request that the compositor lock the session.
A no-op unless currently Unlocked.
|
nodiscard |
The current lock state.
|
signal |
state() changed.
| void PhosphorServiceLock::LockService::unlock | ( | const QString & | password | ) |
Attempt to unlock by authenticating the session user with password.
A no-op unless currently Locked. On success the session unlocks; on failure authenticationFailed() fires and the state returns to Locked.
|
signal |
The session was successfully unlocked after authentication.
|
nodiscard |
The same local account that PAM authenticates, resolved from the process uid.