use of com.tvd12.ezyfoxserver.request.EzyRequestAppRequest in project ezyfox-server by youngmonkeys.
the class EzyServerUserInterceptorTest method test.
@Test(expectedExceptions = { EzyNotAuthorizedException.class })
public void test() throws Exception {
EzyServerContext context = newServerContext();
EzyServerUserInterceptor interceptor = new EzyServerUserInterceptor();
EzyRequestAppRequest request = new EzySimpleRequestAppRequest();
interceptor.intercept(context, request);
}
use of com.tvd12.ezyfoxserver.request.EzyRequestAppRequest in project ezyfox-server by youngmonkeys.
the class EzyRequestAppController method handle.
@Override
public void handle(EzyServerContext ctx, EzyRequestAppRequest request) {
EzyRequestAppParams params = request.getParams();
EzyAppContext appCtx = ctx.getAppContext(params.getAppId());
EzyApplication app = appCtx.getApp();
EzyAppRequestController requestController = app.getRequestController();
// user manager for checking, user must be managed
EzyUserManager userManger = appCtx.getApp().getUserManager();
EzyUser user = request.getUser();
// check user joined app or not to prevent spam request
boolean hasAccessed = userManger.containsUser(user);
if (hasAccessed) {
// redirect handling to app
EzyUserRequestAppEvent event = newRequestAppEvent(request);
requestController.handle(appCtx, event);
} else {
EzySession session = request.getSession();
responseRequestAppError(ctx, session);
}
}
Aggregations