1 | <?php |
||
19 | class SecurityController extends Controller |
||
20 | { |
||
21 | /** |
||
22 | * @var ServiceRepository |
||
23 | */ |
||
24 | protected $serviceRepository; |
||
25 | |||
26 | /** |
||
27 | * @var TicketRepository |
||
28 | */ |
||
29 | protected $ticketRepository; |
||
30 | |||
31 | /** |
||
32 | * @var UserLogin |
||
33 | */ |
||
34 | protected $loginInteraction; |
||
35 | |||
36 | /** |
||
37 | * SecurityController constructor. |
||
38 | * @param ServiceRepository $serviceRepository |
||
39 | * @param TicketRepository $ticketRepository |
||
40 | * @param UserLogin $loginInteraction |
||
41 | */ |
||
42 | 4 | public function __construct( |
|
51 | |||
52 | 1 | public function showLogin(Request $request) |
|
53 | { |
||
54 | 1 | $service = $request->get('service', ''); |
|
55 | 1 | $errors = []; |
|
56 | 1 | if (!empty($service)) { |
|
57 | //service not found in white list |
||
58 | 1 | if (!$this->serviceRepository->isUrlValid($service)) { |
|
59 | 1 | $errors[] = (new CasException(CasException::INVALID_SERVICE))->getCasMsg(); |
|
60 | 1 | } |
|
61 | 1 | } |
|
62 | |||
63 | 1 | $user = $this->loginInteraction->getCurrentUser($request); |
|
64 | //user already has sso session |
||
65 | 1 | if ($user) { |
|
66 | //has errors, should not be redirected to target url |
||
67 | 1 | if (!empty($errors)) { |
|
68 | 1 | return $this->loginInteraction->redirectToHome($errors); |
|
69 | } |
||
70 | |||
71 | //must not be transparent |
||
72 | 1 | if ($request->get('warn') === 'true' && !empty($service)) { |
|
73 | 1 | $query = $request->query->all(); |
|
74 | 1 | unset($query['warn']); |
|
75 | 1 | $url = cas_route('login_page', $query); |
|
76 | |||
77 | 1 | return $this->loginInteraction->showLoginWarnPage($request, $url, $service); |
|
78 | } |
||
79 | |||
80 | 1 | return $this->authenticated($request); |
|
81 | } |
||
82 | |||
83 | 1 | return $this->loginInteraction->showLoginPage($request, $errors); |
|
84 | } |
||
85 | |||
86 | 1 | public function login(Request $request) |
|
90 | |||
91 | 1 | public function authenticated(Request $request) |
|
117 | |||
118 | 1 | public function logout(Request $request) |
|
127 | } |
||
128 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.