Passed
Pull Request — develop (#50)
by Pieter van der
03:28
created
library/tiqr/Tiqr/Message/Exception.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
      * @param string    $message    exception message
30 30
      * @param Exception $parent     parent exception
31 31
      */
32
-     public function __construct($message, $parent=null)
33
-     {
34
-         parent::__construct($message, 0, $parent);
35
-     }
32
+        public function __construct($message, $parent=null)
33
+        {
34
+            parent::__construct($message, 0, $parent);
35
+        }
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/FCM.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,9 +97,9 @@
 block discarded – undo
97 97
 
98 98
         // Wait and retry once in case of a 502 Bad Gateway error
99 99
         if ($statusCode === 502 && !($retry)) {
100
-          sleep(2);
101
-          $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true);
102
-          return;
100
+            sleep(2);
101
+            $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true);
102
+            return;
103 103
         }
104 104
 
105 105
         if ($statusCode !== 200) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/OCRA.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
      */
37 37
     private static function _hmac(string $crypto, string $keyBytes, string $text) : string
38 38
     {
39
-         $hash = hash_hmac($crypto, $text, $keyBytes);
40
-         if (false === $hash) {
41
-             throw new Exception("calculating hash_hmac failed");
42
-         }
43
-         return $hash;
39
+            $hash = hash_hmac($crypto, $text, $keyBytes);
40
+            if (false === $hash) {
41
+                throw new Exception("calculating hash_hmac failed");
42
+            }
43
+            return $hash;
44 44
     }
45 45
 
46 46
     /**
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
      * alternative to "-S064"
100 100
      */
101 101
     static function generateOCRA(string $ocraSuite,
102
-                                 string $key,
103
-                                 string $counter,
104
-                                 string $question,
105
-                                 string $password,
106
-                                 string $sessionInformation,
107
-                                 string $timeStamp) : string
102
+                                    string $key,
103
+                                    string $counter,
104
+                                    string $question,
105
+                                    string $password,
106
+                                    string $sessionInformation,
107
+                                    string $timeStamp) : string
108 108
     {
109 109
         $codeDigits = 0;
110 110
         $crypto = "";
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/OCRAParser.php 1 patch
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -4,32 +4,32 @@  discard block
 block discarded – undo
4 4
 
5 5
 class OATH_OCRAParser {
6 6
 
7
-	private $OCRASuite = NULL;
7
+    private $OCRASuite = NULL;
8 8
 
9
-	private $OCRAVersion = NULL;
9
+    private $OCRAVersion = NULL;
10 10
 
11
-	private $CryptoFunctionType = NULL;
12
-	private $CryptoFunctionHash = NULL;
13
-	private $CryptoFunctionHashLength = NULL;
14
-	private $CryptoFunctionTruncation = NULL;
11
+    private $CryptoFunctionType = NULL;
12
+    private $CryptoFunctionHash = NULL;
13
+    private $CryptoFunctionHashLength = NULL;
14
+    private $CryptoFunctionTruncation = NULL;
15 15
 
16
-	private $C = FALSE;
17
-	private $Q = FALSE;
18
-	private $QType = 'N';
19
-	private $QLength = 8;
16
+    private $C = FALSE;
17
+    private $Q = FALSE;
18
+    private $QType = 'N';
19
+    private $QLength = 8;
20 20
 
21
-	private $P = FALSE;
22
-	private $PType = 'SHA1';
23
-	private $PLength = 20;
21
+    private $P = FALSE;
22
+    private $PType = 'SHA1';
23
+    private $PLength = 20;
24 24
 
25
-	private $S = FALSE;
26
-	private $SLength = 64;
25
+    private $S = FALSE;
26
+    private $SLength = 64;
27 27
 
28
-	private $T = FALSE;
29
-	private $TLength = 60; // 1M
30
-	private $TPeriods = array('H' => 3600, 'M' => 60, 'S' => 1);
28
+    private $T = FALSE;
29
+    private $TLength = 60; // 1M
30
+    private $TPeriods = array('H' => 3600, 'M' => 60, 'S' => 1);
31 31
 
32
-	private $supportedHashFunctions = array('SHA1' => 20, 'SHA256' => 32, 'SHA512' => 64);
32
+    private $supportedHashFunctions = array('SHA1' => 20, 'SHA256' => 32, 'SHA512' => 64);
33 33
 
34 34
 
35 35
     /**
@@ -37,149 +37,149 @@  discard block
 block discarded – undo
37 37
      * @throws Exception
38 38
      */
39 39
     public function __construct(String $ocraSuite) {
40
-		$this->parseOCRASuite($ocraSuite);
41
-	}
40
+        $this->parseOCRASuite($ocraSuite);
41
+    }
42 42
 
43
-	/**
44
-	 * Inspired by https://github.com/bdauvergne/python-oath
43
+    /**
44
+     * Inspired by https://github.com/bdauvergne/python-oath
45 45
      *
46 46
      * @throws Exception
47
-	 */
48
-	private function parseOCRASuite($ocraSuite) {
49
-		if (!is_string($ocraSuite)) {
50
-			throw new Exception('OCRASuite not in string format: ' . var_export($ocraSuite, TRUE));
51
-		}
52
-
53
-		$ocraSuite = strtoupper($ocraSuite);
54
-		$this->OCRASuite = $ocraSuite;
55
-
56
-		$s = explode(':', $ocraSuite);
57
-		if (count($s) != 3) {
58
-			throw new Exception('Invalid OCRASuite format: ' . var_export($ocraSuite, TRUE));
59
-		}
60
-
61
-		$algo = explode('-', $s[0]);
62
-		if (count($algo) != 2) {
63
-			throw new Exception('Invalid OCRA version: ' . var_export($s[0], TRUE));
64
-		}
65
-
66
-		if ($algo[0] !== 'OCRA') {
67
-			throw new Exception('Unsupported OCRA algorithm: ' . var_export($algo[0], TRUE));
68
-		}
69
-
70
-		if ($algo[1] !== '1') {
71
-			throw new Exception('Unsupported OCRA version: ' . var_export($algo[1], TRUE));
72
-		}
73
-		$this->OCRAVersion = $algo[1];
74
-
75
-		$cf = explode('-', $s[1]);
76
-		if (count($cf) != 3) {
77
-			throw new Exception('Invalid OCRA suite crypto function: ' . var_export($s[1], TRUE));
78
-		}
79
-
80
-		if ($cf[0] !== 'HOTP') {
81
-			throw new Exception('Unsupported OCRA suite crypto function: ' . var_export($cf[0], TRUE));
82
-		}
83
-		$this->CryptoFunctionType = $cf[0];
84
-
85
-		if (!array_key_exists($cf[1], $this->supportedHashFunctions)) {
86
-			throw new Exception('Unsupported hash function in OCRA suite crypto function: ' . var_export($cf[1], TRUE));
87
-		}
88
-		$this->CryptoFunctionHash = $cf[1];
89
-		$this->CryptoFunctionHashLength = $this->supportedHashFunctions[$cf[1]];
90
-
91
-		if (!preg_match('/^\d+$/', $cf[2]) || (($cf[2] < 4 || $cf[2] > 10) && $cf[2] != 0)) {
92
-			throw new Exception('Invalid OCRA suite crypto function truncation length: ' . var_export($cf[2], TRUE));
93
-		}
94
-		$this->CryptoFunctionTruncation = intval($cf[2]);
95
-
96
-		$di = explode('-', $s[2]);
97
-		if (count($cf) == 0) {
98
-			throw new Exception('Invalid OCRA suite data input: ' . var_export($s[2], TRUE));
99
-		}
100
-
101
-		$data_input = array();
102
-		foreach($di as $elem) {
103
-			$letter = $elem[0];
104
-			if (array_key_exists($letter, $data_input)) {
105
-				throw new Exception('Duplicate field in OCRA suite data input: ' . var_export($elem, TRUE));
106
-			}
107
-			$data_input[$letter] = 1;
108
-
109
-			if ($letter === 'C' && strlen($elem) == 1) {
110
-				$this->C = TRUE;
111
-			} elseif ($letter === 'Q') {
112
-				if (strlen($elem) == 1) {
113
-					$this->Q = TRUE;
114
-				} elseif (preg_match('/^Q([AHN])(\d+)$/', $elem, $match)) {
115
-					$q_len = intval($match[2]);
116
-					if ($q_len < 4 || $q_len > 64) {
117
-						throw new Exception('Invalid OCRA suite data input question length: ' . var_export($q_len, TRUE));
118
-					}
119
-					$this->Q = TRUE;
120
-					$this->QType = $match[1];
121
-					$this->QLength = $q_len;
122
-				} else {
123
-					throw new Exception('Invalid OCRA suite data input question: ' . var_export($elem, TRUE));
124
-				}
125
-			} elseif ($letter === 'P') {
126
-				if (strlen($elem) == 1) {
127
-					$this->P = TRUE;
128
-				} else {
129
-					$p_algo = substr($elem, 1);
130
-					if (!array_key_exists($p_algo, $this->supportedHashFunctions)) {
131
-						throw new Exception('Unsupported OCRA suite PIN hash function: ' . var_export($elem, TRUE));
132
-					}
133
-					$this->P = TRUE;
134
-					$this->PType = $p_algo;
135
-					$this->PLength = $this->supportedHashFunctions[$p_algo];
136
-				}
137
-			} elseif ($letter === 'S') {
138
-				if (strlen($elem) == 1) {
139
-					$this->S = TRUE;
140
-				} elseif (preg_match('/^S(\d+)$/', $elem, $match)) {
141
-					$s_len = intval($match[1]);
142
-					if ($s_len <= 0 || $s_len > 512) {
143
-						throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($s_len, TRUE));
144
-					}
145
-
146
-					$this->S = TRUE;
147
-					$this->SLength = $s_len;
148
-				} else {
149
-					throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($elem, TRUE));
150
-				}
151
-			} elseif ($letter === 'T') {
152
-				if (strlen($elem) == 1) {
153
-					$this->T = TRUE;
154
-				} elseif (preg_match('/^T(\d+[HMS])+$/', $elem)) {
155
-					preg_match_all('/(\d+)([HMS])/', $elem, $match);
156
-
157
-					if (count($match[1]) !== count(array_unique($match[2]))) {
158
-						throw new Exception('Duplicate definitions in OCRA suite data input timestamp: ' . var_export($elem, TRUE));
159
-					}
160
-
161
-					$length = 0;
162
-					for ($i = 0; $i < count($match[1]); $i++) {
163
-						$length += intval($match[1][$i]) * $this->TPeriods[$match[2][$i]];
164
-					}
165
-					if ($length <= 0) {
166
-						throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
167
-					}
168
-
169
-					$this->T = TRUE;
170
-					$this->TLength = $length;
171
-				} else {
172
-					throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
173
-				}
174
-			} else {
175
-				throw new Exception('Unsupported OCRA suite data input field: ' . var_export($elem, TRUE));
176
-			}
177
-		}
178
-
179
-		if (!$this->Q) {
180
-			throw new Exception('OCRA suite data input question not defined: ' . var_export($s[2], TRUE));
181
-		}
182
-	}
47
+     */
48
+    private function parseOCRASuite($ocraSuite) {
49
+        if (!is_string($ocraSuite)) {
50
+            throw new Exception('OCRASuite not in string format: ' . var_export($ocraSuite, TRUE));
51
+        }
52
+
53
+        $ocraSuite = strtoupper($ocraSuite);
54
+        $this->OCRASuite = $ocraSuite;
55
+
56
+        $s = explode(':', $ocraSuite);
57
+        if (count($s) != 3) {
58
+            throw new Exception('Invalid OCRASuite format: ' . var_export($ocraSuite, TRUE));
59
+        }
60
+
61
+        $algo = explode('-', $s[0]);
62
+        if (count($algo) != 2) {
63
+            throw new Exception('Invalid OCRA version: ' . var_export($s[0], TRUE));
64
+        }
65
+
66
+        if ($algo[0] !== 'OCRA') {
67
+            throw new Exception('Unsupported OCRA algorithm: ' . var_export($algo[0], TRUE));
68
+        }
69
+
70
+        if ($algo[1] !== '1') {
71
+            throw new Exception('Unsupported OCRA version: ' . var_export($algo[1], TRUE));
72
+        }
73
+        $this->OCRAVersion = $algo[1];
74
+
75
+        $cf = explode('-', $s[1]);
76
+        if (count($cf) != 3) {
77
+            throw new Exception('Invalid OCRA suite crypto function: ' . var_export($s[1], TRUE));
78
+        }
79
+
80
+        if ($cf[0] !== 'HOTP') {
81
+            throw new Exception('Unsupported OCRA suite crypto function: ' . var_export($cf[0], TRUE));
82
+        }
83
+        $this->CryptoFunctionType = $cf[0];
84
+
85
+        if (!array_key_exists($cf[1], $this->supportedHashFunctions)) {
86
+            throw new Exception('Unsupported hash function in OCRA suite crypto function: ' . var_export($cf[1], TRUE));
87
+        }
88
+        $this->CryptoFunctionHash = $cf[1];
89
+        $this->CryptoFunctionHashLength = $this->supportedHashFunctions[$cf[1]];
90
+
91
+        if (!preg_match('/^\d+$/', $cf[2]) || (($cf[2] < 4 || $cf[2] > 10) && $cf[2] != 0)) {
92
+            throw new Exception('Invalid OCRA suite crypto function truncation length: ' . var_export($cf[2], TRUE));
93
+        }
94
+        $this->CryptoFunctionTruncation = intval($cf[2]);
95
+
96
+        $di = explode('-', $s[2]);
97
+        if (count($cf) == 0) {
98
+            throw new Exception('Invalid OCRA suite data input: ' . var_export($s[2], TRUE));
99
+        }
100
+
101
+        $data_input = array();
102
+        foreach($di as $elem) {
103
+            $letter = $elem[0];
104
+            if (array_key_exists($letter, $data_input)) {
105
+                throw new Exception('Duplicate field in OCRA suite data input: ' . var_export($elem, TRUE));
106
+            }
107
+            $data_input[$letter] = 1;
108
+
109
+            if ($letter === 'C' && strlen($elem) == 1) {
110
+                $this->C = TRUE;
111
+            } elseif ($letter === 'Q') {
112
+                if (strlen($elem) == 1) {
113
+                    $this->Q = TRUE;
114
+                } elseif (preg_match('/^Q([AHN])(\d+)$/', $elem, $match)) {
115
+                    $q_len = intval($match[2]);
116
+                    if ($q_len < 4 || $q_len > 64) {
117
+                        throw new Exception('Invalid OCRA suite data input question length: ' . var_export($q_len, TRUE));
118
+                    }
119
+                    $this->Q = TRUE;
120
+                    $this->QType = $match[1];
121
+                    $this->QLength = $q_len;
122
+                } else {
123
+                    throw new Exception('Invalid OCRA suite data input question: ' . var_export($elem, TRUE));
124
+                }
125
+            } elseif ($letter === 'P') {
126
+                if (strlen($elem) == 1) {
127
+                    $this->P = TRUE;
128
+                } else {
129
+                    $p_algo = substr($elem, 1);
130
+                    if (!array_key_exists($p_algo, $this->supportedHashFunctions)) {
131
+                        throw new Exception('Unsupported OCRA suite PIN hash function: ' . var_export($elem, TRUE));
132
+                    }
133
+                    $this->P = TRUE;
134
+                    $this->PType = $p_algo;
135
+                    $this->PLength = $this->supportedHashFunctions[$p_algo];
136
+                }
137
+            } elseif ($letter === 'S') {
138
+                if (strlen($elem) == 1) {
139
+                    $this->S = TRUE;
140
+                } elseif (preg_match('/^S(\d+)$/', $elem, $match)) {
141
+                    $s_len = intval($match[1]);
142
+                    if ($s_len <= 0 || $s_len > 512) {
143
+                        throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($s_len, TRUE));
144
+                    }
145
+
146
+                    $this->S = TRUE;
147
+                    $this->SLength = $s_len;
148
+                } else {
149
+                    throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($elem, TRUE));
150
+                }
151
+            } elseif ($letter === 'T') {
152
+                if (strlen($elem) == 1) {
153
+                    $this->T = TRUE;
154
+                } elseif (preg_match('/^T(\d+[HMS])+$/', $elem)) {
155
+                    preg_match_all('/(\d+)([HMS])/', $elem, $match);
156
+
157
+                    if (count($match[1]) !== count(array_unique($match[2]))) {
158
+                        throw new Exception('Duplicate definitions in OCRA suite data input timestamp: ' . var_export($elem, TRUE));
159
+                    }
160
+
161
+                    $length = 0;
162
+                    for ($i = 0; $i < count($match[1]); $i++) {
163
+                        $length += intval($match[1][$i]) * $this->TPeriods[$match[2][$i]];
164
+                    }
165
+                    if ($length <= 0) {
166
+                        throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
167
+                    }
168
+
169
+                    $this->T = TRUE;
170
+                    $this->TLength = $length;
171
+                } else {
172
+                    throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
173
+                }
174
+            } else {
175
+                throw new Exception('Unsupported OCRA suite data input field: ' . var_export($elem, TRUE));
176
+            }
177
+        }
178
+
179
+        if (!$this->Q) {
180
+            throw new Exception('OCRA suite data input question not defined: ' . var_export($s[2], TRUE));
181
+        }
182
+    }
183 183
 
184 184
     /** Generate an OCRA challenge question according to the ocra suite specified in the constructor
185 185
      * @return The randomly generated OCRA question
@@ -192,50 +192,50 @@  discard block
 block discarded – undo
192 192
      * Note that the question string is the exact question string a specified in the OCRA strandard (RFC 6287)
193 193
      * The challenge is not yet hex encoded as expected by OCRA::generateOCRA()
194 194
      */
195
-	public function generateChallenge() : String {
196
-		$q_length = $this->QLength;
197
-		$q_type = $this->QType;
195
+    public function generateChallenge() : String {
196
+        $q_length = $this->QLength;
197
+        $q_type = $this->QType;
198 198
 
199 199
         $bytes = Tiqr_Random::randomBytes($q_length);
200 200
 
201
-		switch($q_type) {
202
-			case 'A':
203
-				$challenge = base64_encode($bytes);
204
-				$tr = implode("", unpack('H*', $bytes));
205
-				$challenge = rtrim(strtr($challenge, '+/', $tr), '=');
206
-				break;
207
-			case 'H':
208
-				$challenge = implode("", unpack('H*', $bytes));
209
-				break;
210
-			case 'N':
211
-				$challenge = implode("", unpack('N*', $bytes));
212
-				break;
213
-			default:
214
-				throw new Exception('Unsupported OCRASuite challenge type: ' . var_export($q_type, TRUE));
215
-				break;
216
-		}
217
-
218
-		$challenge = substr($challenge, 0, $q_length);
219
-
220
-		return $challenge;
221
-	}
222
-
223
-
224
-	/**
225
-	 * Constant time string comparison, see http://codahale.com/a-lesson-in-timing-attacks/
226
-	 */
227
-	public static function constEqual(string $s1, string $s2): bool {
228
-		if (strlen($s1) != strlen($s2)) {
229
-			return FALSE;
230
-		}
231
-
232
-		$result = TRUE;
233
-		$length = strlen($s1);
234
-		for ($i = 0; $i < $length; $i++) {
235
-			$result &= ($s1[$i] == $s2[$i]);
236
-		}
237
-
238
-		return (boolean)$result;
239
-	}
201
+        switch($q_type) {
202
+            case 'A':
203
+                $challenge = base64_encode($bytes);
204
+                $tr = implode("", unpack('H*', $bytes));
205
+                $challenge = rtrim(strtr($challenge, '+/', $tr), '=');
206
+                break;
207
+            case 'H':
208
+                $challenge = implode("", unpack('H*', $bytes));
209
+                break;
210
+            case 'N':
211
+                $challenge = implode("", unpack('N*', $bytes));
212
+                break;
213
+            default:
214
+                throw new Exception('Unsupported OCRASuite challenge type: ' . var_export($q_type, TRUE));
215
+                break;
216
+        }
217
+
218
+        $challenge = substr($challenge, 0, $q_length);
219
+
220
+        return $challenge;
221
+    }
222
+
223
+
224
+    /**
225
+     * Constant time string comparison, see http://codahale.com/a-lesson-in-timing-attacks/
226
+     */
227
+    public static function constEqual(string $s1, string $s2): bool {
228
+        if (strlen($s1) != strlen($s2)) {
229
+            return FALSE;
230
+        }
231
+
232
+        $result = TRUE;
233
+        $length = strlen($s1);
234
+        for ($i = 0; $i < $length; $i++) {
235
+            $result &= ($s1[$i] == $s2[$i]);
236
+        }
237
+
238
+        return (boolean)$result;
239
+    }
240 240
 
241 241
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/GenericStore.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     public function createUser(string $userId, string $displayName) : void
61 61
     {
62 62
         $user = array("userId"=>$userId,
63
-                      "displayName"=>$displayName);
63
+                        "displayName"=>$displayName);
64 64
         $this->_saveUser($userId, $user);
65 65
     }
66 66
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         if ($data = $this->_loadUser($userId)) {
92 92
             if (isset($data["notificationType"])) {
93
-               return $data["notificationType"];
93
+                return $data["notificationType"];
94 94
             }
95 95
         }
96 96
         return '';
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         if ($data = $this->_loadUser($userId)) {
115 115
             if (isset($data["notificationAddress"])) {
116
-               return $data["notificationAddress"];
116
+                return $data["notificationAddress"];
117 117
             }
118 118
         }
119 119
         $this->logger->info('Unable to find notification address for user');
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/File.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
         }
55 55
 
56 56
         $envelope = array("expire"=>$expire,
57
-                          "createdAt"=>time(),
58
-                          "value"=>$value);
57
+                            "createdAt"=>time(),
58
+                            "value"=>$value);
59 59
         $filename = $this->getFilenameByKey($key);
60 60
         
61 61
         if (!file_put_contents($filename, serialize($envelope))) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -571,17 +571,17 @@  discard block
 block discarded – undo
571 571
         }
572 572
 
573 573
         $metadata = array("service"=>
574
-                               array("displayName"       => $this->_name,
575
-                                     "identifier"        => $this->_identifier,
576
-                                     "logoUrl"           => $this->_logoUrl,
577
-                                     "infoUrl"           => $this->_infoUrl,
578
-                                     "authenticationUrl" => $authenticationUrl,
579
-                                     "ocraSuite"         => $this->_ocraSuite,
580
-                                     "enrollmentUrl"     => $enrollmentUrl
581
-                               ),
582
-                          "identity"=>
583
-                               array("identifier" =>$data["userId"],
584
-                                     "displayName"=>$data["displayName"]));
574
+                                array("displayName"       => $this->_name,
575
+                                        "identifier"        => $this->_identifier,
576
+                                        "logoUrl"           => $this->_logoUrl,
577
+                                        "infoUrl"           => $this->_infoUrl,
578
+                                        "authenticationUrl" => $authenticationUrl,
579
+                                        "ocraSuite"         => $this->_ocraSuite,
580
+                                        "enrollmentUrl"     => $enrollmentUrl
581
+                                ),
582
+                            "identity"=>
583
+                                array("identifier" =>$data["userId"],
584
+                                        "displayName"=>$data["displayName"]));
585 585
 
586 586
         $this->_unsetStateValue(self::PREFIX_ENROLLMENT, $enrollmentKey);
587 587
 
@@ -611,28 +611,28 @@  discard block
 block discarded – undo
611 611
      */
612 612
     public function getEnrollmentSecret(string $enrollmentKey): string
613 613
     {
614
-         $data = $this->_getStateValue(self::PREFIX_ENROLLMENT, $enrollmentKey);
615
-         if (!is_array($data)) {
616
-             $this->logger->error('getEnrollmentSecret: enrollment key not found');
617
-             throw new RuntimeException('enrollment key not found');
618
-         }
619
-         $userId = $data["userId"] ?? NULL;
620
-         $sessionId = $data["sessionId"] ?? NULL;
621
-         if (!is_string($userId) || !(is_string($sessionId))) {
622
-             throw new RuntimeException('getEnrollmentSecret: invalid enrollment data');
623
-         }
624
-         $enrollmentData = [
625
-             "userId" => $userId,
626
-             "sessionId" => $sessionId
627
-         ];
628
-         $enrollmentSecret = $this->_uniqueSessionKey();
629
-         $this->_setStateValue(
630
-             self::PREFIX_ENROLLMENT_SECRET,
631
-             $enrollmentSecret,
632
-             $enrollmentData,
633
-             self::ENROLLMENT_EXPIRE
634
-         );
635
-         return $enrollmentSecret;
614
+            $data = $this->_getStateValue(self::PREFIX_ENROLLMENT, $enrollmentKey);
615
+            if (!is_array($data)) {
616
+                $this->logger->error('getEnrollmentSecret: enrollment key not found');
617
+                throw new RuntimeException('enrollment key not found');
618
+            }
619
+            $userId = $data["userId"] ?? NULL;
620
+            $sessionId = $data["sessionId"] ?? NULL;
621
+            if (!is_string($userId) || !(is_string($sessionId))) {
622
+                throw new RuntimeException('getEnrollmentSecret: invalid enrollment data');
623
+            }
624
+            $enrollmentData = [
625
+                "userId" => $userId,
626
+                "sessionId" => $sessionId
627
+            ];
628
+            $enrollmentSecret = $this->_uniqueSessionKey();
629
+            $this->_setStateValue(
630
+                self::PREFIX_ENROLLMENT_SECRET,
631
+                $enrollmentSecret,
632
+                $enrollmentData,
633
+                self::ENROLLMENT_EXPIRE
634
+            );
635
+            return $enrollmentSecret;
636 636
     }
637 637
 
638 638
     /**
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Pdo.php 1 patch
Indentation   -2 removed lines patch added patch discarded remove patch
@@ -30,13 +30,11 @@
 block discarded – undo
30 30
     notificationtype varchar(10),
31 31
     notificationaddress varchar(64)
32 32
 );
33
-
34 33
  *
35 34
  * In version 3.0 the format of the tmpblocktimestamp was changed from a datetime format to an integer.
36 35
  * Because it holds a unix timestamp a 64-bit (8-byte) integer. To upgrade the user table to the new format use:
37 36
 
38 37
 ALTER TABLE user MODIFY tmpblocktimestamp BIGINT;
39
-
40 38
  */
41 39
 
42 40
 use Psr\Log\LoggerInterface;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserSecretStorage/File.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,6 @@
 block discarded – undo
35 35
  * Supported options:
36 36
  * path : Path to the directory where the user data is stored
37 37
  *
38
-
39 38
  */
40 39
 class Tiqr_UserSecretStorage_File implements Tiqr_UserSecretStorage_Interface
41 40
 {
Please login to merge, or discard this patch.