@Override
 public Promise<Result> call(final Http.Context ctx) throws Throwable {
   initEnv(env);
   return F.Promise.wrap(env.authenticatorService().fromRequest(ctx._requestHeader()))
       .flatMap(
           new F.Function<Option<Authenticator>, Promise<Result>>() {
             @Override
             public Promise<Result> apply(Option<Authenticator> authenticatorOption)
                 throws Throwable {
               if (authenticatorOption.isDefined() && authenticatorOption.get().isValid()) {
                 Authenticator authenticator = authenticatorOption.get();
                 return F.Promise.wrap(authenticator.touch())
                     .flatMap(
                         new F.Function<Authenticator, Promise<Result>>() {
                           @Override
                           public Promise<Result> apply(Authenticator touched) throws Throwable {
                             ctx.args.put(USER_KEY, touched.user());
                             return F.Promise.wrap(touched.touching(ctx))
                                 .flatMap(
                                     new F.Function<scala.runtime.BoxedUnit, Promise<Result>>() {
                                       @Override
                                       public Promise<Result> apply(scala.runtime.BoxedUnit unit)
                                           throws Throwable {
                                         return delegate.call(ctx);
                                       }
                                     });
                           }
                         });
               } else {
                 return delegate.call(ctx);
               }
             }
           });
 }
 @Override
 public Promise<Result> call(final Http.Context ctx) throws Throwable {
   initEnv(env);
   return F.Promise.wrap(env.authenticatorService().fromRequest(ctx._requestHeader()))
       .flatMap(
           new F.Function<Option<Authenticator>, Promise<Result>>() {
             @Override
             public Promise<Result> apply(Option<Authenticator> authenticatorOption)
                 throws Throwable {
               if (authenticatorOption.isDefined() && authenticatorOption.get().isValid()) {
                 final Authenticator authenticator = authenticatorOption.get();
                 Object user = authenticator.user();
                 Authorization authorization = configuration.authorization().newInstance();
                 if (authorization.isAuthorized(user, configuration.params())) {
                   return F.Promise.wrap(authenticator.touch())
                       .flatMap(
                           new F.Function<Authenticator, Promise<Result>>() {
                             @Override
                             public Promise<Result> apply(Authenticator touched)
                                 throws Throwable {
                               ctx.args.put(USER_KEY, touched.user());
                               return F.Promise.wrap(touched.touching(ctx))
                                   .flatMap(
                                       new F.Function<
                                           scala.runtime.BoxedUnit, Promise<Result>>() {
                                         @Override
                                         public Promise<Result> apply(
                                             scala.runtime.BoxedUnit unit) throws Throwable {
                                           return delegate.call(ctx);
                                         }
                                       });
                             }
                           });
                 } else {
                   return notAuthorizedResult(ctx);
                 }
               } else {
                 if (authenticatorOption.isDefined()) {
                   return F.Promise.wrap(authenticatorOption.get().discarding(ctx))
                       .flatMap(
                           new F.Function<Authenticator, Promise<Result>>() {
                             @Override
                             public Promise<Result> apply(Authenticator authenticator)
                                 throws Throwable {
                               return notAuthenticatedResult(ctx);
                             }
                           });
                 }
                 return notAuthenticatedResult(ctx);
               }
             }
           });
 }