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-projects-issues opened this issue Jul 14, 2017 · 1 comment

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants