Naviga ID
Docs HomeInfomakerNaviga
  • Introduction
  • Release notes
  • Architecture
    • Authorization schema
  • Integrations
    • Customer Integration
      • Microsoft Azure
      • Google G Suite
      • Custom Identity Provider
      • Moving to a New Identity Provider
    • Service Integration
      • IMSG and headers
  • Services
    • Admin API
      • Routes
        • Health
        • Organizations
        • Permissions
        • Roles
        • Units
        • Services
        • Subjects
        • Organization applications
        • Internal applications
    • IMSG
      • Routes
        • Imsg-service
      • Environment variables
  • Shared modules
    • Http Test Server
      • HttpTestServer
    • Service Authorization Lib
      • Authorize
      • Errors
      • ExpressMiddleware
      • TokenUtils
      • Hapi plugin
      • ServiceAuthorizationError
      • AccessDenied
      • Unauthorized
      • ConfigError
  • Client Credentials
    • Managing Applications
    • Internal Naviga ID Docs
  • Access Token
    • Fetching and using Access Tokens
    • Validate Access Tokens
  • Local development
    • Local HTTPS support
  • Post Mortem
    • Broken backwards compatibility in access token service for client credentials, 20th Dec 2021
Powered by GitBook
On this page
  • Errors{#Errors}
  • ServiceAuthorizationError{#ServiceAuthorizationError}⇐ Error
  • hapiReply(replyOrResponseToolkit, [extraPublicData]) {#hapiReply}⇒ Object
  • AccessDenied{#AccessDenied}⇐ ServiceAuthorizationError
  • Unauthorized{#Unauthorized}⇐ ServiceAuthorizationError
  • ConfigError{#ConfigError}⇐ ServiceAuthorizationError

Was this helpful?

Export as PDF
  1. Shared modules
  2. Service Authorization Lib

Errors

Errors{#Errors}

ServiceAuthorizationError{#ServiceAuthorizationError}⇐ Error

ServiceAuthorizationError - extending the Error class.

Base class for each kind of errors in ServiceAuthorizationLib.

Extends: Error

new ServiceAuthorizationError(args)

Param
Type
Default
Description

args

Object

Required - The args object passed to the constructor

args.publicData

Object

Required - Data to show in the error

args.internalData

Object

Required - Private data that can be logged in the error

args.publicMessage

string

"An error occurred"

Error message to be shown

args.httpCode

number

500

Http status code for error

hapiReply(replyOrResponseToolkit, [extraPublicData]) {#hapiReply}⇒ Object

Reply function to respond with the error

Returns: Object - Response - Response object

Param
Type
Default
Description

replyOrResponseToolkit

Object

Required - Response toolkit - For example 'h' in Hapi, which handles the response

extraPublicData

Object

{}

Extra public data to shown in the error message

AccessDenied{#AccessDenied}⇐ ServiceAuthorizationError

AccessDenied Error - extending the ServiceAuthorizationError error class

PublicMessage is set to 'Access denied' and the HttpCode is set to '403'.

Thrown when a users credentials does not match the requested endpoints credentials.

Extends: ServiceAuthorizationError

new AccessDenied(publicData, internalData)

Param
Type
Description

publicData

Object

Required - Data to show in the error

internalData

Object

Required - Private data that can be logged in the error

Unauthorized{#Unauthorized}⇐ ServiceAuthorizationError

Unauthorized - extending the ServiceAuthorizationError error class

PublicMessage is set to 'Unauthorized' and the HttpCode is set to '401'.

Thrown when a user tries to request an endpoint with no access to it.

Extends: ServiceAuthorizationError

new Unauthorized(publicData, internalData)

Param
Type
Description

publicData

Object

Required - Data to show in the error

internalData

Object

Required - Private data that can be logged in the error

ConfigError{#ConfigError}⇐ ServiceAuthorizationError

ConfigError - extending the ServiceAuthorizationError error class

PublicMessage is set to 'Internal Server Error' and the HttpCode is set to '500'.

Thrown when building config variables while authorize.

Extends: ServiceAuthorizationError

new ConfigError(publicData, internalData)

Param
Type
Description

publicData

Object

Required - Data to show in the error

internalData

Object

Required - Private data that can be logged in the error

PreviousAuthorizeNextExpressMiddleware

Last updated 3 years ago

Was this helpful?