use of com.codingchili.core.security.TokenFactory in project chili-core by codingchili.
the class SerializerTest method setUp.
@Before
public void setUp() {
TokenFactory factory = new TokenFactory(SECRET.getBytes());
token = new Token(factory, TEST);
token = token.addProperty(OWNER, getClass().getSimpleName());
}
use of com.codingchili.core.security.TokenFactory in project chili-core by codingchili.
the class RealmDB method signToken.
@Override
public void signToken(Handler<AsyncResult<Token>> future, String realm, String domain) {
realms.query(ID_NAME).equalTo(realm).execute(map -> {
Collection<RegisteredRealm> realms = map.result();
if (map.succeeded() && realms.size() > 0) {
RegisteredRealm settings = realms.iterator().next();
future.handle(succeededFuture(new Token(new TokenFactory(getSecretBytes(settings)), domain)));
} else {
future.handle(failedFuture(map.cause()));
}
});
}
use of com.codingchili.core.security.TokenFactory in project chili-core by codingchili.
the class ContextMock method getRealmStore.
@Override
public void getRealmStore(Handler<AsyncResult<AsyncRealmStore>> handler) {
new StorageLoader<RegisteredRealm>().privatemap(new StorageContext<>(this)).withValue(RegisteredRealm.class).withDB("", "").build(result -> {
this.realms = new RealmDB(result.result());
RegisteredRealm realm = new RegisteredRealm().setName("realmName").setAuthentication(new Token(new TokenFactory("s".getBytes()), "realmName"));
realms.put(Future.future(), realm);
handler.handle(Future.succeededFuture(realms));
});
}
Aggregations