@Override public AuthHandler addAuthorities(Set<String> authorities) { for (AuthHandler h : handlers) { h.addAuthorities(authorities); } return this; }
@Override public AuthHandler addAuthority(String authority) { for (AuthHandler h : handlers) { h.addAuthority(authority); } return this; }
authHandler.parseCredentials(ctx, res -> { if (res.failed()) { if (res.cause() instanceof HttpStatusException) {
private void handle(InterceptableRoutingContext context, int orLevelIndex, int andLevelIndex) { // reset context context.clearUser(); context.setNextCallback(null); context.setFailedCallback(null); // prepare routing next of failure behaviours if (andLevelIndex < security.get(orLevelIndex).size() - 1) { context.setNextCallback(() -> handle(context, orLevelIndex, andLevelIndex + 1)); } if (orLevelIndex < security.size() - 1) { context.setFailedCallback(() -> handle(context, orLevelIndex + 1, 0)); } // navigate to the auth provider at given orIndex and andIndex and call it. // if it fails, the context will call the next auth handler at the OR level, or fail or no more are available. // if it succeeds, the context will call the next auth handler at the AND level, or call the next route handler if no more are available. Map<String, List<String>> orSecurityIdentifiers = security.get(orLevelIndex); if (!orSecurityIdentifiers.isEmpty()) { List<String> andSecurityIdentifiers = new ArrayList<>(orSecurityIdentifiers.keySet()); String securityIdentifier = andSecurityIdentifiers.get(andLevelIndex); AuthHandler handler = SwaggerAuthHandlerFactory.this.getAuthHandler(securityIdentifier); if (handler != null) { context.put(SwaggerRouter.AUTH_PROVIDER_NAME_HEADER_KEY, securityIdentifier); handler.addAuthorities(this.authorities).handle(context); } else { context.fail(401); } } else { context.fail(401); } }
/** * 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()); }
/** * 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); }
/** * 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()); }
/** * 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); }
/** * 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; }
@Override public AuthHandler addAuthority(String authority) { for (AuthHandler h : handlers) { h.addAuthority(authority); } return this; }
public static void parseCredentials(io.vertx.ext.web.handler.AuthHandler 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); } }
@Override public void handle(RoutingContext context) { context.put(AUTH_HANDLER_PROP, authHandler); MemberUtil.recoverContextUser(context); authHandler.handle(context); }
@Override public AuthHandler addAuthorities(final Set<String> authorities) { for (AuthHandler h : handlers) { h.addAuthorities(authorities); } return this; }
/** * 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; }
/** * 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); }
@Override public AuthHandler addAuthorities(Set<String> authorities) { for (AuthHandler h : handlers) { h.addAuthorities(authorities); } return this; }
/** * 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; }
/** * 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 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; }
@Override public AuthHandler addAuthority(final String authority) { for (AuthHandler h : handlers) { h.addAuthority(authority); } return this; }