use of org.infinispan.security.impl.Authorizer in project infinispan by infinispan.
the class SecurityActions method checkPermission.
static void checkPermission(EmbeddedCacheManager cacheManager, AuthorizationPermission permission) {
Authorizer authorizer = getGlobalComponentRegistry(cacheManager).getComponent(Authorizer.class);
authorizer.checkPermission(permission);
}
use of org.infinispan.security.impl.Authorizer in project infinispan by infinispan.
the class SecurityActions method checkPermission.
static void checkPermission(EmbeddedCacheManager cacheManager, AuthorizationPermission permission) {
Authorizer authorizer = getGlobalComponentRegistry(cacheManager).getComponent(Authorizer.class);
authorizer.checkPermission(cacheManager.getSubject(), permission);
}
use of org.infinispan.security.impl.Authorizer in project infinispan by infinispan.
the class SecurityActions method checkPermission.
static void checkPermission(EmbeddedCacheManager cacheManager, AuthorizationPermission permission) {
Authorizer authorizer = getGlobalComponentRegistry(cacheManager).getComponent(Authorizer.class);
authorizer.checkPermission(Security.getSubject(), permission);
}
use of org.infinispan.security.impl.Authorizer in project infinispan by infinispan.
the class SecurityActions method checkPermission.
static void checkPermission(InvocationHelper invocationHelper, RestRequest request, AuthorizationPermission permission) {
EmbeddedCacheManager cacheManager = invocationHelper.getRestCacheManager().getInstance();
Authorizer authorizer = getGlobalComponentRegistry(cacheManager).getComponent(Authorizer.class);
authorizer.checkPermission(request.getSubject(), permission);
}
use of org.infinispan.security.impl.Authorizer in project infinispan by infinispan.
the class SecurityResource method acl.
private CompletionStage<RestResponse> acl(RestRequest request) {
Subject subject = request.getSubject();
RestCacheManager<Object> rcm = invocationHelper.getRestCacheManager();
Collection<String> cacheNames = rcm.getCacheNames();
Json acl = Json.object();
if (subject == null) {
acl.set("subject", Json.array());
} else {
Json jsonSubjects = Json.array();
subject.getPrincipals().forEach(principal -> {
jsonSubjects.add(Json.object().set("name", principal.getName()).set("type", principal.getClass().getSimpleName()));
});
acl.set("subject", jsonSubjects);
Authorizer authorizer = rcm.getAuthorizer();
SubjectACL globalACL = authorizer.getACL(subject);
acl.set("global", aclToJson(globalACL));
Json caches = Json.object();
acl.set("caches", caches);
for (String cacheName : cacheNames) {
Configuration cacheConfiguration = SecurityActions.getCacheConfigurationFromManager(rcm.getInstance(), cacheName);
SubjectACL cacheACL = authorizer.getACL(subject, cacheConfiguration.security().authorization());
caches.set(cacheName, aclToJson(cacheACL));
}
}
return asJsonResponseFuture(acl);
}
Aggregations