Search in sources :

Example 1 with Cliff

use of io.vertx.up.atom.secure.Cliff in project vertx-zero by silentbalanceyh.

the class WallInquirerTc method testScanCorrect.

@Test
public void testScanCorrect() {
    final Set<Class<?>> classes = getClasses();
    classes.remove(WallKeeper2.class);
    final Set<Cliff> treeResult = this.walls.scan(classes);
    for (final Cliff instance : treeResult) {
        System.out.println(instance);
    }
}
Also used : Cliff(io.vertx.up.atom.secure.Cliff) Test(org.junit.Test)

Example 2 with Cliff

use of io.vertx.up.atom.secure.Cliff in project vertx-zero by silentbalanceyh.

the class WallInquirer method scan.

@Override
public Set<Cliff> scan(final Set<Class<?>> walls) {
    /**
     * 1. Build result *
     */
    final Set<Cliff> wallSet = new TreeSet<>();
    final Set<Class<?>> wallClses = walls.stream().filter((item) -> item.isAnnotationPresent(Wall.class)).collect(Collectors.toSet());
    if (!wallClses.isEmpty()) {
        /**
         * It means that you have set Wall and enable security configuration
         * wallClses verification
         */
        final ConcurrentMap<String, Class<?>> keys = new ConcurrentHashMap<>();
        final JsonObject config = this.verify(wallClses, keys);
        for (final String field : config.fieldNames()) {
            // Difference key setting
            final Class<?> cls = keys.get(field);
            final Cliff cliff = this.transformer.transform(config.getJsonObject(field));
            // Set Information from class
            this.mountData(cliff, cls);
            wallSet.add(cliff);
        }
    }
    /**
     * 3. Transfer *
     */
    return wallSet;
}
Also used : Transformer(io.vertx.zero.marshal.Transformer) Ut(io.vertx.up.tool.Ut) Rampart(io.vertx.up.secure.Rampart) TreeSet(java.util.TreeSet) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) Annal(io.vertx.up.log.Annal) Observable(io.reactivex.Observable) JsonObject(io.vertx.core.json.JsonObject) Node(io.vertx.zero.marshal.node.Node) WallKeyMissingException(io.vertx.zero.exception.WallKeyMissingException) PhylumAuth(io.vertx.up.secure.inquire.PhylumAuth) Fn(io.vertx.up.func.Fn) Cliff(io.vertx.up.atom.secure.Cliff) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) DynamicKeyMissingException(io.vertx.zero.exception.DynamicKeyMissingException) Set(java.util.Set) Collectors(java.util.stream.Collectors) Instance(io.vertx.up.tool.mirror.Instance) ZeroUniform(io.vertx.zero.marshal.node.ZeroUniform) Objects(java.util.Objects) OstiumAuth(io.vertx.up.secure.inquire.OstiumAuth) WallDuplicatedException(io.vertx.zero.exception.WallDuplicatedException) Annotation(java.lang.annotation.Annotation) Wall(io.vertx.up.annotations.Wall) Cliff(io.vertx.up.atom.secure.Cliff) TreeSet(java.util.TreeSet) JsonObject(io.vertx.core.json.JsonObject) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 3 with Cliff

use of io.vertx.up.atom.secure.Cliff in project vertx-zero by silentbalanceyh.

the class MongoWall method transform.

@Override
public Cliff transform(final JsonObject input) {
    Fn.flingUp(() -> Ruler.verify("wall-mongo", input), LOGGER);
    final Cliff cliff = new Cliff();
    cliff.setType(WallType.MONGO);
    cliff.setConfig(input.getJsonObject("config"));
    return cliff;
}
Also used : Cliff(io.vertx.up.atom.secure.Cliff)

Example 4 with Cliff

use of io.vertx.up.atom.secure.Cliff in project vertx-zero by silentbalanceyh.

the class JwtWall method transform.

@Override
public Cliff transform(final JsonObject input) {
    Fn.flingUp(() -> Ruler.verify("wall-jwt", input), LOGGER);
    final Cliff cliff = new Cliff();
    cliff.setType(WallType.JWT);
    cliff.setConfig(input.getJsonObject("config"));
    return cliff;
}
Also used : Cliff(io.vertx.up.atom.secure.Cliff)

Example 5 with Cliff

use of io.vertx.up.atom.secure.Cliff in project vertx-zero by silentbalanceyh.

the class WallAxis method create.

/**
 * Two mode for handler supported.
 *
 * @param cliffes
 * @return
 */
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);
        resultHandler = chain;
    } else {
        // 1 = handler
        if (!cliffes.isEmpty()) {
            final Cliff cliff = cliffes.iterator().next();
            resultHandler = this.bolt.mount(vertx, cliff);
        }
    }
    return resultHandler;
}
Also used : AuthHandler(io.vertx.ext.web.handler.AuthHandler) ChainAuthHandler(io.vertx.ext.web.handler.ChainAuthHandler) AuthHandler(io.vertx.ext.web.handler.AuthHandler) LocalSessionStore(io.vertx.ext.web.sstore.LocalSessionStore) Cliff(io.vertx.up.atom.secure.Cliff) ChainAuthHandler(io.vertx.ext.web.handler.ChainAuthHandler) Vertx(io.vertx.core.Vertx) Router(io.vertx.ext.web.Router) Set(java.util.Set) AuthenticateEndurer(io.vertx.up.web.failure.AuthenticateEndurer) TreeSet(java.util.TreeSet) Bolt(io.vertx.up.rs.secure.Bolt) Axis(io.vertx.up.rs.Axis) Values(io.vertx.zero.eon.Values) SessionHandler(io.vertx.ext.web.handler.SessionHandler) Orders(io.vertx.up.eon.Orders) ZeroAnno(io.vertx.up.web.ZeroAnno) Observable(io.reactivex.Observable) Cliff(io.vertx.up.atom.secure.Cliff) ChainAuthHandler(io.vertx.ext.web.handler.ChainAuthHandler)

Aggregations

Cliff (io.vertx.up.atom.secure.Cliff)5 Observable (io.reactivex.Observable)2 Set (java.util.Set)2 TreeSet (java.util.TreeSet)2 Vertx (io.vertx.core.Vertx)1 JsonObject (io.vertx.core.json.JsonObject)1 Router (io.vertx.ext.web.Router)1 AuthHandler (io.vertx.ext.web.handler.AuthHandler)1 ChainAuthHandler (io.vertx.ext.web.handler.ChainAuthHandler)1 SessionHandler (io.vertx.ext.web.handler.SessionHandler)1 LocalSessionStore (io.vertx.ext.web.sstore.LocalSessionStore)1 Wall (io.vertx.up.annotations.Wall)1 Orders (io.vertx.up.eon.Orders)1 Fn (io.vertx.up.func.Fn)1 Annal (io.vertx.up.log.Annal)1 Axis (io.vertx.up.rs.Axis)1 Bolt (io.vertx.up.rs.secure.Bolt)1 Rampart (io.vertx.up.secure.Rampart)1 OstiumAuth (io.vertx.up.secure.inquire.OstiumAuth)1 PhylumAuth (io.vertx.up.secure.inquire.PhylumAuth)1