spring-projects / spring-authorization-server

Spring Authorization Server
https://spring.io/projects/spring-authorization-server
Apache License 2.0
4.84k stars 1.27k forks source link

How to use api to pull up a oidc flow? #1708

Closed mengxzh closed 1 month ago

mengxzh commented 1 month ago
  1. In Spring Security Samples, Its use /login page to authenticate and pull up a OAuth2 Authorization Code flow;
  2. I want to use Customer Authentication and use OAuth2 Authorization code to complete OIDC; Like this, UsernamePassword is just a sample Authenticate in below code
    @RequestMapping("/login")
    public Authentication login() {
    UsernamePasswordToken unauthenticated = UsernamePasswordToken.unauthenticated("admin", "123456");
    Authentication authenticated = authenticationManager.authenticate(unauthenticated);
    // How to pull up a oauth2 authorization code with OAuth2AuthorizationEndpointFilter
    // may be no result, because OAuth2AuthorizationEndpointFilter redirect to OAuth2 client
    return authenticated;
    }

    May i need customer /oauth2/authorize request in /login request? In Default Config Spring Authorization Server, when authentication authenticated, its use last requestd to pull up Like

    /oauth2/authorize -> no authentication -> save current request -> usernamePasswordFilter -> redirect save last request 

    But i am use no session to complete this, how could i done it?

jgrandja commented 1 month ago

Thanks for getting in touch but questions are better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements.