簡體   English   中英

使用Spring Boot + OAuth2 + Gitlab身份驗證無法重定向到應用程序

[英]No redirection to the app with Spring Boot + OAuth2 + Gitlab authentication

我正在嘗試向我的應用添加身份驗證層。 它應使用我們本地的Gitlab提供的OAuth2。

我已經在Gitlab上注冊了該應用程序,因此我從那里獲得了security.oauth2.client.clientIdsecurity.oauth2.client.clientSecret 我已將重定向URI設置為http://localhost:8080/index.html

現在,對於Spring application.properties,OAuth2部分如下所示:

security.oauth2.client.clientId=SOME_ID
security.oauth2.client.clientSecret=SOME_SECRET
security.oauth2.client.accessToken=https://gitlab.ourserver.com/oauth/access_token
security.oauth2.client.userAuthorizationUri=https://gitlab.ourserver.com/users/sign_in
security.oauth2.client.tokenName=oauth_token
security.oauth2.client.authenticationScheme=query
security.oauth2.client.clientAuthenticationScheme=form

security.oauth2.resource.userInfoUri=userInfoUri: https://gitlab.ourserver.com/api/v4/user

主應用程序類帶有以下注釋:

@SpringBootApplication
@EnableOAuth2Sso
public class GeneratorApplication

這就是配置的全部內容。

當我轉到http:// localhost:8080 / index.html時,它正在重定向到Gitlab登錄頁面,但登錄后仍停留在gitlab頁面上。

您是否嘗試過redirect-uri?

spring.security.oauth2.client.registration.my-client-1.redirect-uri-template

請檢查官方的春季安全性文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM