StackAsk is a community where developers ask questions, share answers and learn from each others real-world experience, so every solved problem helps the next person who runs into it.
spring-boot-starter-oauth2-resource-server 3.1.4 spring-boot-starter-oauth2-client 3.1.4 spring-security-oauth2-authorization-server 1.1.3
spring.security.oauth2.client.registration.sales.authorization-grant-type=password,authorization_code spring.security.oauth2.client.registration.sales.client-id=sales spring.security.oauth2.client.registration.sales.client-secret=password spring.security.oauth2.client.registration.sales.scope[0]=user_info spring.security.oauth2.client.provider.sales.authorization-uri=http://port:8668/sso-server/oauth/check_token
@Configuration @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true) public class ResourceServer extends ResourceServerConfigurerAdapter { @Value("") private String tokenEndpointUrl; @Value("") private String clientId; @Value("") private String clientSecret; @Bean public RemoteTokenServices tokenServices() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { RemoteTokenServices tokenServices = new RemoteTokenServices(); tokenServices.setCheckTokenEndpointUrl(tokenEndpointUrl); tokenServices.setClientId(clientId); tokenServices.setClientSecret(clientSecret); return tokenServices; } @Override public void configure(HttpSecurity http) throws Exception { http.cors().and() .requestMatchers().antMatchers("/api/**").and().authorizeRequests().anyRequest().authenticated(); } }
RemoteTokenServices
2.2K Point(s)
1.2K Point(s)
313 Point(s)
178 Point(s)
138 Point(s)
Input your email to receive reset password link, or if you remember your password, you can click