Subversion Repositories oidplus

Rev

Rev 1116 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1088 daniel-mar 1
<?php
2
 
3
/*
4
 * OIDplus 2.0
5
 * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
 
20
namespace ViaThinkSoft\OIDplus;
21
 
22
// phpcs:disable PSR1.Files.SideEffects
23
\defined('INSIDE_OIDPLUS') or die;
24
// phpcs:enable PSR1.Files.SideEffects
25
 
26
class OIDplusRAAuthInfo extends OIDplusBaseClass {
27
 
1130 daniel-mar 28
        /**
29
         * @var string
30
         */
1088 daniel-mar 31
        private $authKey;
32
 
1116 daniel-mar 33
        /**
34
         * @param string $authKey
35
         * @return void
36
         * @throws OIDplusException
37
         */
38
        public function setAuthKey(string $authKey) {
1090 daniel-mar 39
                // 250 is the length of the database field
40
                if (strlen($authKey) > 250) throw new OIDplusException(_L('Field %1 is too long. Max allowed %2','Auth key',250));
1088 daniel-mar 41
                $this->authKey = $authKey;
42
        }
43
 
1116 daniel-mar 44
        /**
45
         * @return string
46
         */
47
        public function getAuthKey(): string {
1088 daniel-mar 48
                return $this->authKey;
49
        }
50
 
1116 daniel-mar 51
        /**
52
         * @param string $authKey
53
         * @throws OIDplusException
54
         */
55
        public function __construct(string $authKey) {
1088 daniel-mar 56
                $this->setAuthKey($authKey);
57
        }
58
 
1116 daniel-mar 59
        /**
60
         * @return bool
61
         */
62
        public function isPasswordLess(): bool {
1088 daniel-mar 63
                return empty($this->authKey);
64
        }
65
 
1113 daniel-mar 66
}