Skip to content

Create broker domain verifie authenticator#425

Merged
rtufisi merged 2 commits intop2-inc:mainfrom
rtufisi:rtuf/create-broker-domain-verifier-authenticator
Feb 24, 2026
Merged

Create broker domain verifie authenticator#425
rtufisi merged 2 commits intop2-inc:mainfrom
rtufisi:rtuf/create-broker-domain-verifier-authenticator

Conversation

@rtufisi
Copy link
Collaborator

@rtufisi rtufisi commented Feb 12, 2026

No description provided.

@rtufisi rtufisi requested review from pnzrr, vilmosnagy and xgp February 12, 2026 14:54

if (StringUtil.isNotBlank(authenticatedUserEmail)
&& StringUtil.isNotBlank(email)
&& !authenticatedUserEmail.equals(email)) {
Copy link
Member

Choose a reason for hiding this comment

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

We should probably do some domain normalization here to make sure we're comparing the same thing (lower case, stripping periods).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

It still looks a string equality check for me. Should this authenticator pass if I have the registered email in keycloak as foobar@phasetwo.io but some legacy system stores it as FOOBAR@PHASETWO.IO?

Should we use jakarta.mail.internet.InternetAddress's equals method here? Probably write a utility method into the io.phasetwo.service.util.Emails utility class, like: public static boolean isEmailAddressesEqual(String one, String two)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm checking the form of the email in the conditions above

Comment on lines +62 to +64
log.warnf(
"Authenticated user email %s does not have a email {}. Validation not performed",
authResult.user().getEmail(), authResult.user().getEmail());
Copy link
Member

Choose a reason for hiding this comment

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

This log statement looks wrong. authenticatedUserEmail is blank. {} in the log string is the wrong string replacement type. Should be %s.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@p2-inc p2-inc deleted a comment from xgp Feb 13, 2026
@rtufisi rtufisi requested a review from xgp February 13, 2026 09:00
Copy link
Contributor

@vilmosnagy vilmosnagy left a comment

Choose a reason for hiding this comment

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

Can we write some tests for this authenticator? Either unit tests but I'd prefer the integration tests with cypress.

@rtufisi rtufisi force-pushed the rtuf/create-broker-domain-verifier-authenticator branch from 3d97196 to 90c5b03 Compare February 24, 2026 11:29
@github-actions
Copy link

Code Coverage

Overall Project 28.2% -0.73%
Files changed 11.98%

File Coverage
ActiveOrganizationAuthenticator.java 93.2% 🍏
ValidateIdpAuthenticatorFactory.java 51.57% -10.69%
ExistingSessionVerifierAuthenticatorFactory.java 8.43% -91.57%

@rtufisi rtufisi merged commit 3ed7330 into p2-inc:main Feb 24, 2026
3 of 4 checks passed
@rtufisi rtufisi deleted the rtuf/create-broker-domain-verifier-authenticator branch February 24, 2026 11:47
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.

3 participants