Java Code Examples for io.vertx.ext.bridge.PermittedOptions#setRequiredAuthority()
The following examples show how to use
io.vertx.ext.bridge.PermittedOptions#setRequiredAuthority() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventBusBridgeVisitor.java From nubes with Apache License 2.0 | 5 votes |
private static PermittedOptions createPermittedOptions(String address, String addressRegex, String requiredAuthority) { PermittedOptions options = new PermittedOptions(); if (!"".equals(address)) { options.setAddress(address); } if (!"".equals(addressRegex)) { options.setAddressRegex(addressRegex); } if (!"".equals(requiredAuthority)) { options.setRequiredAuthority(requiredAuthority); } return options; }
Example 2
Source File: WebExamples.java From vertx-web with Apache License 2.0 | 5 votes |
public void example47() { // Let through any messages sent to 'demo.orderService' from the client PermittedOptions inboundPermitted = new PermittedOptions() .setAddress("demo.orderService"); // But only if the user is logged in and has the authority "place_orders" inboundPermitted.setRequiredAuthority("place_orders"); SockJSBridgeOptions options = new SockJSBridgeOptions() .addInboundPermitted(inboundPermitted); }
Example 3
Source File: WebExamples.java From vertx-web with Apache License 2.0 | 3 votes |
public void example48(Vertx vertx, AuthenticationProvider authProvider) { Router router = Router.router(vertx); // Let through any messages sent to 'demo.orderService' from the client PermittedOptions inboundPermitted = new PermittedOptions() .setAddress("demo.orderService"); // But only if the user is logged in and has the authority "place_orders" inboundPermitted.setRequiredAuthority("place_orders"); SockJSHandler sockJSHandler = SockJSHandler.create(vertx); // Now set up some basic auth handling: router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx))); AuthenticationHandler basicAuthHandler = BasicAuthHandler.create(authProvider); router.route("/eventbus/*").handler(basicAuthHandler); // mount the bridge on the router router.mountSubRouter( "/eventbus", sockJSHandler.bridge(new SockJSBridgeOptions() .addInboundPermitted(inboundPermitted))); }