@Override @SuppressWarnings("unchecked") public Promise<SimpleResult> call(Http.Context ctx) throws Throwable { Session session = ctx.session(); String sessionId = null; String tagrgetUrl = ctx.request().uri(); String absoluteTargetUrl = getAbsoluteUrl(tagrgetUrl, ctx); if(!SSOSessionStorageHelper.isSSOSessionExists(session)){ sessionId = SSOSessionStorageHelper.createSession(session); } else { sessionId = SSOSessionStorageHelper.getSessionId(session); } // Check whether user profile information there and initiate SSO process UserProfile userProfile = SSOSessionStorageHelper.getUserProfile(sessionId); if(userProfile == null){ return SAMLSSOManager.INSTANCE.buildAuthenticationRequest(ctx, absoluteTargetUrl); } return delegate.call(ctx); }
public F.Promise<SimpleResult> call(Http.Context ctx) throws Throwable { if(Play.isTest()){ return delegate.call(ctx) ; } Injector injector = Guice.createInjector(new UtilsModule()); SessionUtilsService sessionUtilsService = injector.getInstance(SessionUtilsService.class); if(sessionUtilsService.getSessionUserId() == null) { return F.Promise.pure( (SimpleResult) unauthorized(Messages.get("global.unauthorized")) ); } else { return delegate.call(ctx) ; } }
@Override public Promise<SimpleResult> call(Context context) throws Throwable { // TODO Auto-generated method stub String appId = context.session().get("appId"); //there is no application id if (appId == null) { SimpleResult result = ok(Json.newObject().put("code", ErrDefinition.E_APP_NOT_SELECTED)); return Promise.pure(result); } return delegate.call(context); }
@Override public Promise<SimpleResult> call(Context context) throws Throwable { // TODO Auto-generated method stub context = setRespHeader(context); addLogs(context); return delegate.call(context); }
@Override public F.Promise<SimpleResult> onHandlerNotFound(Http.RequestHeader requestHeader) { // This is here to make sure that the context is set, there is a test that asserts // that this is true Http.Context.current().session().put("onHandlerNotFound", "true"); return F.Promise.<SimpleResult>pure(Results.notFound()); }
@Override public Promise<SimpleResult> call(final Context ctx) throws Throwable { if (getUser(ctx) == null) { PlayAuthenticate.storeOriginalUrl(ctx); return pure(redirect(PlayAuthenticate.getResolver().login())); } return delegate.call(ctx); }
private static SimpleResult wrapScalaResult(scala.concurrent.Future<play.api.mvc.SimpleResult> result) { if (result == null) { return null; } else { final play.api.mvc.SimpleResult simpleResult = new P<play.api.mvc.SimpleResult>(result).get(); return new SimpleResult() { public play.api.mvc.SimpleResult getWrappedSimpleResult() { return simpleResult; } }; } }
public F.Promise<SimpleResult> call(Http.Context ctx) throws Throwable { String origin = System.getenv(EnvConfigService.PPRB_CORS_ACCESS_CONTROL_ALLOW_ORIGIN); ctx.response().setHeader("Access-Control-Allow-Origin", origin); ctx.response().setHeader("Access-Control-Allow-Credentials", "true"); ctx.response().setHeader("Access-Control-Expose-Headers","X-Total-Count"); // TODO update doc for CORS & related config return delegate.call(ctx) ; }
@Override public F.Promise<SimpleResult> call(Http.Context ctx) throws Throwable { RequestHeader request = ctx._requestHeader(); if (CSRFAction.getTokenFromHeader(request, tokenName, cookieName).isEmpty()) { // No token in header and we have to create one if not found, so create a new token String newToken = tokenProvider.generateToken(); // Place this token into the context ctx.args.put(requestTag, newToken); // Create a new Scala RequestHeader with the token final RequestHeader newRequest = request.copy(request.id(), request.tags().$plus(new Tuple2<String, String>(requestTag, newToken)), request.uri(), request.path(), request.method(), request.version(), request.queryString(), request.headers(), request.remoteAddress()); // Create a new context that will have the new RequestHeader. This ensures that the CSRF.getToken call // used in templates will find the token. Http.Context newCtx = new Http.WrappedContext(ctx) { @Override public RequestHeader _requestHeader() { return newRequest; } }; Http.Context.current.set(newCtx); // Also add it to the response if (cookieName.isDefined()) { Option<String> domain = Session.domain(); ctx.response().setCookie(cookieName.get(), newToken, null, Session.path(), domain.isDefined() ? domain.get() : null, secureCookie, false); } else { ctx.session().put(tokenName, newToken); } return delegate.call(newCtx); } else { return delegate.call(ctx); } }
@Override public Promise<SimpleResult> call(Context ctx) throws Throwable { state = "intercepted"; return delegate.call(ctx); }
@Override public Promise<SimpleResult> call(final Context ctx) throws Throwable { ctx.response().setHeader("Cache-Control", "max-age=0, must-revalidate"); return delegate.call(ctx); }
public F.Promise<SimpleResult> call(Http.Context ctx) throws Throwable { ctx.response().setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); return delegate.call(ctx) ; }