... | ... | @@ -181,3 +181,59 @@ Das Login Control von QUIQQER ist ein einfaches Beispiel wie ein normale Login |
|
|
Möchten Sie einen Authenticator realisieren welche keine standard Benutzername / Passwort Authentifizierung hat, geht dies mit Hilfe von JavaScript etwas einfacher, zum Beispiel über einen Socialmedia Login.
|
|
|
|
|
|
Das [Facebook Login Control](https://dev.quiqqer.com/quiqqer/authfacebook/blob/dev/src/QUI/Auth/Facebook/Controls/Login.html) bindet ein JavaScript Control ein, welches die Authentifizierung über Facebook erledigt und gibt die [Facebook Anmeldeinformationen weiter an QUIQQER](https://dev.quiqqer.com/quiqqer/authfacebook/blob/dev/bin/controls/Login.js#L107).
|
|
|
|
|
|
### CLI Authentifizierung
|
|
|
|
|
|
Ein Authenticator kann bestimmen, ob ein Anmelden über die QUIQQER CLI Konsole möglich ist. Generell sind Authenticator nicht CLI fähig, dies muss der Authenticator speziell mitteilen. CLI fähige Authenticator sind zum Beispiel die Standard QUIQQER Anmeldung oder der Google Auhtenticator.
|
|
|
|
|
|
Ein Authenticator ist CLI fähig wenn er über die Methode `isCLICompatible` true zurück gibt. Über die Methode `cliAuthentication` muss dieser dann die Anmeldung in der CLI tätigen.
|
|
|
|
|
|
**Beispiel CLI Authentifizierung**
|
|
|
|
|
|
```php
|
|
|
<?php
|
|
|
|
|
|
class QUIQQER extends AbstractAuthenticator
|
|
|
{
|
|
|
|
|
|
// ... noch mehr Methoden
|
|
|
|
|
|
/**
|
|
|
* @return bool
|
|
|
*/
|
|
|
public static function isCLICompatible()
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param QUI\System\Console $Console
|
|
|
*/
|
|
|
public function cliAuthentication(\QUI\System\Console $Console)
|
|
|
{
|
|
|
$username = $Console->getArgument('username');
|
|
|
$password = $Console->getArgument('password');
|
|
|
|
|
|
if (empty($username)) {
|
|
|
$Console->writeLn("Please enter your username");
|
|
|
$Console->writeLn("Username: ", 'green');
|
|
|
|
|
|
$Console->setArgument('username', $Console->readInput());
|
|
|
$username = $Console->getArgument('username');
|
|
|
}
|
|
|
|
|
|
if (empty($password)) {
|
|
|
$Console->clearMsg();
|
|
|
$Console->writeLn("Please enter your password");
|
|
|
$Console->writeLn("Password: ", 'green');
|
|
|
$Console->clearMsg();
|
|
|
|
|
|
$Console->setArgument('password', QUI\Utils\System\Console::readPassword());
|
|
|
$password = $Console->getArgument('password');
|
|
|
}
|
|
|
|
|
|
$this->username = $username;
|
|
|
$this->auth($password);
|
|
|
}
|
|
|
}
|
|
|
``` |