Skip to content

Commit 415961b

Browse files
authored
Merge pull request stormpath#1161 from kanderson450/master
Fixes stormpath#1160 Conflicting Endpoint in Spring Boot Tutorials
2 parents 92b88b1 + 05c47f9 commit 415961b

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

docs/source/tutorial.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
For more on ``HttpSecurity`` with Spring Security, see `its HttpSecurity documentation <http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#jc-httpsecurity>`_.
433433
434434
We've added a new method to our ``HelloController``. It does not call out any other authorizaton requirements. As such,
435-
anyone logged in will be able to access ``/me``. Furthermore, anyone NOT logged in trying to access ``/me`` will automatically
435+
anyone logged in will be able to access ``/userdetails``. Furthermore, anyone NOT logged in trying to access ``/userdetails`` will automatically
436436
be redirected to the ``/login`` view.
437437
438438
.. code-block:: java
@@ -442,15 +442,15 @@
442442
public class HelloController {
443443
444444
...
445-
@RequestMapping("/me")
446-
String me() {
447-
return "me";
445+
@RequestMapping("/userdetails")
446+
String userDetails() {
447+
return "userdetails";
448448
}
449449
...
450450
}
451451
452-
Try it out. Launch the application as before, and then browse to: ``http://localhost:${port}/me``. You will be redirected to the ``/login``
453-
and then after you login to a valid Stormpath Account, you will automatically be brought back to ``/me``. That's the Stormpath magic at work!
452+
Try it out. Launch the application as before, and then browse to: ``http://localhost:${port}/userdetails``. You will be redirected to the ``/login``
453+
and then after you login to a valid Stormpath Account, you will automatically be brought back to ``/userdetails``. That's the Stormpath magic at work!
454454
455455
Now, we'll look at fine grained controls using Spring Security permissions connected to Stormpath custom data.
456456
@@ -534,13 +534,13 @@
534534
535535
This part of the tutorial exercises the Token Magement features using Spring Security Spring Boot WebMVC.
536536
537-
There's a simple `@RestController` called `MeController` that returns information about the authenticated account.
537+
There's a simple `@RestController` called `UserDetailsController` that returns information about the authenticated account.
538538
539539
.. code-block:: java
540540
541541
@RestController
542-
public class MeController {
543-
@RequestMapping(value="/me", produces = MediaType.APPLICATION_JSON_VALUE)
542+
public class UserDetailsController {
543+
@RequestMapping(value="/userdetails", produces = MediaType.APPLICATION_JSON_VALUE)
544544
public AccountInfo info(HttpServletRequest req) {
545545
// must be logged in to get here per Spring Security config
546546
Account account = AccountResolver.INSTANCE.getAccount(req);
@@ -549,7 +549,7 @@
549549
}
550550
}
551551
552-
In order to hit the `/me` endpoint, we'll first, we'll get an `access_token` and a `refresh_token` by hitting the
552+
In order to hit the `/userdetails` endpoint, we'll first, we'll get an `access_token` and a `refresh_token` by hitting the
553553
`/oauth/token` endpoint:
554554
555555
.. code-block:: bash
@@ -577,14 +577,14 @@
577577
578578
The response includes the tokens as well as information on their type (`Bearer` in this case) and when it expires.
579579
580-
We can now use the `access_token` to hit the `/me` endpoint:
580+
We can now use the `access_token` to hit the `/userdetails` endpoint:
581581
582582
583583
.. code-block:: bash
584584
585585
curl \
586586
-H "Authorization: Bearer eyJraWQiOiJSOTJTQkhKQzFVNERBSU1HUTNNSE9HVk1YIiwiYWxnIjoiSFMyNTYifQ.eyJqdGkiOiI2M1laa1FBNjRTdEdUQjFhVEhlNGdPIiwiaWF0IjoxNDU0NDM4MTQ3LCJpc3MiOiJodHRwczovL2FwaS5zdG9ybXBhdGguY29tL3YxL2FwcGxpY2F0aW9ucy82dkZUNEFSZldDbXVIVlY4Vmt0alRvIiwic3ViIjoiaHR0cHM6Ly9hcGkuc3Rvcm1wYXRoLmNvbS92MS9hY2NvdW50cy80V1NjTWJBbm8zVjk1aWlTc3dralBYIiwiZXhwIjoxNDU0NDQxNzQ3LCJydGkiOiI2M1laa01xMTlzYUhxTHZqSDFtbzRLIn0.-3NNpi7-DTvl2VNCfHHFNwWVikmeCyNPy6KEu--XYjk" \
587-
http://localhost:${port}/me
587+
http://localhost:${port}/userdetails
588588
589589
You will get a response like this:
590590
@@ -644,7 +644,7 @@
644644
645645
curl \
646646
-H "Authorization: Bearer eyJraWQiOiJSOTJTQkhKQzFVNERBSU1HUTNNSE9HVk1YIiwiYWxnIjoiSFMyNTYifQ.eyJqdGkiOiI1eDlxbWlES2U0RmlFMU02alhLSDBMIiwiaWF0IjoxNDU0NDQ0MTU1LCJpc3MiOiJodHRwczovL2FwaS5zdG9ybXBhdGguY29tL3YxL2FwcGxpY2F0aW9ucy82dkZUNEFSZldDbXVIVlY4Vmt0alRvIiwic3ViIjoiaHR0cHM6Ly9hcGkuc3Rvcm1wYXRoLmNvbS92MS9hY2NvdW50cy80V1NjTWJBbm8zVjk1aWlTc3dralBYIiwiZXhwIjoxNDU0NDQ3NzU1LCJydGkiOiI2M1laa01xMTlzYUhxTHZqSDFtbzRLIn0.J2NR7MV3OoolYImfUNiu8SCDvaQdresHTnPHgL7mO1Q" \
647-
http://localhost:${port}/me
647+
http://localhost:${port}/userdetails
648648
649649
Here's the response:
650650

tutorials/spring-boot/04-a-finer-grain-of-control/src/main/java/com/stormpath/tutorial/controller/HelloController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ String home(HttpServletRequest req, Model model) {
4545
return "home";
4646
}
4747

48-
@RequestMapping("/me")
49-
String me() {
50-
return "me";
48+
@RequestMapping("/userdetails")
49+
String userDetails() {
50+
return "userdetails";
5151
}
5252

5353
@RequestMapping("/restricted")

tutorials/spring-boot/04-a-finer-grain-of-control/src/main/resources/templates/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<h1 th:inline="text">Hello, [[${account.givenName}]]!</h1>
3636
<form th:action="@{/logout}" method="post">
3737
<a href="/restricted" class="btn btn-primary">Restricted</a>
38-
<a href="/me" class="btn btn-warning">My Groups</a>
38+
<a href="/userdetails" class="btn btn-warning">My Groups</a>
3939
<input type="submit" class="btn btn-danger" value="Logout"/>
4040
</form>
4141
</div>

tutorials/spring-boot/05-token-management/src/main/java/com/stormpath/tutorial/controller/MeController.java renamed to tutorials/spring-boot/05-token-management/src/main/java/com/stormpath/tutorial/controller/UserDetailsController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
* @since 1.0.RC8.3
2929
*/
3030
@RestController
31-
public class MeController {
31+
public class UserDetailsController {
3232

33-
@RequestMapping(value="/me", produces = MediaType.APPLICATION_JSON_VALUE)
33+
@RequestMapping(value="/userdetails", produces = MediaType.APPLICATION_JSON_VALUE)
3434
public AccountInfo info(HttpServletRequest req) {
3535
// must be logged in to get here per Spring Security config
3636
Account account = AccountResolver.INSTANCE.getAccount(req);

0 commit comments

Comments
 (0)