File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 80
80
*/
81
81
public function login(Request $request)
82
82
{
83
+ $user = $this->getUser();
84
+
85
+ return $this->json(array(
86
+ 'username' => $user->getUsername(),
87
+ 'roles' => $user->getRoles(),
88
+ ));
83
89
}
84
90
}
85
91
@@ -117,11 +123,11 @@ path:
117
123
118
124
return $routes;
119
125
120
- Don't let this empty controller confuse you. When you submit a ``POST `` request
121
- to the `` /login `` URL with the following JSON document as the body, the security
122
- system intercepts the requests. It takes care of authenticating the user with
123
- the submitted username and password or triggers an error in case the authentication
124
- process fails:
126
+ When you submit a ``POST `` request to the `` /login `` URL with the following JSON
127
+ document as the body, the security system intercepts the requests.
128
+ It takes care of authenticating the user with the submitted username and password
129
+ or triggers an error in case the authentication process fails.
130
+ If the authentication is successful, the controller defined earlier will be executed.
125
131
126
132
.. code-block :: json
127
133
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ Encoders supporting the following formats are enabled:
52
52
53
53
* JSON: :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ JsonEncoder `
54
54
* XML: :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ XmlEncoder `
55
+ * CSV: :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ CsvEncoder `
56
+ * YAML: :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ YamlEncoder `
55
57
56
58
As well as the following normalizers:
57
59
You can’t perform that action at this time.
0 commit comments