Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...