The user's templates contain authentication information associated with users. Each template is linked to a user and to an authentication method. When users try to logon using a specific authentication method, the server finds the associated user template and provide authentication. Users cannot use authentication methods without associated user templates. The Enrollment process creates user templates, check the Working With Enrollment chapter for more information. Each authentication method stores different information in the templates. The Authentication method can update a user’s template in the authentication process, also users or administrator can change templates manually, a user can edit only his own templates.
The API provide resources for working with user’s templates: creating, updating, reading and deleting.
This resource provide reading user templates. Resource has URI:
/users/{user_id}/templates?login_session_id={login_session_id}
Resource provided by HTTP GET.
Table 3-43 URI parameters for get user’s template.
|
URI parameter name |
Description |
|---|---|
|
user_id |
User identifier, this identifier will be used for getting associated user templates. Administrator can use any user identifier, user should use only his own identifier. |
|
login_session_id |
Login session identifier, user’s login session identifier used for checking user access. User should be logged to “TemplatesManagement” for getting access to user template. |
Resource return list of user templates. List present as array of JSON object.
Table 3-44 JSON-object with user templates.
|
Parameter name |
Description |
|---|---|
|
templates |
This parameter is used for wrapping array of JSON object with user templates. |
|
id |
Identifier of user template. |
|
method_id |
Identifier of authentication method |
|
is_enrolled |
Boolean flag, when flag is true, then the template is enrolled and can be used for authentication, if flag is false, than the template is not enrolled and cannot be used for authentication. |
|
method_title |
Authentication method title |
|
comment |
Comment for user template |
On the following example a user with identifier “958ca11a7fa511e4b6ab00155d62a8b3” and session identifier “TBsifFiE4UJCyMnIyTkmY21kFctSxdwe” gets his own list of two user templates:
HTTP GET
https://authserver.example.com/api/v1/users/958ca11a7fa511e4b6ab00155d62a8b3/templates?login_session_id=TBsifFiE4UJCyMnIyTkmY21kFctSxdwe
Response
{
"templates":[
{
"id":"958ca11b7fa511e4a32200155d62a8b3",
"method_id":"LDAP_PASSWORD:1",
"is_enrolled":true,
"method_title":"LDAP password",
"comment": "LDAP password template"
},
{
"id":"959165a47fa511e4bd1500155d62a8b3",
"method_id":"HOTP:1",
"is_enrolled":true,
"method_title":"HOTP",
"comment": "OATH HTOP template"}
]
}
After a successful enroll process, you can assign enrolled data to the user template. This is provided by resource with URI:
/users/{user_id}/templates
Resource provided by HTTP POST and has this parameter:
Table 3-45 URI parameter for assigning enrolled data.
|
URI parameter name |
Description |
|---|---|
|
user_id |
User identifier, identifier user who will be assign to new template. |
An administrator can assign enrolled data and create user templates for any user.
Resource accept JSON-object with these parameters:
Table 3-46 Parameters for assigning enrolled data.
|
URI parameter |
Description |
|---|---|
|
enroll_process_id |
Enroll process identifier, identifier of success enroll process, method will use data from this enroll process. |
|
login_session_id |
Login session identifier, user should be logged to “TemplatesManagement” for creating user template. |
|
comment |
Comment for created user template. |
Resource return JSON-object with identifier of new user template.
Table 3-47 JSON-object for new user template.
|
Parameter name |
Description |
|---|---|
|
auth_t_id |
Authentication template identifier, identifier of created user template |
On the following example, a user with identifier “e08c6b48810611e4b79300155d62a8b3” and login session identifier “33ebFAQBW1e1kTkKVzIRz5rf5dhv4OoE” creates a user template with enroll process identifier “nrXwfyy0l4QcXxYZNebzjs33rqS9UkG5”.
HTTP POST
https://authserver.example.com/api/v1/users/e08c6b48810611e4b79300155d62a8b3/templates
Request
{
"enroll_process_id":"nrXwfyy0l4QcXxYZNebzjs33rqS9UkG5",
"comment":"Authentication template comment",
"login_session_id":"33ebFAQBW1e1kTkKVzIRz5rf5dhv4OoE"
}
Response
{
"auth_t_id":"9df84602842f11e4817e00155d62a8b3"
}
You can assign created user template to another user. This way a user can impersonate another user using his own authentication method. An example would be a user having 2 accounts, an admin account and a normal user account. He will only enroll authentication methods for his normal user account but will link his methods to his admin account. Now he can logon using the username of the admin account and the method of the normal account and this will be logged in the audit log.
Another use case would be group accounts where multiple users are linked too.
To link a template to another user use the resource with URI:
/users/{user_id}/templates
Resource provided by HTTP POST and has this parameter:
Table 3-48 URI parameter for assign user template to another user.
|
URI parameter name |
Description |
|---|---|
|
user_id |
User identifier, identifier user who will be assign to template. |
Resource accept JSON-object with these parameters:
Table 3-49 Parameters for assign user template to another user.
|
Parameter name |
Description |
|---|---|
|
auth_t_id |
Authentication user template identifier, identifier of user template which will be assign to another user. |
|
login_session_id |
Login session identifier, user should be logged to “TemplatesManagement” for creating user template. |
Resource return JSON-object with identifier of user’s template.
Table 3-50 JSON-object for assigned template.
|
Parameter name |
Description |
|---|---|
|
auth_t_id |
Authentication template identifier, identifier of user template |
This resource just links the user template to another user, new user can’t modify template, user can only read assigned template.
On the following example, user with login session “sC7PfOjvHt7OMgIccEHjK7b9XGlGNSoj” assign template with identifier “ba3cf01e845311e4841900155d62a8b3” to user with identifier “76cc2a62845411e4bd6c00155d62a8b3”.
HTTP POST
https://authserver.example.com/api/v1/users/76cc2a62845411e4bd6c00155d62a8b3/templates
Request
{
"auth_t_id":"ba3cf01e845311e4841900155d62a8b3",
"login_session_id":"sC7PfOjvHt7OMgIccEHjK7b9XGlGNSoj"}
Response
{ "auth_t_id":"ba3cf01e845311e4841900155d62a8b3" }
You can update existing user template, this is provided by resource with URI:
/users/{user_id}/templates/{auth_template_id}
Resource provided by HTTP PUT and has this parameter:
Table 3-51 URI parameter for updating user template.
|
URI parameter name |
Description |
|---|---|
|
user_id |
User identifier, identifier user which template will be update. |
|
auth_template_id |
Authentication template identifier, identifier of template which will be update. |
Administrator can update user template for all users, other users can update own templates.
Resource accept JSON-object with these parameters:
Table 3-52 Parameters for updating user template.
|
Parameter name |
Description |
|---|---|
|
enroll_process_id |
Enroll process identifier, identifier of success enroll process, method will use data from this enroll process for updating data in current user template. |
|
login_session_id |
Login session identifier, user should be logged to “TemplatesManagement” for changing user template. |
|
comment |
New comment for user template. |
You can use one or both parameters for method, if you use enroll process identifier for method you will change user’s template authentication data. When an template is updated all linked users will need to use the updated template
Resource does not return data, if operation was success method returns HTTP 200 status.
On the following example, user with identifier “e08c6b48810611e4b79300155d62a8b3” update user template with identifier “ba3cf01e845311e4841900155d62a8b3” with new enrolled data form enroll process with identifier “l4rh0HvzJxNFBaO9d7PC4Uyq9YRc8EMY”.
HTTP PUT
https://authserver.example.com/api/v1/users/e08c6b48810611e4b79300155d62a8b3/templates/ba3cf01e845311e4841900155d62a8b3
Request
{
"enroll_process_id":"l4rh0HvzJxNFBaO9d7PC4Uyq9YRc8EMY",
"comment":"Updated comment",
"login_session_id":"86oe9ebDvJ08UJvlG0O14ZARm3wIYNTB"
}
Response
HTTP 200
This resource provide deleting of user templates. Resource has URI
/users/{user_id}/templates/{template_id}?login_session_id={login_session_id}
Resource providing by HTTP DELETE and has this parameters:
Table 3-53 URI parameters for deleting user template.
|
URI parameter name |
Description |
|---|---|
|
user_id |
User identifier, identifier of user which template will be deleted. |
|
template_id |
Template identifier, identifier of template for deleting. |
|
login_session_id |
Login session identifier, user’s login session identifier used for checking user access. User should be logged to “TemplatesManagement” for getting access to user template deleting. |
Administrator can delete any user templates, other users can delete only their own templates.
This method doesn’t return any data, if deleting was successful method returns HTTP 200 status, if an error occurs, method returns error description.
On the following example, user with the user identifier “e08c6b48810611e4b79300155d62a8b3” and login session identifier “GsnGHDvqOiEdPR3KUhKqy2kZq7l4RCcC” tries to delete his own template with identifier “9df84602842f11e4817e00155d62a8b3”.
HTTP DELETE https://authserver.example.com/api/v1/users/e08c6b48810611e4b79300155d62a8b3/templates/9df84602842f11e4817e00155d62a8b3?login_session_id=GsnGHDvqOiEdPR3KUhKqy2kZq7l4RCcC Response HTTP 200