Customization of the logic of operations with data storages#
Customization principle#
Blitz Identity Provider allows you to customize the logic of operations with data storages. To do this, a Java class with a fixed name and the package com.identityblitz.idp.store.id.logic.dynamic is used.
There are eight custom procedures, one for each operation with a fixed class name:
searchUser—CustomSearchUsersLogic.javagetUser—CustomGetUserLogic.javafindUser—CustomFindUserLogic.javabindUser—CustomBindUserLogic.javachangeUserPassword—CustomChangeUserPasswordLogic.javaaddUser—CustomAddUserLogic.javaupdateUser—CustomUpdateUserLogic.javadeleteUser—CustomDeleteUserLogic.java
Configuration#
To configure custom logic for the required operations, follow these steps:
Place Java files with custom logic in a directory:
/usr/share/identityblitz/blitz-config/dynamic/idstore/<operation_name_in_lowercase>
For example, to enable custom logic for
searchUsersandbindUser, place the files CustomSearchUsersLogic.java` andCustomBindUserLogic.javato the directories/usr/share/identityblitz/blitz-config/dynamic/idstore/searchusersand/usr/share/identityblitz/blitz-config/dynamic/idstore/binduserrespectively.Open the configuration file
/usr/share/identityblitz/blitz-config/blitz.conf.sudo vim /usr/share/identityblitz/blitz-config/blitz.conf
Add a new
logicblock to theblitz.prod.local.idp.id-storesblock. The new block must contain the names of the customized operations specified as the key and the{ "enabled": true}section as the key value.Customization of searchUsers and bindUser operations#{ "logic": { "searchUsers": { "enabled": true }, "bindUser": { "enabled": true } } }
Writing a custom procedure#
Custom procedures for all operations have the same specification, but use their own context and utility functions. Each method in the procedures corresponds to a specific state of the operation execution process. In the methods, it is necessary to implement the logic of moving to the next cycle (followed by calling a new method) or completing the operation.
Each method in the procedure returns a pair of LoopOutput and OperationState. LoopOutput` can be:
terminal – completes the logical cycle of operation in one of the following ways:
error;
success (the result of success for a certain operation);
the final save operation (perform the save operation with some parameters and finish with the result).
task - more cycle iterations are required:
request to the repository to perform a specific operation;
request to an external web service.
At the moment, the mechanism of custom procedures is being beta tested. You can request a detailed Java specification and get advice on customization options in your environment from our technical specialists at support@idblitz.ru.