Skip to content

Add ObjectIdentityGenerator customization to JdbcAclService #10081

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

Closed
wants to merge 1 commit into from

Conversation

Ditscheridou
Copy link

Basically there should no hard coded creation of an object identity in the implementations, so everywhere where this happens i changed this to a call against the ObjectIdentityGenerator.createObjectIdentity(). So now you can define, easily how this object identity is created.

@pivotal-cla
Copy link

@Ditscheridou Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 15, 2021
@pivotal-cla
Copy link

@Ditscheridou Thank you for signing the Contributor License Agreement!

@sjohnr sjohnr added the in: acl An issue in spring-security-acl label Jul 16, 2021
@sjohnr sjohnr removed the status: waiting-for-triage An issue we've not yet triaged label Jul 16, 2021
Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @Ditscheridou! I've left some feedback inline.

Also, in preparation will you please review the contribution guidelines about squashing and formatting commits?

@@ -152,8 +137,9 @@ public BasicLookupStrategy(DataSource dataSource, AclCache aclCache,
* @param aclAuthorizationStrategy authorization strategy (required)
* @param grantingStrategy the PermissionGrantingStrategy
*/
public BasicLookupStrategy(DataSource dataSource, AclCache aclCache,
AclAuthorizationStrategy aclAuthorizationStrategy, PermissionGrantingStrategy grantingStrategy) {
public BasicLookupStrategy(DataSource dataSource, AclCache aclCache,
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a constructor parameter breaks backward compatibility, so I would recommend that this be moved to a setter.

Additionally, it's quite common in Spring Security for required members to be constructor parameters and optional members to have setters.

Copy link
Contributor

Choose a reason for hiding this comment

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

This setter should also confirm that the provided strategy is not null.

Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

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

Hi, @Ditscheridou, just one more item that I didn't notice until just now.

import org.springframework.security.acls.model.PermissionGrantingStrategy;
import org.springframework.security.acls.model.Sid;
import org.springframework.security.acls.model.UnloadedSidException;
import org.springframework.security.acls.domain.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

My apologies, I didn't notice this earlier. Let's please leave package imports exploded. Ideally, import ordering should not change in a PR.

Copy link
Author

Choose a reason for hiding this comment

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

sorry for that, that happens when you press strg+ shift + o too much. Will fix this!

…inside the BasicLookupStrategy,JdbcAclService

There was a problem with hard coded object identity creation inside the BasicLookupStrategy and the JdbcAclService. It was overkill to overwrite
these classes only for changing this, so introducing an ObjectIdentityGenerator seems the be the better solution here. At default, the standard
ObjectIdentityRetrievalStrategyImpl is used, but can be customized due to setters.

Closes spring-projectsgh-10081
@Ditscheridou
Copy link
Author

I reworked my pr to meet your requirements, hopefully i did everything right!

@jzheaux
Copy link
Contributor

jzheaux commented Jul 23, 2021

Thanks, @Ditscheridou! I think there is a bit more formatting to take care of. Will you take a look at the diff and ensure that the only changes to the code are the ones needed for your PR? I'm still seeing import changes, and some whitespace changes appear to have been introduced.

Along those same lines, please run the format task to ensure that everything is correctly formatted.

Once things are ready again, will you please also shorten the commit title, this simplifies looking through the git log down the road.

@jzheaux
Copy link
Contributor

jzheaux commented Aug 12, 2021

Hi, @Ditscheridou! Are you still able to do the requested changes? I'm happy to lend a hand as well.

@Ditscheridou
Copy link
Author

@jzheaux, sorry for the delay. Im currently busy with the release of our company project, so i will sadly not be able to fix within the next two weeks. Sorry for that, that was not my intention when i openend this pr. But if this can wait, i will come back to this when we rollout this.

@jzheaux
Copy link
Contributor

jzheaux commented Aug 12, 2021

Thanks, @Ditscheridou, I think waiting is fine.

@jzheaux
Copy link
Contributor

jzheaux commented Oct 14, 2021

Hi, @Ditscheridou, are you able to make the requested changes now?

@jzheaux jzheaux removed their assignment Nov 19, 2021
@sjohnr sjohnr self-assigned this Nov 23, 2021
@sjohnr sjohnr added status: duplicate A duplicate of another issue type: enhancement A general enhancement labels Nov 23, 2021
@sjohnr sjohnr changed the title Fixing #10080 Add ObjectIdentityGenerator customization to JdbcAclService Nov 23, 2021
sjohnr pushed a commit to sjohnr/spring-security that referenced this pull request Nov 23, 2021
@sjohnr
Copy link
Contributor

sjohnr commented Nov 23, 2021

Thanks @Ditscheridou, this is now in main as 86193b9.

I've added a polish commit for the remaining items: 74e3abc

@sjohnr sjohnr closed this Nov 23, 2021
@sjohnr sjohnr added this to the 6.0.0-M1 milestone Nov 23, 2021
sjohnr pushed a commit that referenced this pull request Nov 30, 2021
@sjohnr sjohnr modified the milestones: 6.0.0-M1, 5.7.0-M1 Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: acl An issue in spring-security-acl status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants