8000 Pluggable Features of Token Manager by tnorimat · Pull Request #12551 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Pluggable Features of Token Manager - #12551

Merged
mposolda merged 1 commit into
keycloak:mainfrom
Hitachi:ISSUE-12065
Oct 7, 2022
Merged

mposolda merged 1 commit into
keycloak:mainfrom
Hitachi:ISSUE-12065

Conversation

@tnorimat
Copy link
Copy Markdown
Contributor

Closes #12065

@tnorimat
Copy link
Copy Markdown
Contributor Author

The PR provides keycloak users with capability of adding their own features to token generation in the pluggable way, namely client policies' executors/conditions.

The PR provides the following arquillian integration tests:

  • enforcing DPoP regardless of DPoP and MTLS sender constraint token settings.
  • suppressing refresh token rotation, which is required by Open Banking Brazil FAPI 1.0 security profile Implementer's Draft 3 and FAPI 2.0 baseline.

@mposolda mposolda self-assigned this Aug 23, 2022
@evertongodoi
Copy link
Copy Markdown

@tnorimat do you have a date, to merge this branch to master ?

@tnorimat
Copy link
Copy Markdown
Contributor Author

@evertongodoi Hello, this PR is under review. I will rebase the PR on the latest master because the the PR has conflicts with the latest master branch.

@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnorimat PR looks good, Thanks for that and sorry for the late review.

I've added few inline comments, but nothing major.

return createTokenResponse(user, userSession, clientSessionCtx, scopeParam, true, s -> {return new TokenResponseContext(formParams, parseResult, clientSessionCtx, s);});
}

public Response createTokenResponse(UserModel user, UserSessionModel userSession, ClientSessionContext clientSessionCtx,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is possible to remove method createTokenResponse with this signature and keep just the newly added with clientPolicyContextGenerator as an argument?

Copy link
Copy Markdown
Contributor Author< 8000 /span>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will remove the createTokenResponse in L443-446. Nobody calls the method.

}

private void verifyDPoPProof(ClientPolicyContext context) throws ClientPolicyException {
// retrieve a DPoP Proof JWT from the "DPoP" HTTP header
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Should there be follow-up issue to uncomment (and test) this once DPoP is available in Keycloak? Or possibly it can be done during DPoP initial PR itself? In this case, note should be added likely to the DPoP issue about that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you suggested, I think this test should be done in the follow-up issue of the DPoP initial PR. Therefore, I will remove this test from the PR.

}

private void verifyBindingTokensWithDPoPPublicKey(TokenResponseContext context) {
// retrieve a DPoP public key from the DPoP Proof JWT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you suggested, I think this test should be done in the follow-up issue of the DPoP initial PR. Therefore, I will remove this test from the PR.

}

@Test
public void testExtendedCl 8000 ientPolicyIntefacesForDeviceTokenResponse() throws Exception {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Looks that ClientPoliciesTest class is already very big and contains 49 test methods. Will it makes sense to add the new test for "extended" methods into separate test class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also think that ClientPoliciesTest became too big. How about creating other PR for refactoring ClientPoliciesTest? I am willing to work on this refactoring.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnorimat +1, if you can create follow-up GH issue and the follow-up PR, it will be very nice. Thank you!

@tnorimat
tnorimat commented Oct 6, 2022
Copy link
Copy Markdown
Contributor Author

@mposolda I have fixed the PR as you suggested. Could you check it?

@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnorimat Thanks for the updates Takashi!

I've added inline comment regarding the follow-up task for ClientPoliciesTest

@mposolda
mposolda merged commit 148c769 into keycloak:main Oct 7, 2022
@tnorimat
tnorimat commented Oct 7, 2022
Copy link
Copy Markdown
Contributor Author

@mposolda I will create follow-up GH issue and the follow-up PR.

@mposolda
mposolda commented Oct 7, 2022
Copy link
Copy Markdown
Contributor

@tnorimat Thanks!

@tnorimat
tnorimat commented Oct 7, 2022
Copy link
Copy Markdown
Contributor Author

@mposolda I have created the follow-up issue (#14795).

@mposolda
Copy link
Copy Markdown
Contributor

@tnorimat Thanks for creating follow-up issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pluggable Features of Token Manager

4 participants

0