| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      /*
 
     | 
  
  
    | 
      4
     | 
    
       * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
     | 
  
  
    | 
      5
     | 
    
       *
 
     | 
  
  
    | 
      6
     | 
    
       * This program is free software: you can redistribute it and/or modify
 
     | 
  
  
    | 
      7
     | 
    
       * it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      8
     | 
    
       * the Free Software Foundation, either version 3 of the License, or
 
     | 
  
  
    | 
      9
     | 
    
       * (at your option) any later version.
 
     | 
  
  
    | 
      10
     | 
    
       *
 
     | 
  
  
    | 
      11
     | 
    
       * This program is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      12
     | 
    
       * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      13
     | 
    
       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      14
     | 
    
       * GNU General Public License for more details.
 
     | 
  
  
    | 
      15
     | 
    
       *
 
     | 
  
  
    | 
      16
     | 
    
       * You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      17
     | 
    
       * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
     | 
  
  
    | 
      18
     | 
    
       */
 
     | 
  
  
    | 
      19
     | 
    
      
 
     | 
  
  
    | 
      20
     | 
    
      /**
 
     | 
  
  
    | 
      21
     | 
    
       * SecureTokensInterface.php
 
     | 
  
  
    | 
      22
     | 
    
       *
 
     | 
  
  
    | 
      23
     | 
    
       * @category     Core
 
     | 
  
  
    | 
      24
     | 
    
       * @package      Core_package
 
     | 
  
  
    | 
      25
     | 
    
       * @subpackage   Name of the subpackage if needed
 
     | 
  
  
    | 
      26
     | 
    
       * @copyright    Manuela v.d.Decken <manuela@isteam.de>
 
     | 
  
  
    | 
      27
     | 
    
       * @author       Manuela v.d.Decken <manuela@isteam.de>
 
     | 
  
  
    | 
      28
     | 
    
       * @license      http://www.gnu.org/licenses/gpl.html   GPL License
 
     | 
  
  
    | 
      29
     | 
    
       * @version      0.0.1
 
     | 
  
  
    | 
      30
     | 
    
       * @revision     $Revision: 2 $
 
     | 
  
  
    | 
      31
     | 
    
       * @link         $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/framework/SecureTokensInterface.php $
 
     | 
  
  
    | 
      32
     | 
    
       * @lastmodified $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
 
     | 
  
  
    | 
      33
     | 
    
       * @since        File available since 13.02.2016
 
     | 
  
  
    | 
      34
     | 
    
       * @description  xyz
 
     | 
  
  
    | 
      35
     | 
    
       */
 
     | 
  
  
    | 
      36
     | 
    
      class SecureTokensInterface {
     | 
  
  
    | 
      37
     | 
    
      
 
     | 
  
  
    | 
      38
     | 
    
          /** int first private property */
 
     | 
  
  
    | 
      39
     | 
    
          private $oSecTok = null;
 
     | 
  
  
    | 
      40
     | 
    
      
 
     | 
  
  
    | 
      41
     | 
    
          /** constructor */
 
     | 
  
  
    | 
      42
     | 
    
          public function __construct() {
     | 
  
  
    | 
      43
     | 
    
              $this->oSecTok = SecureTokens::getInstance();
 
     | 
  
  
    | 
      44
     | 
    
          }
 
     | 
  
  
    | 
      45
     | 
    
      
 
     | 
  
  
    | 
      46
     | 
    
      /**
 
     | 
  
  
    | 
      47
     | 
    
       * Dummy method for backward compatibility
 
     | 
  
  
    | 
      48
     | 
    
       * @return void
 
     | 
  
  
    | 
      49
     | 
    
       * @deprecated from WB-2.8.3-SP5
 
     | 
  
  
    | 
      50
     | 
    
       */
 
     | 
  
  
    | 
      51
     | 
    
          final public function createFTAN()
 
     | 
  
  
    | 
      52
     | 
    
          {
     | 
  
  
    | 
      53
     | 
    
              trigger_error('Deprecated function call: '.__CLASS__.'::'.__METHOD__, E_USER_DEPRECATED);
     | 
  
  
    | 
      54
     | 
    
          } // do nothing
 
     | 
  
  
    | 
      55
     | 
    
      
 
     | 
  
  
    | 
      56
     | 
    
      /**
 
     | 
  
  
    | 
      57
     | 
    
       * Dummy method for backward compatibility
 
     | 
  
  
    | 
      58
     | 
    
       * @return void
 
     | 
  
  
    | 
      59
     | 
    
       * @deprecated from WB-2.8.3-SP5
 
     | 
  
  
    | 
      60
     | 
    
       */
 
     | 
  
  
    | 
      61
     | 
    
          final public function clearIDKEY()
 
     | 
  
  
    | 
      62
     | 
    
          {
     | 
  
  
    | 
      63
     | 
    
              trigger_error('Deprecated function call: '.__CLASS__.'::'.__METHOD__, E_USER_DEPRECATED);
     | 
  
  
    | 
      64
     | 
    
          } // do nothing
 
     | 
  
  
    | 
      65
     | 
    
      
 
     | 
  
  
    | 
      66
     | 
    
      /**
 
     | 
  
  
    | 
      67
     | 
    
       * returns the current FTAN
 
     | 
  
  
    | 
      68
     | 
    
       * @param bool $mode: true or POST returns a complete prepared, hidden HTML-Input-Tag (default)
 
     | 
  
  
    | 
      69
     | 
    
       *                     false or GET returns an GET argument 'key=value'
 
     | 
  
  
    | 
      70
     | 
    
       * @return mixed:     array or string
 
     | 
  
  
    | 
      71
     | 
    
       * @deprecated the param $mMode is set deprecated
 
     | 
  
  
    | 
      72
     | 
    
       *              string retvals are set deprecated. From versions after 2.8.4 retval will be array only
 
     | 
  
  
    | 
      73
     | 
    
       */
 
     | 
  
  
    | 
      74
     | 
    
          final public function getFTAN($mMode = 'POST')
 
     | 
  
  
    | 
      75
     | 
    
          {
     | 
  
  
    | 
      76
     | 
    
              return $this->oSecTok->getFTAN($mMode);
 
     | 
  
  
    | 
      77
     | 
    
          }
 
     | 
  
  
    | 
      78
     | 
    
      
 
     | 
  
  
    | 
      79
     | 
    
      /**
 
     | 
  
  
    | 
      80
     | 
    
       * checks received form-transactionnumbers against session-stored one
 
     | 
  
  
    | 
      81
     | 
    
       * @param string $mode: requestmethode POST(default) or GET
 
     | 
  
  
    | 
      82
     | 
    
       * @param bool $bPreserve (default=false)
 
     | 
  
  
    | 
      83
     | 
    
       * @return bool:    true if numbers matches against stored ones
 
     | 
  
  
    | 
      84
     | 
    
       *
 
     | 
  
  
    | 
      85
     | 
    
       * requirements: an active session must be available
 
     | 
  
  
    | 
      86
     | 
    
       * this check will prevent from multiple sending a form. history.back() also will never work
 
     | 
  
  
    | 
      87
     | 
    
       */
 
     | 
  
  
    | 
      88
     | 
    
          final public function checkFTAN($mMode = 'POST', $bPreserve = false)
 
     | 
  
  
    | 
      89
     | 
    
          {
     | 
  
  
    | 
      90
     | 
    
              return $this->oSecTok->checkFTAN($mMode, $bPreserve);
 
     | 
  
  
    | 
      91
     | 
    
          }
 
     | 
  
  
    | 
      92
     | 
    
      /**
 
     | 
  
  
    | 
      93
     | 
    
       * store value in session and returns an accesskey to it
 
     | 
  
  
    | 
      94
     | 
    
       * @param mixed $mValue can be numeric, string or array
 
     | 
  
  
    | 
      95
     | 
    
       * @return string
 
     | 
  
  
    | 
      96
     | 
    
       */
 
     | 
  
  
    | 
      97
     | 
    
          final public function getIDKEY($mValue)
 
     | 
  
  
    | 
      98
     | 
    
          {
     | 
  
  
    | 
      99
     | 
    
              return $this->oSecTok->getIDKEY($mValue);
 
     | 
  
  
    | 
      100
     | 
    
          }
 
     | 
  
  
    | 
      101
     | 
    
      
 
     | 
  
  
    | 
      102
     | 
    
      /*
 
     | 
  
  
    | 
      103
     | 
    
       * search for key in session and returns the original value
 
     | 
  
  
    | 
      104
     | 
    
       * @param string $sFieldname: name of the POST/GET-Field containing the key or hex-key itself
 
     | 
  
  
    | 
      105
     | 
    
       * @param mixed $mDefault: returnvalue if key not exist (default 0)
 
     | 
  
  
    | 
      106
     | 
    
       * @param string $sRequest: requestmethode can be POST or GET or '' (default POST)
 
     | 
  
  
    | 
      107
     | 
    
       * @param bool $bPreserve (default=false)
 
     | 
  
  
    | 
      108
     | 
    
       * @return mixed: the original value (string, numeric, array) or DEFAULT if request fails
 
     | 
  
  
    | 
      109
     | 
    
       * @description: each IDKEY can be checked only once. Unused Keys stay in list until they expire
 
     | 
  
  
    | 
      110
     | 
    
       */
 
     | 
  
  
    | 
      111
     | 
    
          final public function checkIDKEY($sFieldname, $mDefault = 0, $sRequest = 'POST', $bPreserve = false)
 
     | 
  
  
    | 
      112
     | 
    
          {
     | 
  
  
    | 
      113
     | 
    
              return $this->oSecTok->checkIDKEY($sFieldname, $mDefault, $sRequest, $bPreserve);
 
     | 
  
  
    | 
      114
     | 
    
          }
 
     | 
  
  
    | 
      115
     | 
    
      
 
     | 
  
  
    | 
      116
     | 
    
      /**
 
     | 
  
  
    | 
      117
     | 
    
       * make a valid LifeTime value from given integer on the rules of class SecureTokens
 
     | 
  
  
    | 
      118
     | 
    
       * @param integer  $iLifeTime
 
     | 
  
  
    | 
      119
     | 
    
       * @return integer
 
     | 
  
  
    | 
      120
     | 
    
       */
 
     | 
  
  
    | 
      121
     | 
    
          final public function sanitizeLifeTime($iLifeTime)
 
     | 
  
  
    | 
      122
     | 
    
          {
     | 
  
  
    | 
      123
     | 
    
              return $this->oSecTok->sanitizeLifeTime($iLifeTime);
 
     | 
  
  
    | 
      124
     | 
    
          }
 
     | 
  
  
    | 
      125
     | 
    
      
 
     | 
  
  
    | 
      126
     | 
    
      /**
 
     | 
  
  
    | 
      127
     | 
    
       * returns all TokenLifeTime values
 
     | 
  
  
    | 
      128
     | 
    
       * @return array
 
     | 
  
  
    | 
      129
     | 
    
       */
 
     | 
  
  
    | 
      130
     | 
    
          final public function getTokenLifeTime()
 
     | 
  
  
    | 
      131
     | 
    
          {
     | 
  
  
    | 
      132
     | 
    
              return $this->oSecTok->getTokenLifeTime();
 
     | 
  
  
    | 
      133
     | 
    
          }
 
     | 
  
  
    | 
      134
     | 
    
      
 
     | 
  
  
    | 
      135
     | 
    
      } // end of class SecureTokensInterface
 
     |