Skip to content

Mock Jwt Support should accept a fully-configured Jwt #6896

Closed

Description

@jzheaux

A tester can configure a mock request with a Jwt like so:

this.mvc.perform(get("/")
    .with(jwt()))
// ...

Or like so:

this.mvc.perform(get("/")
    .with(jwt(jwt -> jwt.subject("sub"))))
// ...

It'd be nice to also accept a fully-configured Jwt:

Jwt jwt = // ...
this.mvc.perform(get("/")
    .with(jwt(jwt)))
// ...

Both on the servlet side as well as the reactive side:

Jwt jwt = // ...
this.client
    .mutateWith(mockJwt(jwt))
// ...

Activity

  1. added
    in: testAn issue in spring-security-test
    in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
    status: first-timers-onlyAn issue that can only be worked on by brand new contributors
    on May 22, 2019
  2. added this to the General Backlog milestone on May 22, 2019
  3. sandmannn commented on May 22, 2019

    @sandmannn
    Contributor

    Hi, I would like to pick this up

  4. jzheaux commented on May 22, 2019

    @jzheaux
    CollaboratorAuthor

    Thanks, @sandmannn! It's yours.

  5. self-assigned this
    on May 22, 2019
  6. jzheaux commented on May 29, 2019

    @jzheaux
    CollaboratorAuthor

    @sandmannn how are things coming? Do you have any questions?

  7. sandmannn commented on May 30, 2019

    @sandmannn
    Contributor

    I think servlet and reactive can be addressed in different PRs. Lets start iterating on servlet part in this PR #6923
    What would be the best place to put tests for it? Up to now I found only https://github.com/sandmannn/spring-security/blob/d0f5b428847c1050d38da7d2af98eb2cda6a9b9e/samples/boot/oauth2resourceserver/src/test/java/sample/OAuth2ResourceServerControllerTests.java where the existing jwt() calls are used in mockMvc.perform(get(....).with(jwt())) style, as you specified in original post.

  8. added a commit that references this issue on Jun 12, 2019
  9. modified the milestones: General Backlog, 5.2.x on Jun 12, 2019
  10. added a commit that references this issue on Jun 15, 2019
    23a7c30
  11. modified the milestones: 5.2.x, 5.2.0.RC1 on Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)in: testAn issue in spring-security-testtype: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions