Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions click/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class SocialApplication {

@GetMapping("/user")
public Map<String, Object> user(@AuthenticationPrincipal OAuth2User principal) {
Collections.singletonMap("name", principal.getAttribute("name"));
return Collections.singletonMap("name", principal.getAttribute("name"));
}

public static void main(String[] args) {
Expand Down Expand Up @@ -127,4 +127,4 @@ Configuring the `authenticationEntryPoint` achieves this for us.

With those changes in place, the application is complete, and if you run it and visit the home page you should see a nicely styled HTML link to "login with GitHub".
The link takes you not directly to GitHub, but to the local path that processes the authentication (and sends a redirect to GitHub).
Once you have authenticated, you get redirected back to the local app, where it now displays your name (assuming you have set up your permissions in GitHub to allow access to that data).
Once you have authenticated, you get redirected back to the local app, where it now displays your name (assuming you have set up your permissions in GitHub to allow access to that data).
4 changes: 2 additions & 2 deletions custom-error/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public OAuth2UserService<OAuth2UserRequest, OAuth2User> oauth2UserService(WebCli
DefaultOAuth2UserService delegate = new DefaultOAuth2UserService();
return request -> {
OAuth2User user = delegate.loadUser(request);
if (!"github".equals(request.getClientRegistration.getRegistrationId())) {
if (!"github".equals(request.getClientRegistration().getRegistrationId())) {
return user;
}

Expand Down Expand Up @@ -148,4 +148,4 @@ public WebClient rest(ClientRegistrationRepository clients, OAuth2AuthorizedClie
----

TIP: Obviously the code above can be generalized to other authentication rules, some applicable to GitHub and some to other OAuth 2.0 providers.
All you need is the `WebClient` and some knowledge of the provider's API.
All you need is the `WebClient` and some knowledge of the provider's API.