|
7 | 7 | import com.mongodb.client.MongoDatabase; |
8 | 8 | import org.bson.Document; |
9 | 9 | import org.bson.types.ObjectId; |
| 10 | +import org.evomaster.client.java.controller.AuthUtils; |
10 | 11 | import org.evomaster.client.java.controller.ExternalSutController; |
11 | 12 | import org.evomaster.client.java.controller.InstrumentedSutStarter; |
12 | 13 | import org.evomaster.client.java.controller.api.dto.auth.AuthenticationDto; |
13 | | -import org.evomaster.client.java.controller.api.dto.auth.JsonTokenPostLoginDto; |
14 | 14 | import org.evomaster.client.java.controller.api.dto.SutInfoDto; |
15 | 15 | import org.evomaster.client.java.sql.DbSpecification; |
16 | 16 | import org.evomaster.client.java.controller.problem.ProblemInfo; |
@@ -256,36 +256,24 @@ public SutInfoDto.OutputFormat getPreferredOutputFormat() { |
256 | 256 | public List<AuthenticationDto> getInfoForAuthentication() { |
257 | 257 |
|
258 | 258 | return Arrays.asList( |
259 | | - new AuthenticationDto() {{ |
260 | | - name = "admin"; |
261 | | - jsonTokenPostLogin = new JsonTokenPostLoginDto() {{ |
262 | | - userId = "admin"; |
263 | | - endpoint = "/api/user/login"; |
264 | | - jsonPayload = "{\"username\":\"admin\", \"password\":\""+rawPassword+"\"}"; |
265 | | - extractTokenField = "/accessToken"; |
266 | | - headerPrefix = "Bearer "; |
267 | | - }}; |
268 | | - }}, |
269 | | - new AuthenticationDto() {{ |
270 | | - name = "foo"; |
271 | | - jsonTokenPostLogin = new JsonTokenPostLoginDto() {{ |
272 | | - userId = "foo"; |
273 | | - endpoint = "/api/user/login"; |
274 | | - jsonPayload = "{\"username\":\"foo\", \"password\":\""+rawPassword+"\"}"; |
275 | | - extractTokenField = "/accessToken"; |
276 | | - headerPrefix = "Bearer "; |
277 | | - }}; |
278 | | - }}, |
279 | | - new AuthenticationDto() {{ |
280 | | - name = "bar"; |
281 | | - jsonTokenPostLogin = new JsonTokenPostLoginDto() {{ |
282 | | - userId = "bar"; |
283 | | - endpoint = "/api/user/login"; |
284 | | - jsonPayload = "{\"username\":\"bar\", \"password\":\""+rawPassword+"\"}"; |
285 | | - extractTokenField = "/accessToken"; |
286 | | - headerPrefix = "Bearer "; |
287 | | - }}; |
288 | | - }} |
| 259 | + AuthUtils.getForJsonTokenBearer( |
| 260 | + "admin", |
| 261 | + "/api/user/login", |
| 262 | + "{\"username\":\"admin\", \"password\":\""+rawPassword+"\"}", |
| 263 | + "/accessToken" |
| 264 | + ), |
| 265 | + AuthUtils.getForJsonTokenBearer( |
| 266 | + "foo", |
| 267 | + "/api/user/login", |
| 268 | + "{\"username\":\"foo\", \"password\":\""+rawPassword+"\"}", |
| 269 | + "/accessToken" |
| 270 | + ), |
| 271 | + AuthUtils.getForJsonTokenBearer( |
| 272 | + "bar", |
| 273 | + "/api/user/login", |
| 274 | + "{\"username\":\"bar\", \"password\":\""+rawPassword+"\"}", |
| 275 | + "/accessToken" |
| 276 | + ) |
289 | 277 | ); |
290 | 278 | } |
291 | 279 |
|
|
0 commit comments