Codota Logo
ChainAuthHandler
Code IndexAdd Codota to your IDE (free)

How to use
ChainAuthHandler
in
io.vertx.ext.web.handler

Best Java code snippets using io.vertx.ext.web.handler.ChainAuthHandler (Showing top 20 results out of 315)

  • Common ways to obtain ChainAuthHandler
private void myMethod () {
ChainAuthHandler c =
  • Codota IconChainAuthHandler.create()
  • Smart code suggestions by Codota
}
origin: vert-x3/vertx-web

@Override
public void setUp() throws Exception {
 super.setUp();
 JsonObject authConfig = new JsonObject().put("properties_path", "classpath:login/loginusers.properties");
 AuthProvider authProvider = ShiroAuth.create(vertx, new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(authConfig));
 // create a chain
 chain = ChainAuthHandler.create();
 chain
  .append(JWTAuthHandler.create(null))
  .append(BasicAuthHandler.create(authProvider))
  .append(RedirectAuthHandler.create(authProvider));
 router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
 router.route().handler(chain);
 router.route().handler(ctx -> ctx.response().end());
}
origin: io.vertx/vertx-lang-groovy

 public static void parseCredentials(io.vertx.ext.web.handler.ChainAuthHandler 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);
 }
}
origin: io.vertx/vertx-rx-java

/**
 * 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;
}
origin: vert-x3/vertx-rx

public static io.vertx.rxjava.ext.web.handler.ChainAuthHandler create() { 
 io.vertx.rxjava.ext.web.handler.ChainAuthHandler ret = io.vertx.rxjava.ext.web.handler.ChainAuthHandler.newInstance(io.vertx.ext.web.handler.ChainAuthHandler.create());
 return ret;
}
origin: io.vertx/vertx-rx-java

/**
 * Appends a auth provider to the chain.
 * @param authHandler auth handler
 * @return self
 */
public io.vertx.rxjava.ext.web.handler.ChainAuthHandler append(io.vertx.rxjava.ext.web.handler.AuthHandler authHandler) { 
 delegate.append(authHandler.getDelegate());
 return this;
}
origin: io.vertx/vertx-rx-java

/**
 * Clears the chain.
 */
public void clear() { 
 delegate.clear();
}
origin: vert-x3/vertx-rx

/**
 * 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);
}
origin: io.vertx/vertx-rx-java

/**
 * 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;
}
origin: io.vertx/vertx-rx-java

public static io.vertx.rxjava.ext.web.handler.ChainAuthHandler create() { 
 io.vertx.rxjava.ext.web.handler.ChainAuthHandler ret = io.vertx.rxjava.ext.web.handler.ChainAuthHandler.newInstance(io.vertx.ext.web.handler.ChainAuthHandler.create());
 return ret;
}
origin: vert-x3/vertx-rx

/**
 * Appends a auth provider to the chain.
 * @param authHandler auth handler
 * @return self
 */
public io.vertx.rxjava.ext.web.handler.ChainAuthHandler append(io.vertx.rxjava.ext.web.handler.AuthHandler authHandler) { 
 delegate.append(authHandler.getDelegate());
 return this;
}
origin: vert-x3/vertx-rx

/**
 * Clears the chain.
 */
public void clear() { 
 delegate.clear();
}
origin: io.vertx/vertx-rx-java

/**
 * 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);
}
origin: vert-x3/vertx-rx

/**
 * 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;
}
origin: eclipse/hono

@Override
protected void addRoutes(final Router router) {
  if (getConfig().isAuthenticationRequired()) {
    final ChainAuthHandler authHandler = ChainAuthHandler.create();
    authHandler.append(new X509AuthHandler(
        new TenantServiceBasedX509Authentication(getTenantServiceClient(), tracer),
        Optional.ofNullable(clientCertAuthProvider).orElse(
            new X509AuthProvider(getCredentialsServiceClient(), getConfig(), tracer))));
    authHandler.append(new HonoBasicAuthHandler(
        Optional.ofNullable(usernamePasswordAuthProvider).orElse(
            new UsernamePasswordAuthProvider(getCredentialsServiceClient(), getConfig(), tracer)),
        getConfig().getRealm(), tracer));
    addTelemetryApiRoutes(router, authHandler);
    addEventApiRoutes(router, authHandler);
    addCommandResponseRoutes(router, authHandler);
  } else {
    LOG.warn("device authentication has been disabled");
    LOG.warn("any device may publish data on behalf of all other devices");
    addTelemetryApiRoutes(router, null);
    addEventApiRoutes(router, null);
    addCommandResponseRoutes(router, null);
  }
}
origin: silentbalanceyh/vertx-zero

  /**
   * Two mode for handler supported.
   *
   * @param cliffes Cliff in zero system.
   * @return Auth Handler that will be mount to vertx router.
   */
  private AuthHandler create(final Vertx vertx, final Set<Cliff> cliffes) {
    AuthHandler resultHandler = null;
    if (Values.ONE < cliffes.size()) {
      // 1 < handler
      final ChainAuthHandler chain = ChainAuthHandler.create();
      Observable.fromIterable(cliffes)
          .map(item -> this.bolt.mount(vertx, item))
          .subscribe(chain::append).dispose();
      resultHandler = chain;
    } else {
      // 1 = handler
      if (!cliffes.isEmpty()) {
        final Cliff cliff = cliffes.iterator().next();
        resultHandler = this.bolt.mount(vertx, cliff);
      }
    }
    return resultHandler;
  }
}
origin: org.eclipse.hono/hono-adapter-http-vertx

@Override
protected void addRoutes(final Router router) {
  if (getConfig().isAuthenticationRequired()) {
    final ChainAuthHandler authHandler = new HonoChainAuthHandler();
    authHandler.append(new X509AuthHandler(
        Optional.ofNullable(clientCertAuthProvider).orElse(
            new X509AuthProvider(getCredentialsServiceClient(), getConfig())),
        getTenantServiceClient(),
        tracer));
    authHandler.append(new HonoBasicAuthHandler(
        Optional.ofNullable(usernamePasswordAuthProvider).orElse(
            new UsernamePasswordAuthProvider(getCredentialsServiceClient(), getConfig())),
        getConfig().getRealm()));
    addTelemetryApiRoutes(router, authHandler);
    addEventApiRoutes(router, authHandler);
    addCommandResponseRoutes(router, authHandler);
  } else {
    LOG.warn("device authentication has been disabled");
    LOG.warn("any device may publish data on behalf of all other devices");
    addTelemetryApiRoutes(router, null);
    addEventApiRoutes(router, null);
    addCommandResponseRoutes(router, null);
  }
}
origin: vert-x3/vertx-rx

/**
 * 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);
}
origin: vert-x3/vertx-rx

/**
 * 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;
}
origin: io.vertx/vertx-web

@Override
public void setUp() throws Exception {
 super.setUp();
 JsonObject authConfig = new JsonObject().put("properties_path", "classpath:login/loginusers.properties");
 AuthProvider authProvider = ShiroAuth.create(vertx, new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(authConfig));
 // create a chain
 chain = ChainAuthHandler.create();
 chain
  .append(JWTAuthHandler.create(null))
  .append(BasicAuthHandler.create(authProvider))
  .append(RedirectAuthHandler.create(authProvider));
 router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
 router.route().handler(chain);
 router.route().handler(ctx -> ctx.response().end());
}
origin: cn.vertxup/vertx-up

  /**
   * Two mode for handler supported.
   *
   * @param cliffes Cliff in zero system.
   * @return Auth Handler that will be mount to vertx router.
   */
  private AuthHandler create(final Vertx vertx, final Set<Cliff> cliffes) {
    AuthHandler resultHandler = null;
    if (Values.ONE < cliffes.size()) {
      // 1 < handler
      final ChainAuthHandler chain = ChainAuthHandler.create();
      Observable.fromIterable(cliffes)
          .map(item -> this.bolt.mount(vertx, item))
          .subscribe(chain::append).dispose();
      resultHandler = chain;
    } else {
      // 1 = handler
      if (!cliffes.isEmpty()) {
        final Cliff cliff = cliffes.iterator().next();
        resultHandler = this.bolt.mount(vertx, cliff);
      }
    }
    return resultHandler;
  }
}
io.vertx.ext.web.handlerChainAuthHandler

Javadoc

An auth handler that chains to a sequence of handlers.

Most used methods

  • create
  • append
    Appends a auth provider to the chain.
  • parseCredentials
  • addAuthorities
  • addAuthority
  • authorize
  • clear
    Clears the chain.
  • handle
  • remove
    Removes a provider from the chain.

Popular in Java

  • Finding current android device location
  • getExternalFilesDir (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now