Skip to content

SSO IAuthentication

This document provides a comprehensive explanation of the methods defined in the IAuthentication interface. The interface facilitates user authentication, role and department management, and access control in a multi-departmental context.

setSource

Initializes the data source context for the current department and traceability.

Parameters:

  • ds: JDBC DataSource instance.
  • deptCode: Unique code representing the department.
  • traceid: Trace identifier for logging or transaction tracing.

getAllUsers

Fetches all users for a specific department.

Parameters:

  • deptCode: Department code.

  • data: Additional filtering or query parameters.

    Return:  [
        {
            "id": 1,
            "firstName": "Admin",
            "lastName": "",
            "userName": " Admin ",
            "status": "Active",
            "userType": "INT",
            "email": "admin@aivhub.com",
            "homeFolder": "/Admin",
            "backupUserId": "1",
            "managerUserId": null,
            "default_dashboard": null,
            "landing_page": "Documents/Reports",
            "locale": "en",
            "timezone": "SYSTEM",
            "theme": "Default",
            "notification": "0",
            "department": "Default",
            "showname": "1",
            "showimage": "1",
            "dashboardOption": "0",
            "alertsOption": "0",
            "reportOption": "1",
            "mergeReportOption": "0",
            "adhocOption": "2",
            "resourceOption": "0",
            "quickRunOption": "0",
            "mappingOption": "0",
            "messageOption": "0",
            "datasetOption": "0",
            "parameterOption": "0",
            "annotationOption": "0",
            "notificationOption": "2",
            "requestOption": "0",
            "adminOption": "1",
            "scheduleOption": "0",
            "webhookOption": "0"
    }] 

getAllRoles

Retrieves all roles available in the specified department.

Parameters:

  • deptCode: Department code.

  • data: Additional filtering or query parameters.

    Return:  [
        {
            "id": 1,
            "name": "Administrator",
            "email": "admin@activeintelligence.co.uk",
            "description": "Administrator Role",
            "dashboardOption": "2",
            "alertsOption": "2",
            "reportOption": "2",
            "mergeReportOption": "2",
            "adhocOption": "2",
            "resourceOption": "2",
            "quickRunOption": "2",
            "mappingOption": "2",
            "messageOption": "2",
            "datasetOption": "2",
            "parameterOption": "2",
            "annotationOption": "2",
            "notificationOption": "2",
            "requestOption": "2",
            "adminOption": "2",
            "scheduleOption": "2",
            "webhookOption": "0",
            "department": "Default"
    }] 

getAllDepartments

Returns a list of departments accessible to the current context or user.

Parameters:

  • deptCode: Department code.

  • data: Additional filtering or query parameters.

    Returns: [
        {
            "id": 1,
            "deptName": "Default",
            "deptCode": "Default",
            "userName": "admin@gmail.com"
    }]

authenticate

Performs user authentication.

Parameters:

  • data: Contains credentials like username and password.
  • Return: Return values should be {“userName”:”<username>”,”deptCode”:”<department>”}

embedAuthenticate

Authenticates a user using embedded link.

Parameters:

  • req: HTTP request object.
  • res: HTTP response object.
  • data: Embedded authentication payload.
  • Return: Return values should be {“userName”:”<username>”,”deptCode”:”<department>”}

isAuthorize

Checks whether the user is authorized based on provided headers.

Parameters:

  • headers: Usually contains tokens or credentials.
  • Returns: True/False

changePassword

Allows the user to change their password.

Parameters:

  • user: User identification map.
  • deptCode: Department code.
  • traceid: Trace ID for tracking.

selectUsersOfRole

Returns all users assigned to a specific role in a department.

Parameters:

  • role: Role name.

  • department: Department code.

    Return:  [
        {
            "id": 1,
            "firstName": "Admin",
            "lastName": "",
            "userName": " Admin ",
            "status": "Active",
            "userType": "INT",
            "email": "admin@aivhub.com",
            "homeFolder": "/Admin",
            "backupUserId": "1",
            "managerUserId": null,
            "default_dashboard": null,
            "landing_page": "Documents/Reports",
            "locale": "en",
            "timezone": "SYSTEM",
            "theme": "Default",
            "notification": "0",
            "department": "Default",
            "showname": "1",
            "showimage": "1",
            "dashboardOption": "0",
            "alertsOption": "0",
            "reportOption": "1",
            "mergeReportOption": "0",
            "adhocOption": "2",
            "resourceOption": "0",
            "quickRunOption": "0",
            "mappingOption": "0",
            "messageOption": "0",
            "datasetOption": "0",
            "parameterOption": "0",
            "annotationOption": "0",
            "notificationOption": "2",
            "requestOption": "0",
            "adminOption": "1",
            "scheduleOption": "0",
            "webhookOption": "0"
    }] 

selectRolesOfUser

Lists all roles assigned to a specific user in a department.

Parameters:

user: Username. department: Department code.

```
Return:  [
    {
        "id": 1,
        "name": "Administrator",
        "email": "admin@activeintelligence.co.uk",
        "description": "Administrator Role",
        "dashboardOption": "2",
        "alertsOption": "2",
        "reportOption": "2",
        "mergeReportOption": "2",
        "adhocOption": "2",
        "resourceOption": "2",
        "quickRunOption": "2",
        "mappingOption": "2",
        "messageOption": "2",
        "datasetOption": "2",
        "parameterOption": "2",
        "annotationOption": "2",
        "notificationOption": "2",
        "requestOption": "2",
        "adminOption": "2",
        "scheduleOption": "2",
        "webhookOption": "0",
        "department": "Default"
}] 
```

isRoleExists

Checks if a role with the given name exists in the department.

Parameters:

  • name: Role name.
  • deptCode: Department code.
  • Return: TRUE/FALSE

isUserExists

Checks if a user exists within the specified department.

Parameters:

  • name: Username.
  • deptCode: Department code.
  • Return: TRUE/FALSE

getUserByName

Retrieves detailed information for a user by username.

Parameters:

  • userName: Username.

  • deptCode: Department code.

  • data: Additional parameters.

    Returns:  
        {
            "id": 1,
            "firstName": "Admin",
            "lastName": "",
            "userName": " Admin ",
            "status": "Active",
            "userType": "INT",
            "email": "admin@aivhub.com",
            "homeFolder": "/Admin",
            "backupUserId": "1",
            "managerUserId": null,
            "default_dashboard": null,
            "landing_page": "Documents/Reports",
            "locale": "en",
            "timezone": "SYSTEM",
            "theme": "Default",
            "notification": "0",
            "department": "Default",
            "showname": "1",
            "showimage": "1",
            "dashboardOption": "0",
            "alertsOption": "0",
            "reportOption": "1",
            "mergeReportOption": "0",
            "adhocOption": "2",
            "resourceOption": "0",
            "quickRunOption": "0",
            "mappingOption": "0",
            "messageOption": "0",
            "datasetOption": "0",
            "parameterOption": "0",
            "annotationOption": "0",
            "notificationOption": "2",
            "requestOption": "0",
            "adminOption": "1",
            "scheduleOption": "0",
            "webhookOption": "0"
    } 

getRoleByName

Fetches detailed role data using role name and department code.

Parameters:

  • roleName: Role name.

  • deptCode: Department code.

  • data: Additional parameters.

    Returns: {
            "id": 1,
            "name": "Administrator",
            "email": "admin@activeintelligence.co.uk",
            "description": "Administrator Role",
            "dashboardOption": "2",
            "alertsOption": "2",
            "reportOption": "2",
            "mergeReportOption": "2",
            "adhocOption": "2",
            "resourceOption": "2",
            "quickRunOption": "2",
            "mappingOption": "2",
            "messageOption": "2",
            "datasetOption": "2",
            "parameterOption": "2",
            "annotationOption": "2",
            "notificationOption": "2",
            "requestOption": "2",
            "adminOption": "2",
            "scheduleOption": "2",
            "webhookOption": "0",
            "department": "Default"
    }

CreateEditUser

Creates a new user or updates an existing one.

Parameters:

  • data: User details.
  • deptCode: Department code.
  • Returns: return Id if user inserted/updated.

CreateEditRole

Creates or updates a role within the given department.

Parameters:

  • data: Role details.
  • deptCode: Department code.
  • Returns: return Id if role inserted/updated.

CreateEditDepartment

Adds or modifies a department’s data.

Parameters:

  • data: Department details.
  • deptCode: Department code.
  • Returns: return Id if role inserted/updated.

getAlldepartmentsWithAdmin

Returns departments managed or administered by a specific user.

Parameters:

  • owner: Admin or owner username.

  • deptCode: Department code.

    Returns: [
        {
            "id": 1,
            "deptName": "Default",
            "deptCode": "Default",
            "userName": "admin@gmail.com"
    }]

deleteDeptById

Deletes a department by ID with ownership validation.

Parameters:

  • owner: Admin username.
  • deptId: Department ID map.

deleteUserById

Deletes a user within a department based on ownership rights.

Parameters:

  • owner: Admin username.
  • deptCode: Department code.

deleteRoleById

Deletes a role from a department, if the owner has rights.

Parameters:

  • owner: Admin username.
  • deptCode: Department code.

getUserRoleFeatures

Returns all max Options based on users or assigned roles to that user.

Parameters:

  • userName: Username.

  • deptCode: Department code.

    Returns:  
        {
            "id": 1,
            "firstName": "Admin",
            "lastName": "",
            "userName": " Admin ",
            "status": "Active",
            "userType": "INT",
            "email": "admin@aivhub.com",
            "homeFolder": "/Admin",
            "backupUserId": "1",
            "managerUserId": null,
            "default_dashboard": null,
            "landing_page": "Documents/Reports",
            "locale": "en",
            "timezone": "SYSTEM",
            "theme": "Default",
            "notification": "0",
            "department": "Default",
            "showname": "1",
            "showimage": "1",
            "dashboardOption": "0",
            "alertsOption": "0",
            "reportOption": "1",
            "mergeReportOption": "0",
            "adhocOption": "2",
            "resourceOption": "0",
            "quickRunOption": "0",
            "mappingOption": "0",
            "messageOption": "0",
            "datasetOption": "0",
            "parameterOption": "0",
            "annotationOption": "0",
            "notificationOption": "2",
            "requestOption": "0",
            "adminOption": "1",
            "scheduleOption": "0",
            "webhookOption": "0"
    } 

updateRolesForUser

Updates the roles assigned to a user.

Parameters:

  • userRoleData: Role assignment data.
  • updatedBy: Modifier username.
  • deptCode: Department code.
  • traceid: Trace ID.

updateUsersForRole

Assigns or removes users from a given role.

Parameters:

  • userRoleData: User-role mapping.
  • updatedBy: Modifier username.
  • deptCode: Department code.
  • traceid: Trace ID.

deptExists

Checks if a department exists based on the department code.

Parameters:

  • deptCode: Department code.
  • traceid: Trace ID.
  • Returns: If dept exists

getAuthAfterTimeUser

Retrieves authentication information after authentication.

Parameters:

  • userName: Username.

  • dc: Department code.

  • traceid: Trace ID.

    Returns: [
        {
            "adhocOption": "2",
            "adminOption": "2",
            "alertsOption": "2",
            "annotationOption": "2",
            "backupFor": "",
            "backupUserId": "",
            "dashboardOption": "2",
            "datasetOption": "2",
            "default_dashboard": "571|:|ChartParams|:|Admin"/null,
            "department": "Default",
            "email": "admin@aivhub.com",
            "firstName": "Admin",
            "homeFolder": "/Admin",
            "landing_page": "Documents/Reports",
            "lastName": null,
            "locale": "en",
            "managerUserId": "0",
            "mappingOption": "2",
            "mergeReportOption": "2",
            "messageOption": "2",
            "notification": "0",
            "notificationOption": "2",
            "parameterOption": "2",
            "quickRunOption": "2",
            "reportOption": "2",
            "requestOption": "2",
            "resourceOption": "2",
            "scheduleOption": "2",
            "webhookOption": "2",
            "showimage": "1",
            "showname": "1",
            "status": "Active",
            "theme": null,
            "timezone": "SYSTEM",
            "userName": "Admin",
            "userType": "INT",
            "roles": "Administrator,Sales,Role1",
            "owner": "Admin",
            "dateFormat": "yyyy-MM-DD HH:mm:ss,yyyy-MM-DD",
            "dataLimit": 500,
            "sessionTimeout": 60,
            "help_baseurl": "http://www.aivhub.com/help/",
            "recordLimit": 500,
            "iacf": true,
            "ext": false,
            "serverTimezone": "Europe/London",
            "licenseMessage": ""
        }
    ]

generateEmbedToken

Generates an embed token embedding link.

Parameters:

  • data: Token request data.
  • deptCode: Department code.
  • traceid: Trace ID.
  • Returns: Not mandatory to implement just if you want additional security in your embed link.