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

[ELY-2615] Add a test class that tests creating and making use of a custom NameRewriter #1993

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

lvydra
Copy link
Contributor

@lvydra lvydra commented Oct 6, 2023

@lvydra lvydra requested review from fjuma and Skyllarr as code owners October 6, 2023 06:42
Comment on lines 68 to 69
} else if (original.equals("bob")) {
return "Robert";
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the PR!
Something minor: since you have "bob" and "Robert" Configured as constants, are you able to use those here instead?

Comment on lines 13 to 31
private static final String BEFORE_USER_NAME = "bob";
private static final String AFTER_USER_NAME = "Robert";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very small, but "bob" is all lowercase, and "Robert" has a capital R. Is there a reason for that?
If not, could we change it to "Bob" instead?

.setPreRealmRewriter(rewriter)
.build();
ServerAuthenticationContext sac = securityDomain.createNewAuthenticationContext();
sac.setAuthenticationName("john");
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, could it be changed to "John"?


private FileSystemSecurityRealm createSecurityRealm() throws Exception {
FileSystemSecurityRealm realm = new FileSystemSecurityRealm(ServerUtils.getRootPath(true, getClass()));
ServerUtils.addUser(realm, "Robert");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you able to use the AFTER_USER_NAME constant here?

@lvydra
Copy link
Contributor Author

lvydra commented Oct 9, 2023

Hi @PrarthonaPaul, thank you for your review, your suggestion should be addressed now.

Copy link
Contributor

@PrarthonaPaul PrarthonaPaul left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @lvydra

@@ -0,0 +1,75 @@
package org.wildfly.security.auth.server;
Copy link
Contributor

Choose a reason for hiding this comment

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

@lvydra Just a minor, can you please add a license on top of the file? Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Skyllarr Added

@Skyllarr
Copy link
Contributor

@lvydra Thanks!

Copy link
Contributor

@fjuma fjuma left a comment

Choose a reason for hiding this comment

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

Thanks @lvydra!

@fjuma fjuma merged commit a84df48 into wildfly-security:2.x Oct 12, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants