@Test public void testEnsurePermitted_permitted() throws Exception { when(contentPermissionChecker.isPermitted(eq("SecurityFacetSupportTest"), eq("test"), eq(READ), any())) .thenReturn(true); try { testSecurityFacetSupport.ensurePermitted(request); } catch (Exception e) { fail("permitted action should have been permitted"); } }
@Override public void ensurePermitted(final Request request) { checkNotNull(request); String action = action(request); Repository repo = getRepository(); VariableSource variableSource = variableResolverAdapter.fromRequest(request, getRepository()); if (!contentPermissionChecker.isPermitted(repo.getName(), repo.getFormat().getValue(), action, variableSource)) { throw new AuthorizationException(); } }
SecurityFacetSupport extends FacetSupport implements SecurityFacet { @Override public void ensurePermitted(final Request request) { checkNotNull(request); String action = action(request); Repository repo = getRepository(); VariableSource variableSource = variableResolverAdapter.fromRequest(request, getRepository()); if (!contentPermissionChecker.isPermitted(repo.getName(), repo.getFormat().getValue(), action, variableSource)) { throw new AuthorizationException(); } } }
SecurityFacetSupport extends FacetSupport implements SecurityFacet { @Override public void ensurePermitted(final Request request) { checkNotNull(request); String action = action(request); Repository repo = getRepository(); VariableSource variableSource = variableResolverAdapter.fromRequest(request, getRepository()); if (!contentPermissionChecker.isPermitted(repo.getName(), repo.getFormat().getValue(), action, variableSource)) { throw new AuthorizationException(); } } SecurityFacetSupport(final RepositoryFormatSecurityContributor securityContributor,
                              final VariableResolverAdapter variableResolverAdapter,
                              final ContentPermissionChecker contentPermissionChecker); }
SecurityFacetSupport extends FacetSupport implements SecurityFacet { @Override public void ensurePermitted(final Request request) { checkNotNull(request); String action = action(request); Repository repo = getRepository(); VariableSource variableSource = variableResolverAdapter.fromRequest(request, getRepository()); if (!contentPermissionChecker.isPermitted(repo.getName(), repo.getFormat().getValue(), action, variableSource)) { throw new AuthorizationException(); } } SecurityFacetSupport(final RepositoryFormatSecurityContributor securityContributor,
                              final VariableResolverAdapter variableResolverAdapter,
                              final ContentPermissionChecker contentPermissionChecker); @Override void ensurePermitted(final Request request); }
SecurityFacetSupport extends FacetSupport implements SecurityFacet { @Override public void ensurePermitted(final Request request) { checkNotNull(request); String action = action(request); Repository repo = getRepository(); VariableSource variableSource = variableResolverAdapter.fromRequest(request, getRepository()); if (!contentPermissionChecker.isPermitted(repo.getName(), repo.getFormat().getValue(), action, variableSource)) { throw new AuthorizationException(); } } SecurityFacetSupport(final RepositoryFormatSecurityContributor securityContributor,
                              final VariableResolverAdapter variableResolverAdapter,
                              final ContentPermissionChecker contentPermissionChecker); @Override void ensurePermitted(final Request request);  }