use of com.tvd12.ezyfoxserver.response.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyLoginController method responseLoginError.
protected void responseLoginError(EzyServerContext ctx, EzySession session, EzyILoginError error) {
EzyResponse response = newLoginErrorResponse(error);
ctx.send(response, session, false);
}
use of com.tvd12.ezyfoxserver.response.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyLoginProcessor method apply.
public void apply(EzyZoneContext zoneContext, EzyUserLoginEvent event) {
EzyZone zone = zoneContext.getZone();
EzyZoneSetting zoneSetting = zone.getSetting();
EzyUserManagementSetting userManagementSetting = zoneSetting.getUserManagement();
String username = checkUsername(event.getUsername(), userManagementSetting.getUserNamePattern(), userManagementSetting.isAllowGuestLogin(), userManagementSetting.getGuestNamePrefix());
String password = event.getPassword();
EzyZoneUserManager userManager = zone.getUserManager();
EzyUser user;
EzySession session = event.getSession();
boolean alreadyLoggedIn;
Lock lock = userManager.getLock(username);
lock.lock();
try {
alreadyLoggedIn = userManager.containsUser(username);
if (alreadyLoggedIn) {
user = userManager.getUser(username);
} else {
user = newUser(zoneSetting, userManagementSetting, username, password, event.getUserProperties());
}
int maxSessionPerUser = userManagementSetting.getMaxSessionPerUser();
boolean allowChangeSession = userManagementSetting.isAllowChangeSession();
EzyStreamingSetting streamingSetting = zoneSetting.getStreaming();
boolean streamingEnable = streamingSetting.isEnable() && event.isStreamingEnable();
processUserSessions(user, session, maxSessionPerUser, allowChangeSession, streamingEnable);
addUserToManager(userManager, user, session, alreadyLoggedIn);
} finally {
lock.unlock();
userManager.removeLock(username);
}
fireUserAddedEvent(zoneContext, user, session, event.getData(), alreadyLoggedIn);
EzyResponse response = newLoginResponse(zoneContext, user, event.getOutput());
serverContext.send(response, session, false);
}
use of com.tvd12.ezyfoxserver.response.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyPingController method handle.
@Override
public void handle(EzyServerContext ctx, EzyPingRequest request) {
EzyResponse response = EzyPongResponse.getInstance();
EzySession session = request.getSession();
ctx.send(response, session, false);
}
use of com.tvd12.ezyfoxserver.response.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyPluginInfoController method handle.
@Override
public void handle(EzyServerContext ctx, EzyPluginInfoRequest request) {
EzyUser user = request.getUser();
EzySession session = request.getSession();
EzyPluginInfoParams params = request.getParams();
EzyZoneContext zoneCtx = ctx.getZoneContext(user.getZoneId());
EzyPluginContext pluginCtx = zoneCtx.getPluginContext(params.getPluginName());
if (pluginCtx != null) {
EzyPluginSetting setting = pluginCtx.getPlugin().getSetting();
EzyResponse response = newPluginInfoResponse(setting);
ctx.send(response, session, false);
}
}
use of com.tvd12.ezyfoxserver.response.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyAccessAppController method responseAccessAppError.
protected void responseAccessAppError(EzyServerContext ctx, EzySession session, EzyAccessAppException exception) {
EzyResponse response = newAccessAppErrorResponse(exception.getError());
ctx.send(response, session, false);
}
Aggregations