openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

SSLAuth.class.php (594B)


      1 <?php
      2 
      3 namespace cms\auth;
      4 
      5 use cms\base\Configuration;
      6 
      7 /**
      8  * Authentifizierung ueber ein SSL-Zertifikat.
      9  *
     10  * @author dankert
     11  */
     12 class SSLAuth implements Auth
     13 {
     14 	public function username()
     15 	{
     16 		$envName = Configuration::subset(['security', 'ssl'] )->get('client_cert_dn_env','SSL_CLIENT_S_DN_CN');
     17 
     18 		$dn = @$_SERVER[ $envName ];
     19 
     20 		if   ( $dn )
     21 			return $dn;
     22 
     23 		return null;
     24 	}
     25 
     26 
     27 	/**
     28 	 * Ueberpruefen des Kennwortes ist nicht möglich.
     29 	 */
     30 	public function login($user, $password, $token)
     31 	{
     32 		return ( $this->username() == $user ) ? Auth::STATUS_SUCCESS : Auth::STATUS_FAILED;;
     33 	}
     34 }
     35