Customizable user-facing pages
PingFederate supplies HTML templates, located in the <pf_install>/pingfederate/server/default/conf/template
directory, to provide information to the end-users or to request user input when processing their requests.
The PingFederate HTML templates use the Velocity template engine, an open-source Apache project. For more information about Velocity, please refer to the Velocity project documentation.
You can modify most of these pages in a text editor to suit the branding and informational needs for your PingFederate installation. CSS and images for these pages are included in the template/assets
subdirectory. Each page contains both Velocity constructs and standard HTML. The Velocity engine interprets the commands embedded in the template page before the HTML is rendered in the user’s browser. At runtime, PingFederate supplies values for the Velocity variables used in the template.
You can develop and deploy your own tools using the Velocity tools framework. You can find a full list of available tools in the Tools Usage Summary in the Apache Velocity documentation. |
Each template contains specific variables that can be used for rendering the associated web page. You can see the variables and usage examples in the comments of each template.
The following table describes variables that are available across all templates:
Variable | Description and Usage | ||
---|---|---|---|
utils- utility class |
The utility method to display JSON String arrays. |
||
$escape |
A utility class that can be used to escape String variables inserted into the template, such as Use
|
||
$HttpServletRequest |
A Java object instance of |
||
$HttpServletResponse |
A Java object instance of |
||
$locale |
A Java object instance of |
||
$CurrentPingFedBaseURL |
The host name found in the request, provided that it matches either the PingFederate’s base URL or one of the configured virtual host names. |
||
$PingFedBaseURL |
The PingFederate base URL. For most deployments, use the $CurrentPingFedBaseURLvariable instead of the $PingFedBaseURL variable. |
||
$templateMessages |
Used to localize messages in the template, based on user’s Locale, an instance of |
||
$TrackingId |
The user’s session tracking ID. |
The following describes variables that are available on some templates.
Variable | Description |
---|---|
$entityId |
The entity ID (connection ID) of the SP connection used in this SSO transaction. |
$connectionName |
The name of the SP Connection used in this SSO transaction. |
$client_id |
The ID of the OAuth client used in this transaction. |
$clientName |
The name of the OAuth client used in this transaction. |
$spAdapterId |
The SP Adapter ID used in this transaction. |
$baseUrl |
The base URL of PingFederate instance. |
$adapterId |
The IdP Adapter ID used in this transaction. |
$oidcUiLocales |
The value of the OpenID Connect |
$extendedProperties |
The extended properties defined on either the connection or OAuth client. |
$userAttributes |
The user’s display name, email address, and other user-specific data retrieved from the template type used in this transaction. The $userAttributes variable represents the attributes associated with a user’s identity and enables the retrieval of user-specific information across templates. In Local Identity Profile (LIP)-related templates, the attribute names of $userAttributes are derived from the data store mapping configured in Authentication → Policies → Local Identity Profiles → Data Store Configuration → Data Store Mapping. For example, userAttributes.email is an attribute in this context. In Adapter-related templates, the attribute names of $userAttributes are based on the configured contract in the LDAP-type password credential validator (PCV). For non-LDAP PCVs, the attribute names are derived from the implementation of the SDK method,
|
$grantAttributes |
The attributes of the grant used in this transaction. |
Changing Velocity or JavaScript code is not recommended. |
At runtime, the user’s browser is directed to the appropriate page, depending on the operation being performed and where the related condition occurs. For example, if a single sign-on (SSO) error occurs during identity provider (IdP)-initiated SSO, the user’s browser is directed to the IdP’s SSO error-handling page.
Applications can override the PingFederate server-hosted pages provided specifically for SSO and single logout (SLO) errors by specifying a URL value in the relevant application endpoint’s InErrorResource
parameter. Administrators can override SSO and SLO success pages by specifying default URLs on the SP Default URLs window (Applications → Integration → SP Default URLs) or the IdP Default URL window (Authentication → Integration → IdP Default URL).
The Velocity templates retrieve titles and other text from a message-property file, pingfederate-messages.properties
, located in the <pf_install>/pingfederate/server/default/conf/language-packs
directory. You can also localize these messages using the PingFederate localization framework.
If you have a clustered PingFederate environment, copy the customized and localized templates to each node. |
Strict content security policy for HTML templates
Content security policy (CSP) is a security feature that protects against XSS attacks by controlling what resources a web page can load. When creating customizable user-facing pages, ensure that your HTML templates follow a strict CSP to prevent the execution of any unsafe or unauthorized scripts and resources on the user’s browser. Learn more in Content Security Policy (CSP) in the Mozilla developer documentation.
PingFederate enforces a CSP on its HTML templates through the <meta>
HTML element. The CSP configured though this element varies depending on the template and the use cases it supports. You can modify the CSP to work with your template customizations and security requirements. The $CSPNonce
Velocity variable is available on all templates, and you can use this variable to allow inline scripts and styles by including the nonce in <script>
and <script>
HTML tags.