Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

spring boot - Oauth2 SSO Flow

I have a SpringBoot 2.3.4 small application to test the SSO Authentication procedure to several Provider, Open ID compatible, as Okta, Google, Github ecc..

It's pretty simple and everything works fine but I implement the login page with Thymeleaf 3 and now I want to switch to Angular 11 (or to a fully REST service).

The problem is that the Authentication flow starts with this Form action call:

<form method="get" th:action="@{/oauth2/authorization/{clientId}}">
  <button id="login-button" class="btn btn-primary" type="submit">Login</button>
</form>

To reply this call manually (maybe if I can't use an html form) I do a simple redirect as follow:

return "redirect:http://localhost:8080/oauth2/authorization/okta";

Is there a more elegant way to do?

Thanks

question from:https://stackoverflow.com/questions/65920868/oauth2-sso-flow

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I would suggest using Okta's spring boot starter SDK to make it easier: https://github.com/okta/okta-spring-boot

For the angular JS front end, you can use Okta's Angular JS SDK: https://github.com/okta/okta-angular


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...