从Azure广告中的重定向URI获取令牌

时间:2019-11-30 07:16:11

标签: java azure spring-boot azure-active-directory azure-ad-b2c

这是我的控制器类代码

  @PreAuthorize("hasRole('Users')")
   @RequestMapping("/")
   public String helloWorld() {
      return "Hello World!";
   }

在azure门户中,我将重定向uri设置为http://localhost:8080/login/oauth2/code/azure 当我点击localhost:8080时,它向我问好世界。与此一起,它返回重定向uri上的代码。 如何获取该代码。

1 个答案:

答案 0 :(得分:0)

您可以使用 getParameter

  private final static String CODE = "code";

  String code = httpRequest.getParameter(CODE);

这里是example