ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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}
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
An exception for terminatinating execution or to throw for unit testing.
static info($string)
Definition: Logger.php:199
static debug($string)
Definition: Logger.php:211
A processing filter to replace the 'otp' attribute with an attribute 'yubiPrefix' that contains the s...
process(&$state)
Filter out YubiKey 'otp' attribute and replace it with a 'yubiPrefix' attribute that leaves out the d...
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85