1 | <?php |
||
21 | class SsoController extends Controller |
||
22 | { |
||
23 | /** |
||
24 | * Package configuration |
||
25 | * |
||
26 | * @var Collection |
||
27 | */ |
||
28 | protected $config; |
||
29 | |||
30 | /** |
||
31 | * SSOHelper Instance |
||
32 | * |
||
33 | * @var SSOHelper |
||
34 | */ |
||
35 | protected $sso; |
||
36 | |||
37 | /** |
||
38 | * Authenticated user |
||
39 | * |
||
40 | * @var User |
||
41 | */ |
||
42 | protected $user; |
||
43 | |||
44 | /** |
||
45 | * SsoController constructor. |
||
46 | * |
||
47 | * @param Config $config |
||
48 | * @param SSOHelper $sso |
||
49 | */ |
||
50 | public function __construct(Config $config, SSOHelper $sso) |
||
56 | |||
57 | /** |
||
58 | * Build out the extra parameters to send to Discourse |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | protected function buildExtraParameters() |
||
71 | |||
72 | /** |
||
73 | * Make boolean's into string |
||
74 | * |
||
75 | * The Discourse SSO API does not accept 0 or 1 for false or true. You must send |
||
76 | * "false" or "true", so convert any boolean property to the string version. |
||
77 | * |
||
78 | * @param $property |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function castBooleansToString($property) |
||
90 | |||
91 | /** |
||
92 | * Process the SSO login request from Discourse |
||
93 | * |
||
94 | * @param Request $request |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function login(Request $request) |
||
115 | |||
116 | /** |
||
117 | * Check to see if property is null |
||
118 | * |
||
119 | * @param string $property |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function nullProperty($property) |
||
126 | |||
127 | /** |
||
128 | * Get the property from the user |
||
129 | * |
||
130 | * If a string is passed in, then get it from the user object, otherwise, return what was given |
||
131 | * |
||
132 | * @param string $property |
||
133 | * @return mixed |
||
134 | */ |
||
135 | public function parseUserValue($property) |
||
143 | } |
||
144 |