REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
net::auth::UserPasswordAuthentification Class Reference

A simple plaintext Username+Password authentification scheme backed against the EEPROM UserSettings. More...

#include <auth.h>

Public Member Functions

void reset_defaults ()
 reset to distributor defaults
 
bool is_disabled () const
 
bool is_valid (const User &user, const std::string &pwd)
 
bool can_do (const User &user, SecurityLevel task) const
 
void fromJson (JsonObjectConst serialized_conf)
 
void toJson (JsonObject target) const
 
void status (JsonObject target)
 

Static Public Attributes

static constexpr const char * admin = "admin"
 The admin user is singular and has all permissions.
 
static constexpr const char * user = "user"
 This is the default non-admin user.
 

Detailed Description

A simple plaintext Username+Password authentification scheme backed against the EEPROM UserSettings.

It lacks group managament but treats the username "admin" special as he can create new users. No users in the db mean the authentification is turned off.

Class also to be used within the UserSettings, syncs both with EEPROM and the distributor.

Definition at line 52 of file auth.h.

Member Function Documentation

◆ can_do()

bool net::auth::UserPasswordAuthentification::can_do ( const User & user,
SecurityLevel task ) const
inline

◆ fromJson()

FLASHMEM void net::auth::UserPasswordAuthentification::fromJson ( JsonObjectConst serialized_conf)

Definition at line 46 of file auth.cpp.

◆ is_disabled()

bool net::auth::UserPasswordAuthentification::is_disabled ( ) const
inline

Definition at line 65 of file auth.h.

◆ is_valid()

bool net::auth::UserPasswordAuthentification::is_valid ( const User & user,
const std::string & pwd )
inline

Definition at line 67 of file auth.h.

References user.

◆ reset_defaults()

FLASHMEM void net::auth::UserPasswordAuthentification::reset_defaults ( )

reset to distributor defaults

Definition at line 29 of file auth.cpp.

References utils::HeapSingleton< VendorOTP >::get(), and LOG_ALWAYS.

Referenced by net::auth::Gatekeeper::reset_defaults().

◆ status()

FLASHMEM void net::auth::UserPasswordAuthentification::status ( JsonObject target)

Definition at line 59 of file auth.cpp.

◆ toJson()

FLASHMEM void net::auth::UserPasswordAuthentification::toJson ( JsonObject target) const

Definition at line 53 of file auth.cpp.

Member Data Documentation

◆ admin

const char* net::auth::UserPasswordAuthentification::admin = "admin"
staticconstexpr

The admin user is singular and has all permissions.

Definition at line 58 of file auth.h.

Referenced by can_do(), and loop().

◆ user

const char* net::auth::UserPasswordAuthentification::user = "user"
staticconstexpr

This is the default non-admin user.

Definition at line 61 of file auth.h.

Referenced by can_do(), and is_valid().


The documentation for this class was generated from the following files: