I have the in memory thing working as follows:
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemo
This question is fairly old but none of the replies gave an answer to the questioner's original problem. I've stumbled over the same issue while getting myself familar with spring's oauth2 implementation and wondered why the ClientDetailsServiceConfigurer
is not persisting the clients that were programmatically added via the JdbcClientDetailsServiceBuilder
(which is instantiated by calling the jdbc(datasource)
method on the configurer), despite that all tutorials on the net showed a similar example such as that posted by Wim. After digging deeper into the code i've noticed the reason. Well, it's simply because the code to update the oauth_clients_details
table is never called. What's missing is the following call after configuring all clients: .and().build()
. So, Wim's code must actually look as follows:
clients.jdbc(dataSource).withClient("clientapp")
.authorizedGrantTypes("password", "refresh_token")
.authorities("USER")
.scopes("read", "write")
.resourceIds(RESOURCE_ID)
.secret("123456").and().build();
Et voila, the client clientapp
is now persisted into the database.