如何更改默认的Spring Boot oauth URL(/ login / oauth2 / code和/ oauth2 / authorization)?

时间:2019-01-09 00:04:23

标签: spring spring-boot spring-security oauth-2.0 spring-security-oauth2

在Spring Boot中用于启动oAuth并从OAuth提供程序获取身份验证代码的默认URL为:

  • ["keyup","keydown"].forEach((event) => { window.addEventListener(event, (e) => { document.onselectstart = function() { return !(e.key == "Shift" && e.shiftKey); } }); }); (例如:import logging # Avoid logger Errors and register your own logger # create logger with pubnub logger = logging.getLogger('pubnub') logger.setLevel(logging.DEBUG) # set to other levels in different environments ie (test / prod) # create file handler which logs even debug messages fh = logging.FileHandler('pubnub.log') fh.setLevel(logging.DEBUG) # register your handler to pubnub log logger.addHandler(fh)
  • /oauth2/authorization/{providerReg}

我需要更改它们,以便它们前面有一个前缀。我该怎么做?

似乎这是硬编码在/oauth2/authorization/azure/login/oauth2/code/{providerReg}中的。有没有办法让那些人使用我的URL或让Spring Boot使用我的实现呢?

1 个答案:

答案 0 :(得分:1)

请参阅文档https://docs.spring.io/spring-security/site/docs/5.1.0.RELEASE/reference/htmlsingle/#oauth2login-advanced-login-page

  

要覆盖默认登录页面,请配置oauth2Login()。loginPage()和(可选)oauth2Login()。authorizationEndpoint()。baseUri()。