• Authenticate followerId validator

    Parameters

    • authSecrets: AuthSecrets

      authenticate secrets

    • authenticate: AuthenticationFunction

      authentication function

    • targetField: {
          followerId: TargetField;
          followerType: TargetField;
      }

      which field to get the followerId and followerType from context

      • followerId
      • followerType
      • followerId: TargetField
      • followerType: TargetField
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<StatusCodes>

    200 Status Ok

    Description

    This validator is used to authenticate followerId by applying the following steps in sequence:

    1. Authenticate the user token (authenticate)

    2. Get the followerId and followerType from the context

    3. Check if the followerType is user

    4. Check if the followerId is the same as the authenticated user id

    Throws

    401 NBError Unauthorized

    • error parsing user token
    • invalid user token type
    • invalid follower type

    Throws

    403 NBError Forbidden

    • follower is not the user

Generated using TypeDoc