diff --git a/click/README.adoc b/click/README.adoc index cecd115..7440d1f 100644 --- a/click/README.adoc +++ b/click/README.adoc @@ -60,7 +60,7 @@ public class SocialApplication { @GetMapping("/user") public Map user(@AuthenticationPrincipal OAuth2User principal) { - Collections.singletonMap("name", principal.getAttribute("name")); + return Collections.singletonMap("name", principal.getAttribute("name")); } public static void main(String[] args) { @@ -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). \ No newline at end of file +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). diff --git a/custom-error/README.adoc b/custom-error/README.adoc index 9bbe1f8..51d5727 100644 --- a/custom-error/README.adoc +++ b/custom-error/README.adoc @@ -106,7 +106,7 @@ public OAuth2UserService 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; } @@ -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. \ No newline at end of file +All you need is the `WebClient` and some knowledge of the provider's API.