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

Implement support to manage permissions for external authentication #194

Merged
merged 5 commits into from
Oct 24, 2019

Conversation

mbarto
Copy link
Contributor

@mbarto mbarto commented Oct 21, 2019

  • changes to db security table to add explicit fields for username and groupname (to be used instead of ids when authentication is externalized)
  • centralized security stuff in SecurityDAO, so that we can plug a new implementation for external authentication
  • removed some dependencies from user / groups id where not needed
  • introduced ExternalSecurityDAO implementation

@coveralls
Copy link

coveralls commented Oct 21, 2019

Coverage Status

Coverage increased (+0.9%) to 35.189% when pulling 063bbbd on mbarto:external_auth into cec205c on geosolutions-it:master.

Copy link
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

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

great, looks good 👍
Also rationalization of SecurityDAO is a good simplification. Can you take a look to my comments?

Comment on lines 83 to 100
// SecurityRule security = new SecurityRule();
// security.setCanRead(true);
// security.setCanWrite(true);
// security.setCategory(category);
// security.setResource(resource);
//
// // ///////////////////////////////////////////////////////
// // The Exception should be trapped because only one
// // between resource and category can be specified
// // ///////////////////////////////////////////////////////
// try{
// securityDAO.persist(security);
// fail("Exception not trapped");
// } catch(Exception exc) {
// if(LOGGER.isDebugEnabled()){
// LOGGER.debug("OK: exception trapped", exc);
// }
// }
Copy link
Member

Choose a reason for hiding this comment

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

I think you can remove this

@@ -906,14 +906,6 @@ public void updateSecurityRules(long id, List<SecurityRule> rules)
// insert new rules
for (SecurityRule rule : rules) {
rule.setResource(resource);
//Retrieve from db the entity usergroup, if the securityrule is related to a group
Copy link
Member

Choose a reason for hiding this comment

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

I see this rule is a little strange, so probably this is the reason why you deleted it.

I'm afraid this was made to allow this method to work when the rule comes from a ReST API request, so the group is not from the DB but from the client, therefore it has only the ID set.
About this I think (as far as I remember ) there was some tests made using client, that are not automated. There should be a way to execute them. Can you give it a try?

@@ -82,6 +86,14 @@ protected void authenticate(HttpServletRequest req) {
}

}
if (!everyoneFound && addEveryOneGroup) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this is because headers may not contain the everyone group but the geostore model require it to share public resources, isn't it?
Does it work even for guest user?

Can you please explain a little bit this in a comment

Copy link
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

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

I Verified the client tests are passing. Your change anyway avoid the problem 👍

@mbarto mbarto merged commit 15b4ac8 into geosolutions-it:master Oct 24, 2019
@mbarto mbarto deleted the external_auth branch October 24, 2019 12:24
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