router.route("/api/*").handler(JWTAuthHandler.create(jwt, "/api/newToken"));
router.route("/api/protected").handler(JWTAuthHandler.create(jwt)); router.route("/api/protected/defcon1").handler(JWTAuthHandler.create(jwt).addAuthority("defcon1")); router.route("/api/protected/defcon2").handler(JWTAuthHandler.create(jwt).addAuthority("defcon2")); router.route("/api/protected/defcon3").handler(JWTAuthHandler.create(jwt).addAuthority("defcon3"));
public static void parseCredentials(io.vertx.ext.web.handler.JWTAuthHandler j_receiver, io.vertx.ext.web.RoutingContext context, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) { j_receiver.parseCredentials(context, handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null); } }
/** * Add a required authority for this auth handler * @param authority the authority * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.AuthHandler addAuthority(String authority) { delegate.addAuthority(authority); return this; }
/** * Authorizes the given user against all added authorities. * @param user a user. * @param handler the handler for the result. */ public void authorize(io.vertx.rxjava.ext.auth.User user, Handler<AsyncResult<Void>> handler) { delegate.authorize(user.getDelegate(), handler); }
/** * Set the audience list * @param audience the audience list * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setAudience(List<String> audience) { delegate.setAudience(audience); return this; }
/** * Set whether expiration is ignored * @param ignoreExpiration whether expiration is ignored * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setIgnoreExpiration(boolean ignoreExpiration) { delegate.setIgnoreExpiration(ignoreExpiration); return this; }
/** * Something has happened, so handle it. * @param event the event to handle */ public void handle(io.vertx.rxjava.ext.web.RoutingContext event) { delegate.handle(event.getDelegate()); }
/** * Add a set of required authorities for this auth handler * @param authorities the set of authorities * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.AuthHandler addAuthorities(Set<String> authorities) { delegate.addAuthorities(authorities); return this; }
/** * Set the issuer * @param issuer the issuer * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setIssuer(String issuer) { delegate.setIssuer(issuer); return this; }
/** * Parses the credentials from the request into a JsonObject. The implementation should * be able to extract the required info for the auth provider in the format the provider * expects. * @param context the routing context * @param handler the handler to be called once the information is available. */ public void parseCredentials(io.vertx.rxjava.ext.web.RoutingContext context, Handler<AsyncResult<JsonObject>> handler) { delegate.parseCredentials(context.getDelegate(), handler); }
/** * Add a required authority for this auth handler * @param authority the authority * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.AuthHandler addAuthority(String authority) { delegate.addAuthority(authority); return this; }
/** * Authorizes the given user against all added authorities. * @param user a user. * @param handler the handler for the result. */ public void authorize(io.vertx.rxjava.ext.auth.User user, Handler<AsyncResult<Void>> handler) { delegate.authorize(user.getDelegate(), handler); }
/** * Set the audience list * @param audience the audience list * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setAudience(List<String> audience) { delegate.setAudience(audience); return this; }
/** * Set whether expiration is ignored * @param ignoreExpiration whether expiration is ignored * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setIgnoreExpiration(boolean ignoreExpiration) { delegate.setIgnoreExpiration(ignoreExpiration); return this; }
/** * Something has happened, so handle it. * @param event the event to handle */ public void handle(io.vertx.rxjava.ext.web.RoutingContext event) { delegate.handle(event.getDelegate()); }
/** * Add a set of required authorities for this auth handler * @param authorities the set of authorities * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.AuthHandler addAuthorities(Set<String> authorities) { delegate.addAuthorities(authorities); return this; }
/** * Set the issuer * @param issuer the issuer * @return a reference to this for fluency */ public io.vertx.rxjava.ext.web.handler.JWTAuthHandler setIssuer(String issuer) { delegate.setIssuer(issuer); return this; }
}); router.route("/api/protected*").handler(JWTAuthHandler.create(jwt));
/** * Parses the credentials from the request into a JsonObject. The implementation should * be able to extract the required info for the auth provider in the format the provider * expects. * @param context the routing context * @param handler the handler to be called once the information is available. */ public void parseCredentials(io.vertx.rxjava.ext.web.RoutingContext context, Handler<AsyncResult<JsonObject>> handler) { delegate.parseCredentials(context.getDelegate(), handler); }