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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations