Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide convenience method for applying WebTestClientConfigurer [SPR-15770] #20325

Closed
spring-issuemaster opened this issue Jul 14, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jul 14, 2017

Rob Winch opened SPR-15770 and commented

Right now any extension that wants to provide a WebTestClientConfigurer needs to do the following:

client
  .mutate()
  .apply(mockPrincipal(() -> "user"))
  .build()
  ...

An extension could provide a workaround for this by doing something like this:

withIdentity(client, () -> "user")
   ...

However, this workaround requires every extension providing the same logic. Additionally, applying multiple extensions becomes a bit difficult to read.

withFooExtension(
    withIdentity(client, () -> "user"), "foo")
   ...

Alternatively, it would be nice if something like this were provided:

client
  .with(mockPrincipal(() -> "user"))
  ...

Referenced from: commits f5c54f9

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 14, 2017

Rossen Stoyanchev commented

client.with(configurer) is a little too general. I'm going to make that client.mutateWith(configurer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.