1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the tmilos/scim-schema package. |
5
|
|
|
* |
6
|
|
|
* (c) Milos Tomic <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Tmilos\ScimSchema\Model\SPC; |
13
|
|
|
|
14
|
|
|
use Tmilos\ScimSchema\Model\SerializableInterface; |
15
|
|
|
|
16
|
|
|
class AuthenticationScheme implements SerializableInterface |
17
|
|
|
{ |
18
|
|
|
const OAUTH = 'oauth'; |
19
|
|
|
const OAUTH2 = 'oauth2'; |
20
|
|
|
const OAUTH_BEARER_TOKEN = 'oauthbearertoken'; |
21
|
|
|
const HTTP_BASIC = 'httpbasic'; |
22
|
|
|
const HTTP_DIGEST = 'httpdigest'; |
23
|
|
|
|
24
|
|
|
/** @var string */ |
25
|
|
|
private $type; |
26
|
|
|
|
27
|
|
|
/** @var string */ |
28
|
|
|
private $name; |
29
|
|
|
|
30
|
|
|
/** @var string */ |
31
|
|
|
private $description; |
32
|
|
|
|
33
|
|
|
/** @var string */ |
34
|
|
|
private $specUri; |
35
|
|
|
|
36
|
|
|
/** @var string */ |
37
|
|
|
private $documentationUri; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param string $type |
41
|
|
|
* @param string $name |
42
|
|
|
* @param string $description |
43
|
|
|
* @param string $specUri |
44
|
|
|
* @param string $documentationUri |
45
|
|
|
*/ |
46
|
|
|
public function __construct($type, $name, $description, $specUri, $documentationUri) |
47
|
|
|
{ |
48
|
|
|
$this->type = $type; |
49
|
|
|
$this->name = $name; |
50
|
|
|
$this->description = $description; |
51
|
|
|
$this->specUri = $specUri; |
52
|
|
|
$this->documentationUri = $documentationUri; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return string |
57
|
|
|
*/ |
58
|
|
|
public function getType() |
59
|
|
|
{ |
60
|
|
|
return $this->type; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
|
public function getName() |
67
|
|
|
{ |
68
|
|
|
return $this->name; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return string |
73
|
|
|
*/ |
74
|
|
|
public function getDescription() |
75
|
|
|
{ |
76
|
|
|
return $this->description; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
|
|
public function getSpecUri() |
83
|
|
|
{ |
84
|
|
|
return $this->specUri; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return string |
89
|
|
|
*/ |
90
|
|
|
public function getDocumentationUri() |
91
|
|
|
{ |
92
|
|
|
return $this->documentationUri; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return array |
97
|
|
|
*/ |
98
|
|
|
public function serializeObject() |
99
|
|
|
{ |
100
|
|
|
$result = [ |
101
|
|
|
'type' => $this->type, |
102
|
|
|
'name' => $this->name, |
103
|
|
|
'description' => $this->description, |
104
|
|
|
]; |
105
|
|
|
|
106
|
|
|
if ($this->specUri) { |
107
|
|
|
$result['specUri'] = $this->specUri; |
108
|
|
|
} |
109
|
|
|
if ($this->documentationUri) { |
110
|
|
|
$result['documentationUri'] = $this->documentationUri; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
return $result; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param array $data |
118
|
|
|
* |
119
|
|
|
* @return AuthenticationScheme |
120
|
|
|
*/ |
121
|
|
|
public static function deserializeObject(array $data) |
122
|
|
|
{ |
123
|
|
|
return new static( |
124
|
|
|
$data['type'], |
125
|
|
|
$data['name'], |
126
|
|
|
$data['description'], |
127
|
|
|
isset($data['specUri']) ? $data['specUri'] : null, |
128
|
|
|
isset($data['documentationUri']) ? $data['documentationUri'] : null |
129
|
|
|
); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|