Passed
Push — master ( 1c7137...b5ef5e )
by Pieter van der
03:26 queued 14s
created

getUserSecret()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the tiqr project.
4
 *
5
 * The tiqr project aims to provide an open implementation for
6
 * authentication using mobile devices. It was initiated by
7
 * SURFnet and developed by Egeniq.
8
 *
9
 * More information: http://www.tiqr.org
10
 *
11
 * @author Lineke Kerckhoffs-Willems <[email protected]>
12
 *
13
 * @package tiqr
14
 *
15
 * @license New BSD License - See LICENSE file for details.
16
 *
17
 * @copyright (C) 2014 SURFnet BV
18
 */
19
20
require_once('Tiqr/API/Client.php');
21
22
/**
23
 * OATHService storage for user's secret
24
 */
25
class Tiqr_UserSecretStorage_OathServiceClient implements Tiqr_UserSecretStorage_Interface
26
{
27
    protected $_apiClient;
28
29
    /**
30
     * Construct a user class
31
     *
32
     * @param array $config The configuration that a specific user class may use.
33
     */
34
    public function __construct($config)
35
    {
36
        $this->_apiClient = new Tiqr_API_Client();
37
        $this->_apiClient->setBaseURL($config['apiURL']);
38
        $this->_apiClient->setConsumerKey($config['consumerKey']);
39
    }
40
41
    /**
42
     * Get the user's secret
43
     * Not implemented because the idea of the oathservice is that secrets cannot be retrieved
44
     *
45
     * @param String $userId
46
     *
47
     * @return String The user's secret
48
     */
49
    public function getUserSecret($userId)
50
    {
51
        return null;
52
    }
53
54
    /**
55
     * Store a secret for a user
56
     *
57
     * @param String $userId
58
     * @param String $secret
59
     */
60
    public function setUserSecret($userId, $secret)
61
    {
62
        $this->_apiClient->call('/secrets/'.urlencode($userId), 'POST', array('secret' => $secret));
63
    }
64
}
65