Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git clone https://github.com/ArnaudDenoyelle/sscce-spring-oauth2.git
- mvn spring-boot:run
- http://localhost:9999/uaa/oauth/authorize?response_type=code&client_id=acme&redirect_uri=http://example.com
- -user : user
- -password : password
- @SpringBootApplication
- public class AuthserverApplication extends WebMvcConfigurerAdapter {
- public static void main(String[] args) {
- SpringApplication.run(AuthserverApplication.class, args);
- }
- @Configuration
- @EnableAuthorizationServer
- protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter {
- @Autowired
- private AuthenticationManager authenticationManager;
- @Override
- public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
- endpoints.authenticationManager(authenticationManager);
- }
- @Override
- public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
- clients.inMemory()
- .withClient("acme")
- .secret("acmesecret")
- .authorizedGrantTypes("authorization_code", "refresh_token", "password").scopes("openid");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement