use of org.nustaq.kontraktor.annotations.Remoted in project kontraktor by RuedigerMoeller.
the class ReactAppSession method createTokenLink.
@Remoted
public IPromise<String> createTokenLink() {
Promise res = new Promise();
getSessionStorage().createToken(new ISessionStorage.Token(userKey, "hello", 60_000l)).then((s, err) -> {
if (s != null)
res.resolve("direct/" + s);
else
res.reject(err);
});
return res;
}
use of org.nustaq.kontraktor.annotations.Remoted in project kontraktor by RuedigerMoeller.
the class ReactApp method register.
@Remoted
public IPromise register(String nick, String pwd, String text) {
Promise p = new Promise();
sessionStorage.putUserIfNotPresent(MapRecord.New(nick).put("pwd", pwd).put("text", text).put("verified", true)).then((r, e) -> {
if (!r) {
p.reject("user " + nick + " already exists");
} else {
p.resolve(true);
}
});
return p;
}
use of org.nustaq.kontraktor.annotations.Remoted in project kontraktor by RuedigerMoeller.
the class BasicWebAppActor method login.
/**
* returns an array of [session actorproxy, userdata]
* @param user
* @param pw
* @param jwt
* @return array [session actor proxy, authenticationresult]
*/
@Remoted
public IPromise<Object[]> login(String user, String pw, String jwt) {
Promise res = new Promise();
ConnectionRegistry remoteConnection = connection.get();
getCredentials(user, pw, jwt).then((authres, err) -> {
if (err != null) {
res.reject(err);
} else {
String sessionId = remoteConnection != null ? remoteConnection.getSocketRef().getConnectionIdentifier() : null;
getSession(user, sessionId, authres).then((sess, serr) -> {
if (sess != null) {
if (sessionId != null && sessionStorage != null) {
sessionStorage.putUserAtSessionId(sessionId, user);
}
res.resolve(new Object[] { sess, authres });
} else
res.complete(sess, serr);
});
}
});
return res;
}
use of org.nustaq.kontraktor.annotations.Remoted in project kontraktor by RuedigerMoeller.
the class ReactAppSession method createTokenLink.
@Remoted
public IPromise<String> createTokenLink() {
Promise res = new Promise();
getSessionStorage().createToken(new ISessionStorage.Token(userKey, "hello", 60_000l)).then((s, err) -> {
if (s != null)
res.resolve("direct/" + s);
else
res.reject(err);
});
return res;
}
use of org.nustaq.kontraktor.annotations.Remoted in project kontraktor by RuedigerMoeller.
the class ReactApp method register.
@Remoted
public IPromise register(String nick, String pwd, String text) {
Promise p = new Promise();
sessionStorage.putUserIfNotPresent(MapRecord.New(nick).put("pwd", pwd).put("text", text).put("verified", true)).then((r, e) -> {
if (!r) {
p.reject("user " + nick + " already exists");
} else {
p.resolve(true);
}
});
return p;
}
Aggregations