Repository navigation
Expand file tree
/
Copy pathSso.php
More file actions
147 lines (133 loc) · 4.06 KB
/
Copy pathSso.php
File metadata and controls
147 lines (133 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/**
* @package Oneall PHP SDK
* @copyright Copyright 2017-Present http://www.oneall.com
* @license GNU/GPL 2 or later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
*
* The "GNU General Public License" (GPL) is available at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
namespace Oneall\Api\Apis;
use Oneall\Api\AbstractApi;
use Oneall\Api\Pagination;
/**
* Class Sso
*
* @package Oneall\Api\Apis
*/
class Sso extends AbstractApi
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sso';
}
/**
* List All Active SSO Sessions
*
* @see http://docs.oneall.com/api/resources/sso/list-all-sessions/
*
* @return \Oneall\Client\Response
*/
public function getAll(Pagination $pagination = null)
{
if (!$pagination)
{
$pagination = new Pagination();
}
return $this->getClient()->get('/sso/sessions.json?' . $pagination->build());
}
/**
* Read SSO Session
*
* @param string $sessionToken
*
* @see http://docs.oneall.com/api/resources/sso/read-session-details/
*
* @return \Oneall\Client\Response
*/
public function get($sessionToken)
{
return $this->getClient()->get('/sso/sessions/' . $sessionToken . '.json');
}
/**
* Read SSO Session
*
* @param string $sessionToken
*
* @see http://docs.oneall.com/api/resources/sso/read-session-details/
*
* @return \Oneall\Client\Response
*/
public function delete($sessionToken)
{
return $this->getClient()->delete('/sso/sessions/' . $sessionToken . '.json?confirm_deletion=true');
}
/**
* Start SSO Identity Session
*
* @see http://docs.oneall.com/api/resources/sso/identity/start-session/
*
* @param string $identityToken
* @param string|null $topRealm
* @param string|null $subRealm
* @param string|null $lifetime
*
* @return \Oneall\Client\Response
*/
public function startIdentitySession(
$identityToken,
$topRealm = null,
$subRealm = null,
$lifetime = null
) {
$data = ['request' => ['sso_session' => []]];
$data = $this->addInfo($data, '/request/sso_session/top_realm', $topRealm);
$data = $this->addInfo($data, '/request/sso_session/sub_realm', $subRealm);
$data = $this->addInfo($data, '/request/sso_session/lifetime', $lifetime);
return $this->getClient()->put('/sso/sessions/identities/' . $identityToken . '.json', $data);
}
/**
* Read SSO Identity Session
*
* @param string $identityToken
*
* @see http://docs.oneall.com/api/resources/sso/identity/read-session/
*
* @return \Oneall\Client\Response
*/
public function readIdentitySession($identityToken)
{
return $this->getClient()->get('/sso/sessions/identities/' . $identityToken . '.json');
}
/**
* Destroy SSO Identity Session
*
* @param string $identityToken
*
* @see http://docs.oneall.com/api/resources/sso/identity/read-session/
*
* @return \Oneall\Client\Response
*/
public function destroyIdentitySession($identityToken)
{
$url = '/sso/sessions/identities/' . $identityToken . '.json?confirm_deletion=true';
$response = $this->getClient()->delete($url);
return $response;
}
}