Skip to content

Commit cdca246

Browse files
author
Dave Syer
committed
Fix context path in client app so cookies are not shared
The client app has to have a context path that is different from the auth server if they both run on the same host. Fixes spring-guidesgh-14
1 parent b0ce62a commit cdca246

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

auth-server/README.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ configuration file which we provide as follows:
215215
----
216216
server:
217217
port: 9999
218+
context-path: /client
218219
security:
219220
oauth2:
220221
client:
@@ -231,6 +232,17 @@ but with the "acme" client instead of the Facebook or Github ones. The
231232
app will run on port 9999 to avoid conflicts with the main app. And it
232233
refers to a user info endpoint "/me" which we haven't implemented yet.
233234

235+
Note that the `server.context-path` is set explicitly, so if you run
236+
the app to test it remember the home page is
237+
http://localhost:9999/client. Clicking on that link should take you
238+
to the auth server and once you you have authenticated with the social
239+
provider of your choice you will be redirected back to the client
240+
app
241+
242+
NOTE: The context path has to be explicit if you are running both the
243+
client and the auth server on localhost, otherwise the cookie paths
244+
clash and the two apps cannot agree on a session identifier.
245+
234246
== Protecting the User Info Endpoint
235247

236248
To use our new Authorization Server for single sign on, just like we

auth-server/src/test/resources/client.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
server:
22
port: 9999
3+
context-path: /client
34
security:
45
oauth2:
56
client:

0 commit comments

Comments
 (0)