2-factor authentication options
This commit is contained in:
parent
afdc4b3f92
commit
b3a917255d
|
@ -285,6 +285,8 @@ $helpArray = array (
|
||||||
"Text" => _('URL of external 2-factor authentication service.')),
|
"Text" => _('URL of external 2-factor authentication service.')),
|
||||||
"516" => array ("Headline" => _('Disable certificate check'),
|
"516" => array ("Headline" => _('Disable certificate check'),
|
||||||
"Text" => _('This will disable the check of the SSL certificates for the 2-factor authentication service. Not recommended for production usage.')),
|
"Text" => _('This will disable the check of the SSL certificates for the 2-factor authentication service. Not recommended for production usage.')),
|
||||||
|
"517" => array ("Headline" => _('Label'),
|
||||||
|
"Text" => _('Use this to overwrite the default label for the 2-factor input field. Default is "PIN+Token".')),
|
||||||
"520" => array ("Headline" => _("Generate random password"),
|
"520" => array ("Headline" => _("Generate random password"),
|
||||||
"Text" => _("This will set a random password and display it on the screen or send it to the user via mail. Please edit your LAM server profile to setup the mail settings.")),
|
"Text" => _("This will set a random password and display it on the screen or send it to the user via mail. Please edit your LAM server profile to setup the mail settings.")),
|
||||||
"550" => array ("Headline" => _("From address"),
|
"550" => array ("Headline" => _("From address"),
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
namespace LAM\LIB\TWO_FACTOR;
|
||||||
|
/*
|
||||||
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
|
Copyright (C) 2017 Roland Gruber
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2-factor authentication
|
||||||
|
*
|
||||||
|
* @package two_factor
|
||||||
|
* @author Roland Gruber
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface TwoFactorProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies if the provided 2nd factor is valid.
|
||||||
|
*
|
||||||
|
* @param \selfServiceProfile $selfServiceProfile self service profile
|
||||||
|
* @param string $user user name
|
||||||
|
* @param string $password password
|
||||||
|
* @param string $twoFactorInput input for 2nd factor
|
||||||
|
* @throws \Exception error during check
|
||||||
|
*/
|
||||||
|
public function verify2ndFactor($selfServiceProfile, $user, $password, $twoFactorInput);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class PrivacyIDEAProvider implements TwoFactorProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @see \LAM\LIB\TWO_FACTOR\TwoFactorProvider::verify2ndFactor()
|
||||||
|
*/
|
||||||
|
public function verify2ndFactor($selfServiceProfile, $user, $password, $twoFactorInput) {
|
||||||
|
logNewMessage(LOG_DEBUG, 'PrivacyIDEAProvider: Checking 2nd factor for ' . $user);
|
||||||
|
$token = $this->authenticate($selfServiceProfile, $user, $password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticates against the server
|
||||||
|
*
|
||||||
|
* @param unknown $selfServiceProfile
|
||||||
|
* @param unknown $user
|
||||||
|
* @param unknown $password
|
||||||
|
* @return string token
|
||||||
|
* @throws \Exception error during authentication
|
||||||
|
*/
|
||||||
|
private function authenticate($selfServiceProfile, $user, $password) {
|
||||||
|
$curl = $this->getCurl($selfServiceProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the curl object.
|
||||||
|
*
|
||||||
|
* @param unknown $selfServiceProfile
|
||||||
|
* @return object curl handle
|
||||||
|
* @throws \Exception error during curl creation
|
||||||
|
*/
|
||||||
|
private function getCurl($selfServiceProfile) {
|
||||||
|
$curl = curl_init();
|
||||||
|
return $curl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -384,6 +384,7 @@ class selfServiceProfile {
|
||||||
public $twoFactorAuthentication = selfServiceProfile::TWO_FACTOR_NONE;
|
public $twoFactorAuthentication = selfServiceProfile::TWO_FACTOR_NONE;
|
||||||
public $twoFactorAuthenticationURL = 'https://localhost';
|
public $twoFactorAuthenticationURL = 'https://localhost';
|
||||||
public $twoFactorAuthenticationInsecure = false;
|
public $twoFactorAuthenticationInsecure = false;
|
||||||
|
public $twoFactorAuthenticationLabel = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -425,6 +426,7 @@ class selfServiceProfile {
|
||||||
$this->twoFactorAuthentication = selfServiceProfile::TWO_FACTOR_NONE;
|
$this->twoFactorAuthentication = selfServiceProfile::TWO_FACTOR_NONE;
|
||||||
$this->twoFactorAuthenticationURL = 'https://localhost';
|
$this->twoFactorAuthenticationURL = 'https://localhost';
|
||||||
$this->twoFactorAuthenticationInsecure = false;
|
$this->twoFactorAuthenticationInsecure = false;
|
||||||
|
$this->twoFactorAuthenticationLabel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue