|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2017 the original author or authors. |
| 2 | + * Copyright 2016-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
50 | 50 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
51 | 51 | import org.springframework.security.core.userdetails.User;
|
52 | 52 | import org.springframework.security.core.userdetails.UserDetailsService;
|
| 53 | +import org.springframework.security.crypto.factory.PasswordEncoderFactories; |
53 | 54 | import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
54 | 55 | import org.springframework.test.annotation.DirtiesContext;
|
55 | 56 | import org.springframework.test.context.junit4.SpringRunner;
|
56 | 57 | import org.springframework.test.context.web.WebAppConfiguration;
|
57 | 58 | import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
|
58 | 59 | import org.springframework.test.web.servlet.MockMvc;
|
59 | 60 | import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
60 |
| -import org.springframework.util.MultiValueMap; |
61 | 61 | import org.springframework.web.client.HttpClientErrorException;
|
62 | 62 | import org.springframework.web.client.RestTemplate;
|
63 | 63 | import org.springframework.web.context.WebApplicationContext;
|
64 | 64 |
|
65 | 65 | /**
|
66 | 66 | * @author Artem Bilan
|
67 | 67 | * @author Shiliang Li
|
| 68 | + * @author Gary Russell |
68 | 69 | *
|
69 | 70 | * @since 5.0
|
70 | 71 | */
|
@@ -118,20 +119,21 @@ public void testHttpProxyFlow() throws Exception {
|
118 | 119 | @EnableIntegration
|
119 | 120 | public static class ContextConfiguration extends WebSecurityConfigurerAdapter {
|
120 | 121 |
|
| 122 | + @Override |
121 | 123 | @Bean
|
122 | 124 | public UserDetailsService userDetailsService() {
|
123 | 125 | InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
|
124 | 126 |
|
125 | 127 | manager.createUser(
|
126 |
| - User.withDefaultPasswordEncoder() |
127 |
| - .username("admin") |
| 128 | + User.withUsername("admin") |
| 129 | + .passwordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder()::encode) |
128 | 130 | .password("admin")
|
129 | 131 | .roles("ADMIN")
|
130 | 132 | .build());
|
131 | 133 |
|
132 | 134 | manager.createUser(
|
133 |
| - User.withDefaultPasswordEncoder() |
134 |
| - .username("user") |
| 135 | + User.withUsername("user") |
| 136 | + .passwordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder()::encode) |
135 | 137 | .password("user")
|
136 | 138 | .roles("USER")
|
137 | 139 | .build());
|
@@ -174,7 +176,7 @@ public IntegrationFlow httpProxyFlow() {
|
174 | 176 | .from(Http.inboundGateway("/service")
|
175 | 177 | .requestMapping(r -> r.params("name"))
|
176 | 178 | .errorChannel("httpProxyErrorFlow.input"))
|
177 |
| - .handle(Http.<MultiValueMap<String, String>>outboundGateway("/service/internal?{params}") |
| 179 | + .handle(Http.outboundGateway("/service/internal?{params}") |
178 | 180 | .uriVariable("params", "payload")
|
179 | 181 | .expectedResponseType(String.class),
|
180 | 182 | e -> e.id("serviceInternalGateway"))
|
|
0 commit comments