<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def login_required(self, f):
 """ Require a user to be validated by Identity to access an endpoint. :raises: FlaskKeystoneUnauthorized This method will gate a particular endpoint to only be accessed by :class:`FlaskKeystone.User`'s. This means that a valid token will need to be passed to grant access. If a User is not authenticated, a FlaskKeystoneUnauthorized will be thrown, resulting in a 401 response to the client. """

        @wraps(f)
        def wrapped_f(*args, **kwargs):
            if current_user.anonymous:
                msg = ("Rejected User '%s access to '%s' as user"
                       " could not be authenticated.")
                self.logger.warn(msg % (
                    current_user.user_id,
                    request.path
                ))
                raise FlaskKeystoneUnauthorized()
            return f(*args, **kwargs)
        return wrapped_f