Redirect on get,post to /auth/myprovider when ReturnTo get param is present

Hi,

I have a custom auth provider on which I would like to perform a redirect when a given query string parameter is present, and the user IS already authenticted.

Therer is a ReturnTo query string get param, which works fine when the user is not autenticated and peforms a valid auth - the user is sent to the ReturnTo url. However, if you perform subsequent requests to the auth route with the ReturnTo it’s just returning the authentication details.

Is it possible to override this behavior so that IF ReturnTo is present we just redirect, otherwise return the authentication details.

I have already tried with the pre-existing Continue param as documented here, however this does not seem to work.:

You should be able to use a Request Filter or provide a custom AuthenticateService.ValidateFn validation method, e.g:

AuthenticateService.ValidateFn = (svc, verb, dto) => 
  svc.Request.GetSession().IsAuthenticated && svc.Request.QueryString["ReturnTo"]!=null
      ? HttpResult.Redirect(svc.Request.QueryString["ReturnTo"])
      : null;

Thanks @mythz I’ll try that!