Im struggling with Spring Boot. I found great project on git hub and I am putting things together to understand what is happening. I have this piece of code and I don't understand what is doing:
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
// @formatter:off
clients
.inMemory()
.withClient("clientapp")
.authorizedGrantTypes("password", "refresh_token")
.authorities("USER")
.scopes("read", "write")
.resourceIds(RESOURCE_ID)
.secret("123456");
// @formatter:on
}
what do I define with this inMemory()? and wihtClinet and so on... I don't get it, I would need some explanation, please.
Oauth2 authenticates client apps for some access types about user's information.
In your example, it configures a client app with name clientapp
.
inMemory
means all the necessary data to create a session will be stored in memory. When you restart your application, all the session data will be gone, which means users need to login and authenticate again.
Grant types represent the rights of the client app over user's information. In this case client app have rights to read and write user's password
and refresh_token
.
If you want to learn more of it you can take a look at this tutorial. You should also know what oAuth2 is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With