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:

  • searchUserCustomSearchUsersLogic.java

  • getUserCustomGetUserLogic.java

  • findUserCustomFindUserLogic.java

  • bindUserCustomBindUserLogic.java

  • changeUserPasswordCustomChangeUserPasswordLogic.java

  • addUserCustomAddUserLogic.java

  • updateUserCustomUpdateUserLogic.java

  • deleteUserCustomDeleteUserLogic.java

Configuration#

To configure custom logic for the required operations, follow these steps:

  1. 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 searchUsers and bindUser, place the files CustomSearchUsersLogic.java` and CustomBindUserLogic.java to the directories /usr/share/identityblitz/blitz-config/dynamic/idstore/searchusers and /usr/share/identityblitz/blitz-config/dynamic/idstore/binduser respectively.

  2. Open the configuration file /usr/share/identityblitz/blitz-config/blitz.conf.

    sudo vim /usr/share/identityblitz/blitz-config/blitz.conf
    
  3. Add a new logic block to the blitz.prod.local.idp.id-stores configuration block. The 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:

  1. 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).

  2. 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.