cartes.gouv.fr-service
    Preparing search index...

    Classe ServiceBase

    Cette classe sert de base pour les services qui nécessitent une authentification utilisateur et une gestion de documents. Elle initialise le service avec des options telles que -le statut d'authentification, -les informations utilisateur, -les documents -et la gestion des erreurs.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • options: any

      Returns ServiceBase

      This class serves as a base for services that require user authentication and document management. It initializes the service with options such as authentication status, user information, documents, and error handling. It also sets the mode of operation (local or remote) and prepares the API URL. The class includes methods for managing user access, such as checking if access is valid, getting login/logout information, and retrieving access tokens.

    Properties

    settings: any
    authenticated: any

    authentification

    user: any

    user

    documents: any

    documents

    error: any

    erreurs IAM

    mode: any

    mode local ou remote on force toujours le mode d'authentification pour éviter les erreurs de configuration

    url: string
    api: any

    Methods

    • Get Fetch

      Returns any

      • fetch
    • Set Fetch

      Parameters

      • fetcher: any

        fetch instance to sets

      Returns void

    • Save the current service state to the store

      Returns void

      This method saves the current state of the service instance to the service store. It is typically called after any changes to the service's properties to ensure that the latest state is persisted.

      // Usage:
      const service = new ServiceBase();
      service.saveStore();
    • Throw an error

      Parameters

      • error: any

      Returns void

    • Check if the service is pending

      Returns boolean

      • true if pending, false otherwise
    • Stop the pending state

      Returns void

      This method sets the pending state of the service to false, indicating that the service is no longer in a pending state. It is typically called when an operation is completed or cancelled.

    • Get emitter instance used to dispatch global events.

      Returns any

    • Set emitter instance used to dispatch global events.

      Parameters

      • emitter: any

      Returns void

    • Verifie la session Keycloak en utilisant (iframe)

      • soit avec la librairie Keycloak (par défaut)
      • soit via la méthode oauth2

      Parameters

      • adapter: string

        oauth2 or keycloak

      Returns Promise<boolean>

      • true if session is active, false otherwise
    • Check if the access is valid

      Returns Promise<any>

      • Promise that resolves if access is valid, rejects otherwise
    • Get the access login

      Returns Promise<any>

      • Promise that resolves with the access login
    • Get the access logout

      Returns Promise<any>

      • Promise that resolves with the access logout
    • Get the access token

      Returns Promise<any>

      • Promise that resolves with the access token
    • Check if the authentificate is already done locally

      Returns boolean

      • True if authentificate
    • Check if the authentificate is really done

      Returns Promise<boolean>

      • True if authentificate