| @@ 101-120 (lines=20) @@ | ||
| 98 | ); |
|
| 99 | } |
|
| 100 | ||
| 101 | public function testSetTotpSecret() |
|
| 102 | { |
|
| 103 | $otp = new Otp(); |
|
| 104 | $totpSecret = 'MM7TTLHPA7WZOJFB'; |
|
| 105 | $totpKey = $otp->totp(Base32::decode($totpSecret)); |
|
| 106 | ||
| 107 | $this->assertTrue( |
|
| 108 | $this->makeRequest( |
|
| 109 | ['vpn-user-portal', 'aabbcc'], |
|
| 110 | 'POST', |
|
| 111 | 'set_totp_secret', |
|
| 112 | [], |
|
| 113 | [ |
|
| 114 | 'user_id' => 'foo', |
|
| 115 | 'totp_secret' => $totpSecret, |
|
| 116 | 'totp_key' => $totpKey, |
|
| 117 | ] |
|
| 118 | ) |
|
| 119 | ); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function testVerifyOtpKey() |
|
| 123 | { |
|
| @@ 122-140 (lines=19) @@ | ||
| 119 | ); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function testVerifyOtpKey() |
|
| 123 | { |
|
| 124 | $otp = new Otp(); |
|
| 125 | $totpSecret = 'CN2XAL23SIFTDFXZ'; |
|
| 126 | $totpKey = $otp->totp(Base32::decode($totpSecret)); |
|
| 127 | ||
| 128 | $this->assertTrue( |
|
| 129 | $this->makeRequest( |
|
| 130 | ['vpn-user-portal', 'aabbcc'], |
|
| 131 | 'POST', |
|
| 132 | 'verify_totp_key', |
|
| 133 | [], |
|
| 134 | [ |
|
| 135 | 'user_id' => 'bar', |
|
| 136 | 'totp_key' => $totpKey, |
|
| 137 | ] |
|
| 138 | ) |
|
| 139 | ); |
|
| 140 | } |
|
| 141 | ||
| 142 | public function testHasTotpSecret() |
|
| 143 | { |
|