File

src/core/services/smart-service-adapter.service.ts

Deprecated

Subscribing to the adapter directly is deprecated. Use stateSignal instead.

Description

A service used to initialize and manage the JSDO Session and to manage JSDO catalogs.

Subscribing directly to this service as an Observable is deprecated. Use stateSignal to reactively read the adapter state instead.

Extends

ReplaySubject

Index

Properties
Methods
Accessors

Constructor

constructor(smartConfig: SmartConfig, smartHttp: SmartHttpService, injector: Injector, logger: SmartLoggerService, authService: SmartAuthenticationService)
Parameters :
Name Type Optional
smartConfig SmartConfig No
smartHttp SmartHttpService No
injector Injector No
logger SmartLoggerService No
authService SmartAuthenticationService No

Methods

Public Async addCatalog
addCatalog(catalog: string)

Attempts to load the given JSDO catalog.

Parameters :
Name Type Optional Description
catalog string No
  • The name of the catalog to load.
Returns : Promise<void>

A promise that resolves to the catalog.

Public catalogLoaded
catalogLoaded(catalog: string)

Indicates whether a JSDO catalog with the given name has been loaded.

Parameters :
Name Type Optional Description
catalog string No
  • The name of the catalog to check.
Returns : boolean

True if the catalog has been loaded, false otherwise.

Public checkProductAccess
checkProductAccess(productCode?: string)

Checks if there is access to the specified product if the property is specified in the config.

Parameters :
Name Type Optional
productCode string Yes
Returns : Promise<literal type>
Public getAuthenticationStrategy
getAuthenticationStrategy()

Gets the active authentication strategy instance.

Public getCatalog
getCatalog(catalog: string)

Returns the JSDO catalog with the given catalog name, if it has been loaded.

Parameters :
Name Type Optional Description
catalog string No
  • The name of the catalog to get.
Returns : any

The catalog.

Public init
init()

Performs asynchronous initialization logic that was previously handled in the constructor. Uses a cached promise to ensure initialization only runs once, even if called multiple times.

Returns : Promise<void>

{Promise}

Public Async isAuthorized
isAuthorized()

Checks if the client has a valid session with the backend

Returns : Promise<boolean>

A promise that resolves to a boolean indicating if the user is authenticated.

Public login
login(credentials?: ISmartServiceCredentials)

Logs the user in using the given credentials, or the credentials specified in the app configuration if none are provided.

Parameters :
Name Type Optional Description
credentials ISmartServiceCredentials Yes
  • The credentials to use for the login.
Returns : Promise<any>

A promise that resolves to the JSDO session.

Public logout
logout(afterLogoutPage: string)

Logs the user out.

Parameters :
Name Type Optional Default value Description
afterLogoutPage string No 'login'
  • The page to navigate to after the user is logged out.
Returns : Promise<void>

A promise that resolves to void.

Public redirectToLoginForDifferentAccount
redirectToLoginForDifferentAccount()

Redirects the user into a switch-account login flow when supported by the active strategy.

Returns : Promise<void>
Public Async waitForAuthentication
waitForAuthentication()

Waits for authentication to complete before allowing the app to bootstrap. For token-based strategies (Keycloak, Entra ID), this blocks until the user is authenticated. For other strategies, it returns immediately after init.

Returns : Promise<void>

Properties

Public afterLogoutPage
Type : string
Public appRoutes
Type : Route[]

The application's routes

Public state
Type : SmartServiceAdapterState
Default value : { authenticated: false, jsdoSession: null, routesSet: true, catalogs: [], accessState: 'unknown', initFinished: false }

The current state of the Smart Service Adapter.

Public Readonly stateSignal
Type : Signal<SmartServiceAdapterState>
Default value : this._stateSignal.asReadonly()

Signal holding the current state of the Smart Service Adapter.

Accessors

usesBearerAuth
getusesBearerAuth()

Indicates whether the authentication strategy uses bearer tokens instead of cookies. Returns true for Keycloak and Entra ID authentication.

Returns : boolean
bearerExcludedUrls
getbearerExcludedUrls()

Gets the bearer excluded URLs from the authentication configuration.

Returns : unknown[]
authenticationStrategy
getauthenticationStrategy()

Exposes the current authentication strategy (e.g., 'hybridrealm', 'keycloak', 'entraid').

Returns : string | null
serviceURI
getserviceURI()

The serviceURI provided in the application's configuration

Returns : string
catalogURI
getcatalogURI()

The catalogURI or /web/Catalog if none was provided.

Returns : string
templateURI
gettemplateURI()

The templateURI or /web if none was provided.

Returns : string
imageURI
getimageURI()

the imageURI or /web/Image if none was provided.

Returns : string
smartRestURI
getsmartRestURI()

The smartRestURI or /web if none was provided.

Returns : string
jsdoSession
getjsdoSession()

Returns the current JSDO session from the authentication provider.

Returns : progress.data.JSDOSession

results matching ""

    No results matching ""