Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorServiceLock::LockService Class Reference

Session-lock + authentication host for Phosphor-based desktop shells. More...

#include <PhosphorServiceLock/LockService.h>

Inheritance diagram for PhosphorServiceLock::LockService:
[legend]

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.

Detailed Description

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.

Member Enumeration Documentation

◆ State

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.

Constructor & Destructor Documentation

◆ LockService()

PhosphorServiceLock::LockService::LockService ( QObject * parent = nullptr)
explicit

◆ ~LockService()

PhosphorServiceLock::LockService::~LockService ( )
override

Member Function Documentation

◆ aboutToUnlock

void PhosphorServiceLock::LockService::aboutToUnlock ( )
signal

Authentication succeeded and the lock is about to be released.

The surfaces are still mapped; call finishUnlock() when they are done.

◆ authenticationFailed

void PhosphorServiceLock::LockService::authenticationFailed ( const QString & reason)
signal

An unlock() attempt was rejected; reason is a human-readable, non-sensitive explanation.

The session stays locked.

◆ finishUnlock()

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.

◆ isLocked()

bool PhosphorServiceLock::LockService::isLocked ( ) const
nodiscard

True while the session is locked (whether idle or authenticating).

◆ isSupported()

bool PhosphorServiceLock::LockService::isSupported ( ) const
nodiscard

Whether the compositor advertises the ext-session-lock-v1 protocol this service builds on.

When false the service constructs but cannot lock.

◆ lock()

void PhosphorServiceLock::LockService::lock ( )

Request that the compositor lock the session.

A no-op unless currently Unlocked.

◆ state()

State PhosphorServiceLock::LockService::state ( ) const
nodiscard

The current lock state.

◆ stateChanged

void PhosphorServiceLock::LockService::stateChanged ( )
signal

state() changed.

◆ unlock()

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.

◆ unlocked

void PhosphorServiceLock::LockService::unlocked ( )
signal

The session was successfully unlocked after authentication.

◆ userName()

QString PhosphorServiceLock::LockService::userName ( ) const
nodiscard

The same local account that PAM authenticates, resolved from the process uid.


The documentation for this class was generated from the following file:
  • phosphor-service-lock/include/PhosphorServiceLock/LockService.h