Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AuthService

A service that handles authenticating users. Discoverable as auth.

Hierarchy

  • AuthService

Implements

  • IService

Index

Constructors

constructor

Properties

logger

logger: Logger

The logger of the service.

server

server: Server

The server that this service belongs to.

stats

stats: StatsSink

Methods

addProvider

createOrUpdateUser

  • createOrUpdateUser(providerId: string, provider: string, isAdmin: boolean, metadata?: object, userId?: string): Promise<User>
  • Creates or updates a user into the data store.

    Parameters

    • providerId: string

      The Id from the provider (i.e. username, Google userId, etc).

    • provider: string

      The name of the auth provider (i.e. password, google, etc.).

    • isAdmin: boolean

      Indicates if the user is an admin (defaults to false).

    • Default value metadata: object = {}

      Key-value pairs of metadata associated with the user.

      • [key: string]: string
    • Optional userId: string

      The userId used by ROS. Will be randomly generated if not provided.

    Returns Promise<User>

getUserByProviderId

  • getUserByProviderId(provider: string, providerId: string): User
  • Gets a user instance by their provider Id.

    Parameters

    • provider: string

      The provider that this user authenticated with.

    • providerId: string

      The Id of the user in the provider's system.

    Returns User

setDefaultProviders

  • Specifies the default providers that will be created unless the runtime configuration API overrides them. This is incompatible with the manual configuration API (addProvider).

    Parameters

    • providers: IAuthProviderConfig[]

      The providers that will be added if no configuration changes have been made.

    Returns void