Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
only2dhir committed Mar 15, 2018
1 parent d384301 commit c79ca9a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
Expand Up @@ -7,7 +7,6 @@
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.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
import org.springframework.security.oauth2.provider.token.TokenStore;

@Configuration
Expand All @@ -29,9 +28,6 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
@Autowired
private TokenStore tokenStore;

@Autowired
private UserApprovalHandler userApprovalHandler;

@Autowired
private AuthenticationManager authenticationManager;

Expand All @@ -50,7 +46,7 @@ public void configure(ClientDetailsServiceConfigurer configurer) throws Exceptio

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore).userApprovalHandler(userApprovalHandler)
endpoints.tokenStore(tokenStore)
.authenticationManager(authenticationManager);
}
}
26 changes: 0 additions & 26 deletions src/main/java/com/devglan/config/SecurityConfig.java
Expand Up @@ -12,11 +12,6 @@
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
import org.springframework.security.oauth2.provider.approval.TokenApprovalStore;
import org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore;
import org.springframework.web.cors.CorsConfiguration;
Expand All @@ -33,9 +28,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Resource(name = "userService")
private UserDetailsService userDetailsService;

@Autowired
private ClientDetailsService clientDetailsService;

@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
Expand All @@ -62,24 +54,6 @@ public TokenStore tokenStore() {
return new InMemoryTokenStore();
}

@Bean
@Autowired
public TokenStoreUserApprovalHandler userApprovalHandler(TokenStore tokenStore){
TokenStoreUserApprovalHandler handler = new TokenStoreUserApprovalHandler();
handler.setTokenStore(tokenStore);
handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService));
handler.setClientDetailsService(clientDetailsService);
return handler;
}

@Bean
@Autowired
public ApprovalStore approvalStore(TokenStore tokenStore) throws Exception {
TokenApprovalStore store = new TokenApprovalStore();
store.setTokenStore(tokenStore);
return store;
}

@Bean
public BCryptPasswordEncoder encoder(){
return new BCryptPasswordEncoder();
Expand Down

0 comments on commit c79ca9a

Please sign in to comment.