@@ -0,0 +1,1052 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/. */%0Apackage org.ocelotds.dashboard.security;%0A%0Aimport javax.inject.Inject;%0Aimport org.ocelotds.context.OcelotContext;%0Aimport org.ocelotds.security.InvocationContext;%0Aimport org.ocelotds.security.SecureProvider;%0A%0A/**%0A *%0A * @author hhfrancois%0A */%0Apublic class DashboardSecureProvider implements SecureProvider %7B%0A%09%0A%09@Inject%0A%09OcelotContext context;%0A%09%0A%09@Inject%0A%09RoleConfigurationManager rcm;%0A%09%0A%09@Override%0A%09public void checkAccess(InvocationContext ctx, String%5B%5D roles) throws IllegalAccessException %7B%0A%09%09boolean allowed = rcm.getRoles().isEmpty();%0A%09%09for (String role : rcm.getRoles()) %7B%0A%09%09%09allowed %7C= context.isUserInRole(role);%0A%09%09%09if(allowed) %7B%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09if(!allowed) %7B%0A%09%09%09throw new IllegalAccessException(context.getPrincipal().getName()+%22 no access to %22+ctx.getMethod().getDeclaringClass().getName()+%22.%22+ctx.getMethod().getName());%0A%09%09%7D%0A%09%7D%0A%09%0A%7D%0A

secure dashboard with roles from configuration