use of org.openremote.manager.event.EventSubscriptionAuthorizer in project openremote by openremote.
the class AssetStorageService method init.
@Override
public void init(Container container) throws Exception {
timerService = container.getService(TimerService.class);
persistenceService = container.getService(PersistenceService.class);
identityService = container.getService(ManagerIdentityService.class);
clientEventService = container.getService(ClientEventService.class);
gatewayService = container.getService(GatewayService.class);
EventSubscriptionAuthorizer assetEventAuthorizer = AssetStorageService.assetInfoAuthorizer(identityService, this);
clientEventService.addSubscriptionAuthorizer((realm, auth, subscription) -> {
if (!subscription.isEventType(AssetEvent.class)) {
return false;
}
return assetEventAuthorizer.authorise(realm, auth, subscription);
});
container.getService(ManagerWebService.class).addApiSingleton(new AssetResourceImpl(container.getService(TimerService.class), identityService, this, container.getService(MessageBrokerService.class)));
container.getService(ManagerWebService.class).addApiSingleton(new ConsoleResourceImpl(container.getService(TimerService.class), identityService, this, clientEventService));
container.getService(MessageBrokerService.class).getContext().addRoutes(this);
}
Aggregations