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

ISPN-12868 Configure ACL cache #9165

Merged
merged 1 commit into from Mar 31, 2021

Conversation

tristantarrant
Copy link
Member

*/
void flushGlobalACLCache();
CompletionStage<Void> flushGlobalACLCache();

Choose a reason for hiding this comment

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

This is public API, so we should deprecate rather than change it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really: the only way to obtain a GlobalSecurityManager is through the component registry. I wouldn't worry about it

.create();
}

private CompletionStage<RestResponse> aclCacheFlush(RestRequest request) {
EmbeddedCacheManager cm = invocationHelper.getRestCacheManager().getInstance();
return SecurityActions.getGlobalComponentRegistry(cm).getComponent(GlobalSecurityManager.class).flushGlobalACLCache()

Choose a reason for hiding this comment

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

You can cache the GlobalSecurityManager instead of looking it up on every request I think

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do

Copy link
Member Author

Choose a reason for hiding this comment

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

Rethinking about it: this is such a rare operation, that caching the GSM would be wasteful

@@ -80,9 +82,18 @@ public Invocations getInvocations() {
.invocation().methods(PUT).path("/v2/security/roles/{principal}").withAction("deny")
.permission(AuthorizationPermission.ADMIN).name("ROLES DENY").auditContext(AuditContext.SERVER)
.handleWith(this::deny)
.invocation().methods(POST).path("/v2/security/cache").withAction("flush")
.permission(AuthorizationPermission.ADMIN).name("ACL CACHE FLUSH").auditContext(AuditContext.SERVER)
.handleWith(this::aclCacheFlush)

Choose a reason for hiding this comment

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

Not strictly related to this PR, but well, let's not waste the context :)
Could add an indent or a line break between each invocation declaration to make it easier to read?

return SecurityActions.getGlobalComponentRegistry(cm).getComponent(GlobalSecurityManager.class).flushGlobalACLCache()
.thenApply(v -> new NettyRestResponse.Builder().status(NO_CONTENT).build());
}

Choose a reason for hiding this comment

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

I couldn't find any documentation for the SecurityResource, could you add it? It could be in another PR

@oraNod
Copy link
Contributor

oraNod commented Mar 26, 2021

@tristantarrant FYI I pushed some suggested doc for the ACL cache.

@tristantarrant
Copy link
Member Author

I've squashed the commits and added docs for the public security resource methods (I'd rather not document the methods which are of exclusive use to the console)

@ryanemerson ryanemerson merged commit f7290b0 into infinispan:master Mar 31, 2021
@ryanemerson
Copy link
Contributor

Thanks @tristantarrant

@tristantarrant tristantarrant deleted the ISPN-12868/acl_cache branch April 1, 2021 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants