• Is user id same to request user validator

    Parameters

    • authSecrets: AuthSecrets

      authentication secrets

    • authenticate: AuthenticationFunction

      injected function use to authenticate the user token

    • targetField: TargetField

      target field to get the user id

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<number>

    200 Status OK

    Description

    This validator is used to check if the user id is same to request user id by applying the following steps in sequence:

    1. Get the userId from context

    2. Authenticate the request

    3. Check if the user id is same to request user id

    4. Return the status code

    Throws

    400 NBError Bad Request

    • cannot found parameter in ${targetField.type} ${targetField.name}

    Throws

    401 NBError Unauthorized

    • failed when authenticate

    Throws

    403 NBError Forbidden

    • user id is not same to request user id

Generated using TypeDoc