Skip to content

Embedding#

Embedding shows published documents and portal templates of Empowerment Center inside another application, such as an intranet, an ERP or a customer portal, without the user having to sign in again. The application that frames the content is called the host application, and this page explains how to register and administer it.

Before you start#

  • You need System administration to administer host applications.
  • What is embedded has to be published in the portal: a published document or a template with its pages (see the portal in the user manual).
  • Each reader has to be an ECenter user. There are no anonymous guests.
  • Embedding comes enabled (ecenter.embedding.enabled: true). With false no tokens are issued and /embed/{key} cannot be framed.

How it works#

The principle is: the token names, the server decides and the token only takes away.

  1. The host application's server, with its credential with the Embedding scope, asks ECenter for a token for the user who has signed in to it. The token lives 5 minutes and works only once.
  2. The host page has an iframe with ECenter's /embed/{key} address. ECenter only lets it be framed by the origins registered in the application (Content-Security-Policy: frame-ancestors).
  3. The page gives the token to the iframe, which redeems it for an embedded session.
  4. The iframe shows the content with the identity of the named user: their universes and their column security, as in their session.

The token can add restrictions (a segmentation, preventing export…), but never give more than the user can see. How the host page and server are programmed is explained in Integrate the host application.

How an embedded document opens Embedding sequence: the host page loads the iframe and asks its server for a token, which the server gets from ECenter with the embedding credential; the iframe exchanges the token for an embedded session and opens the document with the user's identity. The credential only lives on the host server. loads /embed/{key} frame-ancestors = application origins ready asks for a token for its user POST /api/embed/v1/tokens (Embedding credential) token (5 min, single use) token postMessage token exchanges the token embedded session opens the document with the user's identity tokenRequired (on reaching the maximum; back to step 3) the credential only lives on the host server Host server Host page browser iframe /embed/{key} ECenter
How an embedded document opens Embedding sequence: the host page loads the iframe and asks its server for a token, which the server gets from ECenter with the embedding credential; the iframe exchanges the token for an embedded session and opens the document with the user's identity. The credential only lives on the host server. loads /embed/{key} frame-ancestors = application origins ready asks for a token for its user POST /api/embed/v1/tokens (Embedding credential) token (5 min, single use) token postMessage token exchanges the token embedded session opens the document with the user's identity tokenRequired (on reaching the maximum; back to step 3) the credential only lives on the host server Host server Host page browser iframe /embed/{key} ECenter
How an embedded document opens View full size View full size

Who can be a reader#

ECenter only issues a token for a user who meets all of this:

  • They are enabled.
  • They have one of the application's reader roles.
  • They have Portal access (or Portal administration).
  • They do not have System administration. No tokens are issued for whoever administers the system.
  • They can now read the requested content: the workbook and, in a template, the privilege of each page.

Readers are ECenter users and count towards the license's maximum number of users.

Register a host application#

  1. Go to Administration › Embedding.
  2. Click New host application.
  3. Fill in the dialog and click Create application.
Option What it is
Name The intranet, ERP or portal that embeds: “Sales intranet”. Up to 100 characters.
Key It goes in the iframe address: /embed/<key>. From 3 to 40 lowercase letters, digits or hyphens, without a hyphen at the beginning or the end. sdk and print are reserved. It is proposed from the name.
First origin The page that frames the content: https://host[:port], without a path.
Reader role Tokens are only issued for users with an allowed role. More can be added in the Users tab.

The application then opens on its page, with six tabs: General, Content, Users, Credentials, Sessions and Test. Changes in the first three are saved with Save changes; if you leave the page with unsaved changes, ECenter asks.

The list of host applications in Administration › Embedding with their statusThe list of host applications in Administration › Embedding with their status
The list of host applications in Administration › Embedding with their status

The list in Administration › Embedding shows for each application its Name (with its /embed/<key> address), Origins, Content, Credentials, Active sessions and Status: Enabled, Disabled or No active credential.

General#

The General tab of a host application with its origins and its policyThe General tab of a host application with its origins and its policy
The General tab of a host application with its origins and its policy
Option What it does
Name The application's name.
Key The key of the address. Copy the address copies the full iframe address. Changing the key changes the address the host uses.
Description Optional, up to 500 characters.
Enabled: it issues tokens and shows its content Disabled, no tokens are issued and its page shows nothing.
Origins From 1 to 10 origins that can frame the content (below).
Maximum session length (minutes) The longest an embedded session lasts; when it is reached, the iframe asks for another token. 0 is the installation's (8 hours by default).
Its tokens can allow exporting Unchecked, no token of the application can allow exporting.
Its tokens can allow choosing an earlier version Unchecked, only the most recent published version is seen.
Dynamic documents only Only dynamic documents are embedded. Frozen ones carry the data of whoever published them: all readers see the same figures.

Origins#

An origin is the scheme, host and port of the host page: https://intranet.example.com or https://erp.example.com:8443. Type it in Add an origin and click Add.

  • Only https://host[:port], without path, query or fragment. The trailing slash is removed.
  • No wildcards: one origin per host page.
  • No user or password in the address.
  • http only for localhost and only if the installation allows it (ecenter.embedding.allow-insecure-localhost, for development).

With these origins, ECenter calculates on each request the Content-Security-Policy: frame-ancestors header of /embed/<key>, which browsers apply to all the pages that frame it. A key that does not exist or a disabled application gives frame-ancestors 'none'. The rest of ECenter cannot be framed anywhere.

Important

If a proxy of your organization adds X-Frame-Options or its own Content-Security-Policy to all responses, the iframe will not be shown. What comes from the backend, and /embed/ in particular, has to pass through without added headers. The ECenter frontend image already does so (see the installation).

Content#

The Content tab is a tree with what can be embedded, only what is published:

  • Published workbooks, with their documents. Each document says whether it is Dynamic: each reader sees their own data or Frozen: all readers see the data of whoever published it.
  • Portal templates, with their pages. Checking the template allows all its pages; checking only some pages, only those. It warns of pages hidden in the tabs and of those with a read privilege.

Each token asks for a part of this, and the reader only sees what they can read at that moment. If something allowed stops being published, a strip warns of it and Remove them removes it from the content.

The Content tab with the tree of published workbooks and portal templatesThe Content tab with the tree of published workbooks and portal templates
The Content tab with the tree of published workbooks and portal templates

Users#

In Reader roles you choose one or several roles: tokens only name enabled users with one of them and Portal access. At least one role is mandatory. A role that includes System administration is marked, because its users cannot be readers.

Credentials#

The application's server requests the tokens with a credential with the Embedding scope tied to the application. Its holder is whoever creates it and needs System administration: if they lose it, the credential stops being valid.

  1. In the Credentials tab, click Create credential.
  2. In Expires, choose After one year (default), After 90 days or After 30 days.
  3. Click Create credential.
  4. Copy the secret with Copy and put it in the application's server, in the Authorization: Bearer header. It is the only time it is shown.
  5. Click Done.

The table shows for each credential its Holder, the secret's Hint, the Status, when it Expires and its Last used. Revoke… revokes it: the server can no longer request tokens with it and its open sessions are closed.

Warning

The secret of the embedding credential allows requesting a token for any reader user of the application. Keep it only in the host application's server, never in the page or in the browser.

Without an active credential, the application appears as No active credential and its server cannot request tokens. To rotate it without cutting the service, create the new one, change it in the server and revoke the previous one. The operations console warns of embedding credentials about to expire.

Sessions#

The Sessions tab lists the open embedded sessions: User, Origin, Start, Last activity and Ends at the latest. Those from Test carry the Preview mark.

  • Close closes one: the iframe stops showing the content and asks its application for another token.
  • Close all… closes all those of the application.
  • Refresh reads the list again.

A session ends by itself through inactivity (30 minutes by default) or on reaching its maximum length, and also if the credential is revoked, the application is deleted or the user is disabled or deleted.

Test#

The Test tab shows the content as a user would see it, without programming anything in the host. It tests what is saved: save the changes first.

  1. Search for the user in Search user and choose them in User.
  2. In What is embedded, choose a document or a template from the allowed content. With a template, choose the Start page.
  3. If you want, choose an Initial view: a public bookmark, or a private one of the user themselves.
  4. Check or uncheck With the header (title and version).
  5. Click Test.

Below appear This is how the user sees it, in an iframe, the Iframe messages the host would receive and, in For the host page, a sample HTML snippet with Copy the snippet.

The Test tab with the embedded content as comercial.norte sees it and the iframe messagesThe Test tab with the embedded content as comercial.norte sees it and the iframe messages
The Test tab with the embedded content as comercial.norte sees it and the iframe messages

If ECenter does not issue the token, a strip says why:

Message What to do
“The user is not enabled.” Enable them or choose another.
“The user has none of the application's roles (Users tab).” Add their role to Reader roles.
“The user does not have Portal access.” Give them a role with Portal access.
“No tokens are issued for users with System administration.” Test with a reader user.
“The content is not allowed or the user cannot see it (the workbook, the page or its privilege).” Review the Content tab and the privileges of the workbook or the page.
“The user cannot read that bookmark (someone else's private one) or it does not belong to this content.” Choose another initial view.
“The bookmark opens another version and the application does not allow choosing it (Policy).” Check Its tokens can allow choosing an earlier version or choose another bookmark.
“The application is disabled.” Enable it in General.
“A segmentation cannot be applied to a frozen document.” Use a dynamic document.
“Embedding is turned off in this installation.” Enable ecenter.embedding.enabled.

Delete an application#

Delete…, in the application's header, revokes its credentials and closes its sessions: its page stops showing the content. It cannot be undone.

Configuration#

Property Default What it is
ecenter.embedding.enabled true Enables embedding
ecenter.embedding.token-ttl 5m How long a token lives to be redeemed (at most 5 minutes)
ecenter.embedding.access-token-ttl 15m How long the session's bearer lives before being renewed
ecenter.embedding.idle-timeout 30m Inactivity that ends a session
ecenter.embedding.max-session-duration 8h Maximum session length (ceiling of each application's policy; at most 24 h)
ecenter.embedding.allow-insecure-localhost false Accept http://localhost origins (development only)
ecenter.embedding.issue-rate 600/min Tokens per application and instance; above it, 429 RATE_LIMITED
ecenter.embedding.retention 30d How long a finished session is kept
ecenter.embedding.index-location (ECENTER_EMBEDDING_INDEX_LOCATION) classpath:/static/index.html The frontend's index.html served at /embed/{key}

With several backend instances, the load balancer has to send an iframe's requests to the same instance by the X-ECenter-Embed-Session header (see the installation).

Audit and operations#

The audit records the changes to applications and their credentials, each token issued and rejected (with the user, the application, the content and the restrictions), each session and each document opened, with the EMBED channel. The operations console warns if someone tries to reuse a token, which is a sign of an attack: an already redeemed token closes the session it opened.

See also#