1

I am new to Spring Boot OAuth2 framework. I have the following working when authenticating incoming requests to ask for token. The "withClient" and "secret" are both hard-coded and I want that to query against database like MySQL. I like different clients to have different login/secret pairs.

Is this possible? Can someone provide example? thanks


    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients.inMemory()
               .withClient("clientA")
               .secret("secret")
               .accessTokenValiditySeconds(2000)        // expire time for access token
               .refreshTokenValiditySeconds(-1)         // expire time for refresh token
               .scopes("read", "write")                         // scope related to resource server
               .authorizedGrantTypes("password");     

    }
Vince Yau
  • 515
  • 1
  • 5
  • 16
  • 1
    Yes, you can. database schema is available at https://docs.spring.io/spring-security/site/docs/current/reference/html5/#dbschema-oauth2-client – Thirumal Jul 16 '20 at 02:12
  • @Thirumal This schema is good. But I am following the details. For instance, where is the secret being stored in the DB? This table does not have such a field. Also, how is this table related to https://github.com/spring-projects/spring-security-oauth/blob/master/spring-security-oauth2/src/test/resources/schema.sql ? – Vince Yau Jul 16 '20 at 18:39

0 Answers0