ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
OTP2YubiPrefix.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * Copyright (C) 2009 Simon Josefsson <simon@yubico.com>.
5  *
6  * This file is part of SimpleSAMLphp
7  *
8  * SimpleSAMLphp is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 3 of
11  * the License, or (at your option) any later version.
12  *
13  * SimpleSAMLphp is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License License along with GNU SASL Library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
46 
47 
54  public function process(&$state) {
55  assert('is_array($state)');
56  assert('array_key_exists("Attributes", $state)');
57  $attributes = $state['Attributes'];
58 
59  SimpleSAML\Logger::debug('OTP2YubiPrefix: enter with attributes: ' . implode(',', array_keys($attributes)));
60 
61  $otps = $attributes['otp'];
62  $otp = $otps['0'];
63 
64  $token_size = 32;
65  $identity = substr ($otp, 0, strlen ($otp) - $token_size);
66 
67  $attributes['yubiPrefix'] = array($identity);
68 
69  SimpleSAML\Logger::info('OTP2YubiPrefix: otp: ' . $otp . ' identity: ' . $identity . ' (otp keys: ' . implode(',', array_keys($otps)) . ')');
70 
71  unset($attributes['otp']);
72 
73  SimpleSAML\Logger::debug('OTP2YubiPrefix: leaving with attributes: ' . implode(',', array_keys($attributes)));
74  }
75 
76 }
static debug($string)
Definition: Logger.php:213
$attributes
A processing filter to replace the &#39;otp&#39; attribute with an attribute &#39;yubiPrefix&#39; that contains the s...
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static info($string)
Definition: Logger.php:201
process(&$state)
Filter out YubiKey &#39;otp&#39; attribute and replace it with a &#39;yubiPrefix&#39; attribute that leaves out the d...
Create styles array
The data for the language used.