OpenVeo Core server

API Docs for: 7.0.0
Show:

authenticator

Module: core

static

Summary

The authenticator helps manipulate users authenticated by passport strategies.

Users returned by passport are not necessary OpenVeo users. It could be users from a third party authentication server. The authenticator helps making sure that the authenticated user is a ready to use OpenVeo user.

Methods

deserializeUser

Syntax

deserializeUser

(
  • data
  • callback
)
static async

Summary

Fetches a user with its permissions from serialized data.

Parameters:

  • data String

    Serialized data as serialized by serializeUser(): the id of the user

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Object The user with its permissions

populateUser

Syntax

populateUser

(
  • user
  • callback
)
async

Summary

Populates user with detailed roles and permissions.

Parameters:

  • user Object

    The user to populate

    • [roles] Array optional

      The list of role ids

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Object The populated user

serializeUser

Syntax

serializeUser

(
  • user
  • callback
)
static async

Summary

Serializes only essential user information required to retrieve it later.

Parameters:

  • user Object

    The user to serialize

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • String The serialized user information

verifyUserAuthentication

Syntax

verifyUserAuthentication

(
  • thirdPartyUser
  • strategy
  • callback
)
static async

Summary

Verifies user as returned by third party providers.

OpenVeo trusts users from third party providers, if the user does not exist in OpenVeo it is created with minimum information.

Parameters:

  • thirdPartyUser Object

    The user from the third party provider

  • strategy String

    The id of the strategy

  • callback Function

    Function to call when its done

    • Error An error if something went wrong, null otherwise
    • Object The user with its permissions

verifyUserByCredentials

Syntax

verifyUserByCredentials

(
  • email
  • password
  • callback
)
static async

Summary

Verifies a user as returned by the passport local strategy.

Parameters:

  • email String

    User email

  • password String

    User password

  • callback Function

    Function to call when its done

    • Error An error if something went wrong, null otherwise
    • Object The user with its permissions