in play-v30/src/main/scala/com/gu/googleauth/actions.scala [72:86]
override protected def refine[A](request: Request[A]): Future[Either[Result, AuthAction.UserIdentityRequest[A]]] =
Future.successful(
userIdentity(request)
.map(userID => new AuthenticatedRequest(userID, request))
.toRight(sendForAuth(request)(executionContext))
)
/**
* Helper method that deals with sending a client for authentication. Typically this should store the target URL and
* redirect to the loginTarget. There shouldn't really be any need to override this.
*/
def sendForAuth[A](request: RequestHeader)(implicit ec: ExecutionContext) =
Redirect(loginTarget).withSession {
request.session + (GoogleAuthFilters.LOGIN_ORIGIN_KEY, request.uri)
}