(view)
return validate_request_hmac('FORMPLAYER_INTERNAL_AUTH_KEY')(_inner)
Auth decorator for requests coming from Formplayer that are authenticated
    using the shared key.

    All requests with this decorator require the `as` param in order to simulate auth by that user.
    This is used by SMS forms.
Auth decorator for requests coming from Formplayer that are authenticated
    using the shared key.
Auth decorator for requests coming from Formplayer that are authenticated using the shared key .
def formplayer_as_user_auth(view):
    """Auth decorator for requests coming from Formplayer that are authenticated
    using the shared key.

    All requests with this decorator require the `as` param in order to simulate auth by that user.
    This is used by SMS forms.
    """

    @wraps(view)
    def _inner(request, *args, **kwargs):
        with mutable_querydict(request.GET):
            request_user = request.GET.pop('as', None)

        if not request_user:
            auth_logger.info(
                "Request rejected reason=%s request=%s",
                "formplayer_auth:user_required", request.path
            )
            return HttpResponse('User required', status=401)

        couch_user = CouchUser.get_by_username(request_user[-1])
        if not couch_user:
            auth_logger.info(
                "Request rejected reason=%s request=%s",
                "formplayer_auth:unknown_user", request.path
            )
            return HttpResponse('Unknown user', status=401)

        request.user = couch_user.get_django_user()
        request.couch_user = couch_user

        return view(request, *args, **kwargs)

    return validate_request_hmac('FORMPLAYER_INTERNAL_AUTH_KEY')(_inner)
def formplayer_as_user_auth ( view ) : @ wraps ( view ) def _inner ( request , * args , * * kwargs ) : with mutable_querydict ( request . GET ) : request_user = request . GET . pop ( 'as' , None ) if not request_user : auth_logger . info ( "Request rejected reason=%s request=%s" , "formplayer_auth:user_required" , request . path ) return HttpResponse ( 'User required' , status = 401 ) couch_user = CouchUser . get_by_username ( request_user [ - 1 ] ) if not couch_user : auth_logger . info ( "Request rejected reason=%s request=%s" , "formplayer_auth:unknown_user" , request . path ) return HttpResponse ( 'Unknown user' , status = 401 ) request . user = couch_user . get_django_user ( ) request . couch_user = couch_user return view ( request , * args , * * kwargs ) return validate_request_hmac ( 'FORMPLAYER_INTERNAL_AUTH_KEY' ) ( _inner )