Management API - SSO
- 1 Introduction
- 2 Access to API
- 2.1 Scope of the API
- 3 URI format
- 4 Data types, attributes and linking
- 5 HTTP methods
- 6 Terminators
- 6.1 $link
- 6.2 $attribute
- 7 HTTP response status codes
- 8 Response messages
- 8.1 Example
- 9 HTTP methods
- 10 Create/Update objects
- 10.1 Site
- 10.2 Application
- 10.3 Group
- 10.4 Policy
- 10.5 PolicyItem
- 10.6 User
- 10.7 Mappings
- 10.8 Refresh token policy
- 11 Querying objects
- 12 Linking objects
- 12.1 Link types, linking and removing links
- 12.1.1 Site
- 12.1.2 Application
- 12.1.3 Group
- 12.1.4 Method
- 12.1.5 Server
- 12.1.6 Policy
- 12.1.7 Policyitem
- 12.1.8 Credential
- 12.1.9 Examples
- 12.1 Link types, linking and removing links
- 13 Deleting objects
- 14 Object request
- 15 Using Management API to manage keys
- 15.1 Create a new key or update an existing key
- 15.1.1 Path parameters
- 15.1.2 Query parameters
- 15.1.3 Responses
- 15.2 Retrieve a key
- 15.2.1 Path parameters
- 15.2.2 Responses
- 15.3 Delete a key
- 15.3.1 Path parameters
- 15.3.2 Responses
- 15.4 Create a new system-wide key association
- 15.4.1 Path parameters
- 15.4.2 Responses
- 15.5 Retrieve a key association
- 15.5.1 Path parameters
- 15.5.2 Responses
- 15.6 Remove an existing system-wide key association
- 15.6.1 Path parameters
- 15.6.2 Responses
- 15.7 Get certificate signing request
- 15.7.1 Path parameters
- 15.7.2 Responses
- 15.8 Store signed certificate
- 15.8.1 Path parameters
- 15.8.2 Request body
- 15.8.3 Responses
- 15.1 Create a new key or update an existing key
- 16 Example - SAML2 or OAuth2 integration
- 17 Example - Office365 Integration
Introduction
SSO Management API is a REST API for managing SSO Server. With Management API it is possible to automate management tasks that previously were only possible with the web browser based Management Console.
Access to API
To operate REST API an OAuth2 access token is needed. To get the access token an OAuth2 Resource Server configured as Ubisecure agent needs to be activated and configured in the Ubisecure SSO server.
SSO Management REST API calls need to have the access token in the bearer authorization header.
Authorization: Bearer {YOUR_SECURE_TOKEN}
Please check OAuth 2.0 API - SSO page for more information about OAuth API.
Please check SSO Management API Configuration Guide for information how to configure and start using SSO API.
Scope of the API
Ubisecure SSO REST API can be used to create:
Sites
Applications
Update application metadata
Groups
Authentication Policies
PolicyItem
Links between objects
Users
Mappings
Keys - see Using Management API to manage keys for API calls and SSO key rotation for further details
URI format
The URI format of Ubisecure SSO Management API is based on the following principles:
Path starts with object type
Example: /site
After object type, the path to the object
Example: /site/acmecorporation/
Example: /group/acmecorporation/users
Example: /application/acmecorporation/salesforce
Example: /policy/acmecorporation/policy
URI can contain a terminator ($link, $attribute) after the path to an object. This is described in more detail below in section Terminators.
Data types, attributes and linking
To get more information on how the attributes and linkings are connected, there are three sub-pages explaining them in more detail.
You can also see a overview of the schema in our example site https://manage.example.ubidemo.com/sso-api-sample/schema/models
HTTP methods
GET is used to query data.
POST writes a new object.
PUT writes object (update existing object)
DELETE is used to delete object or remove object linking.
Terminators
$link
Is used as part of the URI to link objects to other objects, and to list/query objects linked to other objects.
After $link the URI contains the path to another object as setter for the scope for the listing of related objects.
Section Response Messages describes in detail how links are used.
$attribute
Is used to query or update object attribute values. Version Ubisecure SSO 7.5.0 contains $attribute setting for application metadata – other $attribute settings will be available in future versions.
HTTP response status codes
Ubisecure SSO Management REST API uses following HTTP response status codes:
HTTP Response Status 200 (GET, DELETE)
Operation was successful. Returned when no error in GET, and after DELETE.
HTTP Response Status 201 (Create, Update) (POST, PUT)
Resource created or updated successfully.
HTTP Response Status 400 (Bad Request)
The request was invalid.
HTTP Response Status 401 (Not Authorized)
Invalid credentials
Response messages
Client can choose the result to be plain text, JSON or XML.This is set on the HTTP accept – header by setting the media type to Accept: text/plain; or Accept: application/json; or Accept: application/xml.
Example
POST /site/AcmeCorporation
type=site name=Sitetest
Response:
Plain text:
site /site/SiteTestJSON:
{"type":"site","id":"/site/SiteTest","attributes":{"name":"SiteTest"}}XML:
<object type="site" id="/site/SiteTest"><attribute name="name" value="SiteTest"/></object>
HTTP methods
GET
For successful GET operations the API returns HTTP status code 200. Response content contains object type, id (path) and attributes.
Format of query to Ubisecure SSO REST API is as described in the section URI Format. Section Response Messages describes in more detail the querying of object links.
Example GET-query and response
GET /site/System
Response JSON:
{"type":"site","id":"/site/System","attributes":{"name":"System","description":["Ubilogin System"]}}
Response XML:
<object type="site" id="/site/System"><attribute name="name" value="System"/><attribute name="description"><value>Ubilogin System</value></attribute></object>
POST
Used to create objects.
For successful operations the API returns HTTP status code 201. Response content contains object type, id (path) and attributes.
PUT operations can be used to update any data created with POST operation.
PUT
Used to create objects or links to other objects.
For successful operations the API returns HTTP status code 201.
Response content contains object type, id (path) and attributes.
PUT can be used to update data created using POST operation.
DELETE
Used to delete objects or remove a links.
The response is 200 (OK) when delete was successful.
Create/Update objects
If POSTing an object with same path twice the system will give an error as the object already exists. PUT can be used to update existing objects (parameters).
Site
Create site:
POST /site/{parent site path}
Form parameters example:type=site name=acmecorporation description=Acme corporation site mail=e@mail.com
Update site:
PUT /site/{site path}
Form parameters example:mail=e@mail.com
Application
Create application:
POST /site/{site path}
Form parameters example:name=Acme corporation application name enabled=true
By default enabled is false.
Update application:
PUT /site/{path to application}
Form parameters example:enabled=false
Group
Create Group:
POST /site/{site path}
Form parameters example:type=group name=Acme corporation group name
Description, condition and memberurl are optional parameters.
Update Group:
PUT /site/{path to group}
Form parameters example:memberurl=path to another group
Policy
Create Policy:
POST /site/{site path}
Form parameters example:type=policy name=Acme Corporation policy name
Description, required, singlevalue, configuration and platform are optional parameters.
Update Policy:
PUT /site/{path to policy}
Form parameters example:required=true
PolicyItem
Create/Update PolicyItem:
PUT /policyItem/{path to policyItem}
Form parameters are needed to create the policyitems:
User
Create User:
POST /site/Example
Form parameters example:type=username=user1mail=user1@example.comuid=user1enabled=true
Update User:
PUT /user/Example/user1
Form parameters example:mail=user1@example.com uid=user1enabled=true
Enable authentication method for a user:PUT /user/Example/user1/$link/method/password.1 enabled=true
NOTE: At this time it is not possible to manage credentials using management API. Use Password Reset, OTP Server, Customer ID or others to manage credentials.
Remove user
DELETE /user/Example/user1
Mappings
Please read page Management UI Mappings - SSO.
Three kind of mappings:
Type outbound user mapping
nameIDFormat = urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
Type persistent ID mapping
nameIDFormat = urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
Type transient ID mapping
nameIDFormat = urn:oasis:names:tc:SAML:2.0:nameid-format:transient
Policy function is defined with nameIDFormat attribute when policy is created.
NOTE: Policy function can not be changed after creation.
Create user mapping policy
PUT /outboundMappingPolicy/Example/userMappingPolicy1nameIDFormat=urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
Add user mapping
POST /outboundMappingPolicy/Example/userMappingPolicy1/$link/user/Example/user1 username=mapped-username
Enable outbound mapping policy for application
PUT /application/Example/webapp1/$link/outboundMappingPolicy/Example/userMappingPolicy1
Create persistent ID policy
PUT /outboundMappingPolicy/Example/persistentIDPolicy1nameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
Note! At most one outbound mapping policy is allowed per application
Refresh token policy
Create refresh token policy
PUT /refreshTokenPolicy/Example/refreshTokenPolicy1
Enable refresh token policy for application
PUT /application/Example/webapp1/$link/refreshTokenPolicy/Example/refreshTokenPolicy1
Querying objects
To get some object (and parameters) use Http GET method and give path to object as REST query path.
Examples:
GET /site/customer/acmecorporation GET /site/customer/acmecorporation/application1 GET /site/customer/acmecorporation/usergroup GET /site/customer/acmecorporation/samplepolicy GET /site/customer/acmecorporation/$link/managedBy
Linking objects
Link types, linking and removing links
Site
one – to set the scope for object list. Link type "one" lists objects only one level below the site (onelevel)
/site/{path to site}/$link/one
List objects one level under the object
/site/{path to site}/$link/one/{type}
List the object and all objects matching the "type" one level under site
sub – to set the scope for object list, containing object itself and all objects under site (subtree)
/site/{path to site}/$link/sub
List the object and all objects under it
/site/{path to site}/$link/sub/{object type}
List the object and all objects matching the "type" under site
Possible object types in subtree under site-object: site, application, group, user, policy, mapping, refreshtoken
managedBy – set, get or delete a link to the group(s) that can manage a site
GET /site/path to site}/$link/managedBy
List the groups that manage the site PUT /site/{path to site}/$link/managedBy/{path to group}
Set a group that manages the siteDELETE /site/{path to site}/$link/managedBy/{path to group}
Remove a link to a group that manages the site
Get,set and delete other objects linked to site:
Application
allowedTo. Set or get the group(s) that are allowed to an application
GET /application/{path to application}/$link/allowedTo
List group(s) that have access to this application
PUT /application/{path to application}/$link/allowedTo/{path to group}
Set a group that is allowed to this application
DELETE /application/{path to application}/$link/allowedTo/{path to group}
Remove a link to a group that is allowed to this application
Get and set other objects linked to application
GET /application/{path to application}/$link/methodPUT /application/{path to application}/$link/method/{path to method}
Form parameter "enabled" needs to be set "true" to have the method enabled for the application.
Group
AccessTo
To set, get or remove group's access to applications
GET /group/{path to group}/$link/accessTo
List applications that this group has access to
PUT /group/{path to group}/$link/accessTo/{path to application}
Set an application that this group has access to
DELETE /group/{path to group}/$link/accessTo/{path to application}
Remove a link to a application that this group has access to
Manages
To set, get and remove the sites that the group can manage
GET /group/{path to group}/$link/manages
List sites that this group can manage
PUT /group/{path to group}/$link/manages/{path to site}
Set a site that this group can manage
DELETE /group/{path to group}/$link/manages/{path to site}
Remove a link to a site that this group can manage
Member
To set, get or remove the group members
GET /group/{path to group}/$link/member
List group and users that this group can manage
PUT /group/{path to group}/$link/member/{path to group}
Set a group as a member of this group
DELETE /group/{path to group}/$link/member/{path to group}
Remove group's membership of group
memberOf
To set this group as a member to another, or get the groups that this is member of, or to remove group's membership of other group
GET /group/{path to group}/$link/memberOf
List groups that this group is member of
PUT /group/{path to group}/$link/memberOf/{path to group}
Set this group as a member of other group
DELETE /group/{path to group}/$link/memberOf/{path to group}
Remove this group from a membership of other group
Get, set and remove other objects linked to group
Method
Get and set other objects linked to method
Server
Get and set other objects linked to server
Policy
Get and set other objects linked to policy
Sites
GET /policy/{path to policy}/$link/site
Cannot be set using this URI
Policyitem
Get and set other objects linked to policyitem
Credential
Get and set other objects linked to credential
Examples
Link authentication method to the site
PUT /site/AcmeCorporation/SalesForce/$link/method/password.1
Link a group to the application (allowedTo-attribute)
PUT /application/AcmeCorporation/SalesForce/salesforcesso/$link/allowedTo/group/AcmeCorporation/SalesForce/users
Link a method to the application
PUT /application/AcmeCorporation/SalesForce/salesforcesso/$link/method/password.1
Link an authentication policy to application
PUT /application/AcmeCorporation/SalesForce/salesforcesso/$link/policy/AcmeCorporation/SalesForce/salesforcepolicy
Link a group to customerId group
PUT /group/AcmeCorporation/SalesForce/users/$link/member/eIDM Users/{path to CID group}
Update application metadata
PUT /application/{path to application}/$attribute/metadata xml or json (form parameter metadata) Agent metadata
This returns xml or json containing redirect url, client id and client secret. Note that client_id and client_secret can also be set in the metadata.
Update application metadata and keep client set credentials from query metadata
With application metadata attribute setting, note parameter policy: If policy has the value "keep_client_credentials" set then it keeps the client_id and secret from the query (if set in query). If policy has not been set, then SSO creates credentials (regardless of the client_id and secret in the query metadata). PUT /application/{path to application}/$attribute/metadata?policy=keep_client_credentials
Deleting objects
DELETE /{object type}/{path to object}
Deletes object from path. Does not check if child objects exist.
Object request
GET /{object type}/{path to object}
Return's the object, and parameters as described in section HTTP Methods.
Client can choose the result to be plain text, JSON or XML as described in section Terminators.
SSO Management API can be used to control signing and encryption keys used by Ubisecure SSO. A simple key rotation process can involve steps like
Create a new key which becomes valid at the same time with the current key (i.e. the key validity times overlap)
Associate the key to SSO server
When the old key has become invalid, remove the association from SSO server
Delete the old key
Create a new key or update an existing key
A new 2048 bit signing or encryption key can be created using the following endpoint. A successful operation creates a new key to the system but it is not yet in use. To take the key into active use (assuming it is enabled and within its validity window), one has to associate the key to a site.
If the system does not contain a key with the given name, one will be created.
PUT /credential/{site}/{name}
Path parameters
Parameter | Type | Required | Description |
|---|---|---|---|
| string | yes | The site where the key is stored. Server keys should be located in |
| string | yes | The name of the key. |
Query parameters
Content type: application/x-www-form-urlencoded
Parameter | Type | Required | Description |
|---|---|---|---|
| string | yes | The type of the key. For example |
| string | no | The key identifier as defined by RFC 7517 JSON Web Key specification. |
| boolean | no | Denotes whether the key is enabled or not. Defaults to |
| string | no | The usage of the key as defined by RFC 7517 JSON Web Key specification. Valid values are
If this parameter is not set the key can be used for both signing and encryption. |
| datetime | no | The date and time as specified by ISO 8601 after which the key is valid. If left out the key is valid immediately. When performing an update, leaving this field empty will clear any previously set date and time. |
| datetime |