properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); properties.put(SignedContentConstants.AUTHORIZATION_ENGINE, SignedContentConstants.DEFAULT_AUTHORIZATION_ENGINE); defaultAuthEngineReg = context.registerService(AuthorizationEngine.class.getName(), new DefaultAuthorizationEngine(context, ADAPTOR.getState()), properties);
public void processInstalledBundles() { Bundle[] bundles = bundleContext.getBundles(); for (int i = 0; i < bundles.length; i++) { BaseData baseData = (BaseData) ((AbstractBundle) bundles[i]).getBundleData(); SignedStorageHook hook = (SignedStorageHook) baseData.getStorageHook(SignedStorageHook.KEY); SignedContent signedContent = hook != null ? hook.getSignedContent() : null; authorize(signedContent, bundles[i]); } }
public boolean performOk() { // update the policy iff the page is dirty AuthorizationEngine authEngine = Activator.getAuthorizationEngine(); if (authEngine instanceof DefaultAuthorizationEngine) { DefaultAuthorizationEngine defaultAuthEngine = (DefaultAuthorizationEngine) authEngine; defaultAuthEngine.setLoadPolicy(selectedPolicy); } else { // log the error } return super.performOk(); }
protected AuthorizationEvent doAuthorize(SignedContent content, Object context) { boolean enabled = isEnabled(content, context); AuthorizationEvent event = null; if (context instanceof Bundle) { BundleDescription desc = systemState.getBundle(((Bundle) context).getBundleId()); if (!enabled) { DisabledInfo info = new DisabledInfo(POLICY_NAME, null, desc); // TODO add an error message systemState.addDisabledInfo(info); event = new AuthorizationEvent(AuthorizationEvent.DENIED, content, context, 0); // TODO severity?? } else { DisabledInfo info = systemState.getDisabledInfo(desc, POLICY_NAME); if (info != null) { systemState.removeDisabledInfo(info); } event = new AuthorizationEvent(AuthorizationEvent.ALLOWED, content, context, 0); } } return event; }
selectedPolicy = defaultAuthEngine.getLoadPolicy();
protected AuthorizationEvent doAuthorize(SignedContent content, Object context) { boolean enabled = isEnabled(content, context); AuthorizationEvent event = null; if (context instanceof Bundle) { BundleDescription desc = systemState.getBundle(((Bundle) context).getBundleId()); if (!enabled) { DisabledInfo info = new DisabledInfo(POLICY_NAME, null, desc); // TODO add an error message systemState.addDisabledInfo(info); event = new AuthorizationEvent(AuthorizationEvent.DENIED, content, context, 0); // TODO severity?? } else { DisabledInfo info = systemState.getDisabledInfo(desc, POLICY_NAME); if (info != null) { systemState.removeDisabledInfo(info); } event = new AuthorizationEvent(AuthorizationEvent.ALLOWED, content, context, 0); } } return event; }
public void processInstalledBundles() { Bundle[] bundles = bundleContext.getBundles(); for (int i = 0; i < bundles.length; i++) { BaseData baseData = (BaseData) ((AbstractBundle) bundles[i]).getBundleData(); SignedStorageHook hook = (SignedStorageHook) baseData.getStorageHook(SignedStorageHook.KEY); SignedContent signedContent = hook != null ? hook.getSignedContent() : null; authorize(signedContent, bundles[i]); } }
properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); properties.put(SignedContentConstants.AUTHORIZATION_ENGINE, SignedContentConstants.DEFAULT_AUTHORIZATION_ENGINE); defaultAuthEngineReg = context.registerService(AuthorizationEngine.class.getName(), new DefaultAuthorizationEngine(context, ADAPTOR.getState()), properties);