Skip to content

Commit

Permalink
Update Opaque Token Sample
Browse files Browse the repository at this point in the history
Issue gh-6489
  • Loading branch information
jzheaux committed Jul 9, 2020
1 parent 46cfc16 commit 759b82c
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package sample;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand All @@ -29,8 +28,8 @@
public class OAuth2ResourceServerController {

@GetMapping("/")
public String index(@AuthenticationPrincipal OAuth2AuthenticatedPrincipal principal) {
return String.format("Hello, %s!", (String) principal.getAttribute("sub"));
public String index(@AuthenticationPrincipal(expression="subject") String subject) {
return String.format("Hello, %s!", subject);
}

@GetMapping("/message")
Expand Down

0 comments on commit 759b82c

Please sign in to comment.