Template API

Template API can be used for fetching template specific resources, such as images and CSS stylesheets, from Ubisecure SSO. The resources are requested using URL built using following pattern:

/uas/template/<template>/<resource>[?locale=<locale>]

The requested template is specified in <template> and the resource in <resource>. There are five types of resources, CSS, logo, method images, resource.index ­­­­­­­­­­–resources and template-json, which are described below. For some of the resources there may exist different versions of the resource for different locales, in which case the locale may be defined in URL parameter locale. If the parameter is omitted, the default version of the resource is returned.

CSS

Returns the CSS stylesheet file defined in the css property of the requested template.
/uas/template/<template>/style.css

Returns the logo defined in the requested template. The preferred locale may be defined in URL parameter locale. For reference, see Login UI customization - SSO → Localizing logos.
/uas/template/<template>/logo.png?locale=<locale>

Method images

Returns the image defined for the method specified in <method> in the requested template. For reference, see document Login UI customization - SSO → Authentication method images - SSO.
/uas/template/<template>/method-image/<method>

Resources in resource.index file

Returns a resource defined in resource.index file. For reference, see page Login UI customization - SSO → Index files. Note that <resource-name> in the URL pattern below corresponds to <network alias> in the Login UI Customization pages.
/uas/template/<template>/resource/<resource-name>?locale=<locale>

Template-JSON

Returns the JSON–representation of the requested template. If the URL parameter callback is defined, the returned JSON–object will be wrapped inside the function call defined in <jsonp>.

/uas/template/<template>/json?locale=<locale>&callback=<jsonp>

Example request:

curl http://sso.example.org/uas/template/default/json?locale=en


Example response:

{
  "template": {
    "name": "default",
    "defaultLocale": "en",
    "locales": [
      "en",
      "fi"
    ],
    "settings": {
      "showlegal": true,
      "showintro": true,
      "showexit": true,
      "showlogin": true,
      "showlocales": true,
      "showhelp": true,
      "showlogo": true,
      "showmenustepup": false
    },
    "localeNames": {
      "fi": "Finnish",
      "en": "English"
    }
  },
  "locale": "fi"
}

Example request using callback parameter:

curl http://sso.example.org/uas/template/default/json?locale=en?callback=myFunction

Example response with callback function:

myFunction({"template":{"name":"default","defaultLocale":"en","locales":["en","fi"],"localeNames":{"fi":"Finnish","en":"English"}},"locale":"fi"});