content: package com.epam.dsc2019.cloud.security.resource.server;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.security.crypto.password.PasswordEncoder;
  import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
  import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
  import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
  import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
  
  @Configuration
  @EnableAuthorizationServer
  public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {
  
    @Autowired
    private PasswordEncoder passwordEncoder;
  
    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
      clients.inMemory()
          .withClient("some-client-details")
          .secret(passwordEncoder.encode("some-client-secret"))
          .authorizedGrantTypes("authorization_code")
          .scopes("user_info")
          .autoApprove(false)
          .redirectUris("http://localhost:8080/login");
    }
  
    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
      security.tokenKeyAccess("permitAll()")
          .checkTokenAccess("isAuthenticated()");
    }
  }
  