Ferreteria/v0.6/clade/IO/Aspect/Creds

From WoozleCodes
Jump to navigation Jump to search
clade: IO\Aspect\Creds
Clade Family
Aspect Creds Dbase
Clade Aliases
Alias Clade
Base* [ca,i] Aspect
QStr* [c,i] Str
Subpages

About

  • Purpose: abstraction of credentials for a secure connection

History

date what
2024-11-15 started
2024-11-19 [Password] started
2025-05-27 [Password] moved from [WFe]IO\Connx\Aux\Creds -> [WFe]IO\Aspect\Creds
2024-11-19
  • moved from [WF]Config\Def\Connex ⇒ [WF]IO\Connex as part of Def/actor integration
  • re-consolidating Creds/Keyed back up here, and adding Host info - let's just assume, for now at least, that a connection implies at least the possibility of a host and user.
2024-11-20 Added QPort(). For now, we'll assume that all connections have a port; any exceptions (e.g. named pipes or something) can be dealt with later.
2025-05-26 splitting Host information off into Host class
2025-05-27 re-namespacing
2026-07-24
  • merging Password sub-clade into this one, making $sPass argument optional
  • also making $sUser argument optional, so this can be used even in situations where no credentials are needed

Subspaces

Code

Current

as of 2025-12-08:

interface iCreds extends BaseIface {
    function QSUser() : QStrIface;
}
class cCreds extends BaseClass implements iCreds {

    public function __construct(string $sUser) {
        $this->QSUser()->SetIt($sUser);
    }

    private $osUser = NULL; public function QSUser() : QStrIface { return $this->osUser ?? ($this->osUser = QStrClass::AsNew()); }

    public function DescribeInline() : string {
        $oScrn = self::Screen();
        $sUser = $this->QSUser()->GetItNz($oScrn->FaintIt('(anon)'));
        return $sUser;
    }

}

Removed

Commented out on 2025-05-26:

#
    // 2025-05-26 old version
    public function __construct(string $sHost, string $sUser, ?int $nPort=NULL) {
        $this->QHost()->SetIt($sHost);
        $this->QUser()->SetIt($sUser);
        $this->QPort()->SetItNz($nPort);
    }

    private $osHost = NULL; public function QHost() : QStrIface { return $this->osHost ?? ($this->osHost = QStrClass::AsNew()); }
    private $osPort = NULL; public function QPort() : QIntIface { return $this->osPort ?? ($this->osPort = QIntClass::AsNew()); }

    // 2025-05-26 old version
    public function RenderSummary() : string {
        $oScrn = self::Screen();
        $sOut = '';
        $sUser = $this->QUser()->GetItNz($oScrn->FaintIt('(anon)'));
        $sHost = $this->QHost()->GetItNz($oScrn->FaintIt('(local)'));

        $osPort = $this->QPort();
        $sPort = $osPort->HasIt() ? (':'.$osPort->GetIt()) : '';
        return "$sUser@$sHost$sPort";
    }