{ "openapi": "3.1.0", "info": { "title": "LDAP service", "description": "The LDAP service", "version": "0.1.0" }, "paths": { "/auth": { "post": { "tags": [ "Auth" ], "summary": "Auth Post", "description": "Getting user list from LDAP to for syncing.", "operationId": "auth_post_auth_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthPostParams" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessSchema" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/connect": { "post": { "tags": [ "Connect" ], "summary": "Connect", "description": "Check connection to LDAP.", "operationId": "connect_connect_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConnectionPostParams" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConnectionPostResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/setting": { "get": { "tags": [ "Setting" ], "summary": "Setting Get", "description": "Get LDAP settings from DB.", "operationId": "setting_get_setting_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SettingGetResponse" } } } } } }, "post": { "tags": [ "Setting" ], "summary": "Setting Post", "description": "Save LDAP settings to DB.", "operationId": "setting_post_setting_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SettingPostParams" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessSchema" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "Setting" ], "summary": "Setting Delete", "description": "Delete LDAP settings from DB.", "operationId": "setting_delete_setting_delete", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessSchema" } } } } } } }, "/user/list": { "post": { "tags": [ "User" ], "summary": "User List", "description": "Getting user list from LDAP to for syncing.", "operationId": "user_list_user_list_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SettingPostParams" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": { "items": { "$ref": "#/components/schemas/SyncPostResponseOne" }, "type": "array" }, "type": "object", "title": "Response User List User List Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/user/sync": { "get": { "tags": [ "User" ], "summary": "User Sync Get", "description": "Getting user sync status.", "operationId": "user_sync_get_user_sync_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SyncStatusResponse" } } } } } }, "post": { "tags": [ "User" ], "summary": "User Sync Post", "description": "Syncing users from LDAP to platform.", "operationId": "user_sync_post_user_sync_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuditLogger" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessSchema" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "AuditLogger": { "properties": { "action_id": { "type": "integer", "title": "Action Id", "default": 0 }, "audit_log_fields": { "type": "object", "title": "Audit Log Fields", "default": {} } }, "type": "object", "title": "AuditLogger", "description": "Logger for security actions" }, "AuthPostParams": { "properties": { "email": { "type": "string", "title": "Email", "description": "User email", "examples": [ "test@example.com" ] }, "password": { "type": "string", "title": "Password", "description": "User password", "examples": [ "PasSwOrd" ] } }, "type": "object", "required": [ "email", "password" ], "title": "AuthPostParams", "description": "Auth post handler params" }, "ConnectionPostParams": { "properties": { "base_dn": { "type": "string", "title": "Base Dn", "description": "Base Distinguished Name - the search will be started from such catalog object", "examples": [ "dc=example,dc=com" ] }, "address": { "type": "string", "title": "Address", "description": "LDAP server address", "examples": [ "192.168.0.5" ] }, "bind_dn": { "type": "string", "title": "Bind Dn", "description": "The bind user DN with database read right", "examples": [ "cn=admin,dc=example,dc=com" ] }, "password": { "type": "string", "title": "Password", "description": "The bind user password", "examples": [ "PaSSwOrd" ] }, "users_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Users Dn", "description": "The part for searching users with base DN", "examples": [ "cn=users" ] }, "groups_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groups Dn", "description": "The part for searching groups with base DN", "examples": [ "cn=groups" ] }, "groupname_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groupname Attr", "description": "The name of group attribute for users searching", "examples": [ "memberOf" ] }, "email_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email Attr", "description": "The name of email attribute for users searching", "examples": [ "mail" ] }, "blocked_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Blocked Attr", "description": "The name of blocked attribute for users searching", "examples": [ "nsaccountlock" ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/LdapType" }, { "type": "null" } ], "description": "Type of LDAP server. If AD or FreeIPA some arguments could not be send, i.e. users DN", "default": "ldap", "examples": [ "ldap" ] }, "port": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Port", "description": "LDAP server port", "default": 389, "examples": [ 389 ] }, "is_ssl": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Ssl", "description": "LDAP ssl connection", "default": false, "examples": [ false ] } }, "type": "object", "required": [ "base_dn", "address", "bind_dn", "password" ], "title": "ConnectionPostParams", "description": "Connection post handler params" }, "ConnectionPostResponse": { "properties": { "groups": { "items": { "type": "string" }, "type": "array", "title": "Groups", "description": "List of groups found in LDAP", "examples": [ "cn=admins,cn=groups,dc=example,dc=com" ] } }, "type": "object", "required": [ "groups" ], "title": "ConnectionPostResponse", "description": "Connection post handler response" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "LdapType": { "type": "string", "enum": [ "ldap", "active_directory", "free_ipa", "ald_pro" ], "title": "LdapType", "description": "LDAP type." }, "SettingGetResponse": { "properties": { "groups_bind": { "anyOf": [ { "additionalProperties": { "items": { "type": "string" }, "type": "array" }, "type": "object" }, { "type": "null" } ], "title": "Groups Bind", "description": "List of bind groups in LDAP", "examples": [ "[\"cn=admins,cn=groups,dc=example,dc=com\"]" ] }, "auto_sync": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Auto Sync", "description": "The automatically syncing period. Use cron format or null", "examples": [ "0 16 * * *" ] }, "last_sync": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Last Sync", "description": "Last sync time", "examples": [ "2021-02-09T18:09:57" ] }, "base_dn": { "type": "string", "title": "Base Dn", "description": "Base Distinguished Name - the search will be started from such catalog object", "examples": [ "dc=example,dc=com" ] }, "address": { "type": "string", "title": "Address", "description": "LDAP server address", "examples": [ "192.168.0.5" ] }, "bind_dn": { "type": "string", "title": "Bind Dn", "description": "The bind user DN with database read right", "examples": [ "cn=admin,dc=example,dc=com" ] }, "password": { "type": "string", "title": "Password", "description": "The bind user password", "examples": [ "PaSSwOrd" ] }, "groups_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groups Dn", "description": "The part for searching groups with base DN", "examples": [ "cn=groups" ] }, "groupname_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groupname Attr", "description": "The name of group attribute for users searching", "examples": [ "memberOf" ] }, "email_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email Attr", "description": "The name of email attribute for users searching", "examples": [ "mail" ] }, "blocked_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Blocked Attr", "description": "The name of blocked attribute for users searching", "examples": [ "nsaccountlock" ] }, "users_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Users Dn", "description": "The part for searching users with base DN", "examples": [ "cn=users" ] }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Type", "description": "Type of LDAP server. If AD or FreeIPA some arguments could not be send, i.e. users DN", "examples": [ "ldap" ] }, "port": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Port", "description": "LDAP server port", "examples": [ 389 ] }, "is_ssl": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Ssl", "description": "LDAP ssl connection", "examples": [ false ] } }, "type": "object", "title": "SettingGetResponse", "description": "Settings handler response" }, "SettingPostParams": { "properties": { "base_dn": { "type": "string", "title": "Base Dn", "description": "Base Distinguished Name - the search will be started from such catalog object", "examples": [ "dc=example,dc=com" ] }, "address": { "type": "string", "title": "Address", "description": "LDAP server address", "examples": [ "192.168.0.5" ] }, "bind_dn": { "type": "string", "title": "Bind Dn", "description": "The bind user DN with database read right", "examples": [ "cn=admin,dc=example,dc=com" ] }, "password": { "type": "string", "title": "Password", "description": "The bind user password", "examples": [ "PaSSwOrd" ] }, "users_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Users Dn", "description": "The part for searching users with base DN", "examples": [ "cn=users" ] }, "groups_dn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groups Dn", "description": "The part for searching groups with base DN", "examples": [ "cn=groups" ] }, "groupname_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Groupname Attr", "description": "The name of group attribute for users searching", "examples": [ "memberOf" ] }, "email_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email Attr", "description": "The name of email attribute for users searching", "examples": [ "mail" ] }, "blocked_attr": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Blocked Attr", "description": "The name of blocked attribute for users searching", "examples": [ "nsaccountlock" ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/LdapType" }, { "type": "null" } ], "description": "Type of LDAP server. If AD or FreeIPA some arguments could not be send, i.e. users DN", "default": "ldap", "examples": [ "ldap" ] }, "port": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Port", "description": "LDAP server port", "default": 389, "examples": [ 389 ] }, "is_ssl": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Ssl", "description": "LDAP ssl connection", "default": false, "examples": [ false ] }, "groups_bind": { "anyOf": [ { "additionalProperties": { "items": { "type": "string" }, "type": "array" }, "type": "object" }, { "type": "null" } ], "title": "Groups Bind", "description": "List of bind groups in LDAP", "examples": [ "[\"cn=admins,cn=groups,dc=example,dc=com\"]" ] }, "auto_sync": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Auto Sync", "description": "The automatically syncing period. Use cron format or null", "examples": [ "0 16 * * *" ] } }, "type": "object", "required": [ "base_dn", "address", "bind_dn", "password" ], "title": "SettingPostParams", "description": "Settings post handler params" }, "SuccessSchema": { "properties": { "status": { "type": "string", "title": "Status", "description": "Success schema response", "default": "ok" } }, "type": "object", "title": "SuccessSchema", "description": "Success schema response" }, "SyncPostResponseOne": { "properties": { "id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Id", "description": "The user identifier in the platform. Null if new user", "examples": [ 1 ] }, "email": { "type": "string", "title": "Email", "description": "The user email", "examples": [ "test@example.com" ] }, "role": { "type": "string", "title": "Role", "description": "The user role in the platform", "examples": [ "@admin" ] }, "status": { "allOf": [ { "$ref": "#/components/schemas/UserStatus" } ], "description": "What's gone be done with user:\n * `new` - New user adding or user data changing\n * `removed` - The user was removed in LDAP and will be blocked at platform\n * `blocked` - The user was blocked in LDAP and will be blocked at platform\n * `unblocked` - The user was unblocked or created in LDAP and will be unblocked at platform\n ", "examples": [ "new" ] } }, "type": "object", "required": [ "email", "role", "status" ], "title": "SyncPostResponseOne", "description": "Sync post response one" }, "SyncStatusResponse": { "properties": { "is_running": { "type": "boolean", "title": "Is Running", "description": "Sync running status", "examples": [ true ] } }, "type": "object", "required": [ "is_running" ], "title": "SyncStatusResponse", "description": "Sync get response status" }, "UserStatus": { "type": "string", "enum": [ "new", "removed", "blocked", "unblocked" ], "title": "UserStatus", "description": "User status for syncing." }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } }, "tags": [ { "name": "ldap", "description": "handlers for ldap service" } ] }