You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The authcodegrant samples were initially meant to be very simple
demonstration of authorization code flow. However, it has become
obvious since then that the real intent of the demo is how to use
the WebClient with OAuth (there is no other reason to do authorization
code flow unless you use the token to make a request).
The samples have been migrated to oauth2webclient and oauth2webclient-webflux
respectively. They have been improved:
* The sample demonstrates usage with annotations, webclient directly, form login
oauth2Login, and public APIs
* The samples externalize the endpoint that is requested in the sample
making it easier to try other endpoints
* The UI no longer relies on a data structure for the result of the
endpoint also making it easier to try other endpoints
Issue: gh-4921
Copy file name to clipboardExpand all lines: samples/boot/authcodegrant-webflux/src/integration-test/java/sample/OAuth2AuthorizationCodeGrantApplicationTests.java
Copy file name to clipboardExpand all lines: samples/boot/authcodegrant/src/integration-test/java/org/springframework/security/samples/OAuth2AuthorizationCodeGrantApplicationTests.java
Copy file name to clipboardExpand all lines: samples/boot/oauth2webclient-webflux/README.adoc
+9-10Lines changed: 9 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
= OAuth 2.0 Authorization Code Grant Sample
1
+
= OAuth 2.0 WebClient (WebFlux) Sample
2
2
3
3
== GitHub Repositories
4
4
5
-
This guide provides instructions on setting up the sample application, which leverages the OAuth 2.0 Authorization Code Grant, and displays a list of public GitHub repositories that are accessible to the authenticated user.
5
+
This guide provides instructions on setting up the sample application, which leverages WebClient OAuth2 integration to display a list of public GitHub repositories that are accessible to the authenticated user.
6
6
7
7
This includes repositories owned by the authenticated user, repositories where the authenticated user is a collaborator, and repositories that the authenticated user has access to through an organization membership.
8
8
@@ -17,7 +17,7 @@ The following sections provide detailed steps for setting up the sample and cove
17
17
18
18
To use GitHub's OAuth 2.0 authorization system, you must https://github.com/settings/applications/new[Register a new OAuth application].
19
19
20
-
When registering the OAuth application, ensure the *Authorization callback URL* is set to `http://localhost:8080/github-repos`.
20
+
When registering the OAuth application, ensure the *Authorization callback URL* is set to `http://localhost:8080/login/oauth2/code/client-id`.
21
21
22
22
The Authorization callback URL (redirect URI) is the path in the application that the end-user's user-agent is redirected back to after they have authenticated with GitHub and have granted access to the OAuth application on the _Authorize application_ page.
23
23
@@ -36,12 +36,11 @@ spring:
36
36
oauth2:
37
37
client:
38
38
registration: <1>
39
-
github: <2>
40
-
client-id: github-client-id
41
-
client-secret: github-client-secret
42
-
scope: public_repo
43
-
redirect-uri-template: "{baseUrl}/github-repos"
44
-
client-name: GitHub Repositories
39
+
client-id: <2>
40
+
client-id: replace-with-client-id
41
+
client-secret: replace-with-client-secret
42
+
provider: github
43
+
scopes: read:user,public_repo
45
44
----
46
45
+
47
46
.OAuth Client properties
@@ -57,7 +56,7 @@ spring:
57
56
58
57
Launch the Spring Boot 2.0 sample and go to `http://localhost:8080`.
59
58
You are then redirected to the default _auto-generated_ form login page.
60
-
Log in using *'user'* (username) and *'password'* (password) and then you'll be redirected to GitHub for authentication.
59
+
Log in using *'user'* (username) and *'password'* (password) or click the link to authenticate with GitHub and then you'll be redirected to GitHub for authentication.
61
60
62
61
After authenticating with your GitHub credentials, the next page presented to you is "Authorize application".
63
62
This page will ask you to *Authorize* the application you created in the previous step.
0 commit comments