I am trying to add authentication layer to my app. It should use OAuth2 provided by our local Gitlab.
I have registered the app on Gitlab, so I get the security.oauth2.client.clientId
and security.oauth2.client.clientSecret
from there. I have set the Redirect URI to http://localhost:8080/index.html
.
Now for the Spring application.properties, the OAuth2 part looks like this:
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
The main application class is annotated with:
@SpringBootApplication
@EnableOAuth2Sso
public class GeneratorApplication
That is all for the configuration.
When I go to http://localhost:8080/index.html it is redirecting to the Gitlab login page, but after logging in it stays on the gitlab page...
Have you tried redirect-uri ?
spring.security.oauth2.client.registration.my-client-1.redirect-uri-template
Please check the official spring security documentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.