Skip to content

ELY-2921: Add principal tranformer support to TokenSecurityRealm#2296

Merged
darranl merged 1 commit intowildfly-security:2.xfrom
theashiot:ELY-2921
Oct 1, 2025
Merged

ELY-2921: Add principal tranformer support to TokenSecurityRealm#2296
darranl merged 1 commit intowildfly-security:2.xfrom
theashiot:ELY-2921

Conversation

@theashiot
Copy link
Copy Markdown
Contributor

@theashiot theashiot changed the base branch from 2.x to 2.6.x July 28, 2025 20:39
this.claimToPrincipal = configuration.claimToPrincipal;
}

if (configuration.principalTransformer == null) {
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.

Is the "if" stmt needed. I appears that this.principalTransormer is always assigned to what ever the value of configration.principalTransformer is.

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.

you're right! I've removed the if statement.


TokenRealmIdentity(Evidence evidence, Function<Principal, Principal> principalTransformer) {
this(evidence);
if (principalTransformer != null) {
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.

As above is the "if" stmt really needed here?

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.

Turns out that this constructor was not needed at all, so I've removed it.

@theashiot
Copy link
Copy Markdown
Contributor Author

Thanks, @rsearls for the review! i've made the required changes and also added a test. Would you mind having another look?
best,
ashwin

@theashiot theashiot marked this pull request as ready for review July 29, 2025 19:31
@theashiot theashiot requested review from fjuma and skyllarr as code owners July 29, 2025 19:31
@skyllarr
Copy link
Copy Markdown
Contributor

Hi @theashiot , thanks for working on this! Just checking, this issue is a part of a feature request https://issues.redhat.com/browse/WFCORE-7301 ? SHould we have proposal PR to the wildfly-proposals for this?

@darranl
Copy link
Copy Markdown
Contributor

darranl commented Aug 3, 2025

FYI on this one I think we will be able to merge to Elytron once we are happy it satisifes the requiurements of the feature, I believe this is not a part of public API and it will not be available until end users until the subsystem changes are mered so I think we can merge early.

@darranl
Copy link
Copy Markdown
Contributor

darranl commented Aug 7, 2025

FYI had a catch up with @theashiot who will add a couple more tests before we merge.

@theashiot
Copy link
Copy Markdown
Contributor Author

I added a test to check what happens when a null is passed instead of a principal-transformer: https://github.com/wildfly-security/wildfly-elytron/pull/2296/files#diff-751480ea2b6fff70f36f431bf3f6170c6bdb75a2c5e411f71ab66e3a1f0efeb5R135

best,

ashwin

@darranl darranl changed the base branch from 2.6.x to 2.x October 1, 2025 10:12
@darranl darranl merged commit d16dc86 into wildfly-security:2.x Oct 1, 2025
9 checks passed
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.

4 participants