• Validate followerId validator

    Parameters

    • authSecrets: AuthSecrets

      authentication secrets

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

      which field to get the followerId and followerType from context

      • 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 will authenticate the followerId by applying the following steps in sequence:

    1. Authenticate the user token

    2. Get followerId and followerType from context

    3. Check if the followerType is user

    4. Check if the followerId is the same as the userId in the user token

    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