{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "definitions": {
        "ACLConfiguration": {
            "properties": {
                "default_policy": {
                    "$ref": "#/definitions/ACLPolicy"
                },
                "rules": {
                    "items": {
                        "properties": {
                            "domain": {
                                "type": "string"
                            },
                            "networks": {
                                "items": {
                                    "type": "string"
                                },
                                "type": "array"
                            },
                            "policy": {
                                "$ref": "#/definitions/ACLPolicy"
                            },
                            "resources": {
                                "items": {
                                    "type": "string"
                                },
                                "type": "array"
                            },
                            "subject": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "domain",
                            "policy"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "ACLPolicy": {
            "enum": [
                "bypass",
                "deny",
                "one_factor",
                "two_factor"
            ],
            "type": "string"
        },
        "AuthenticationBackendConfiguration": {
            "properties": {
                "file": {
                    "$ref": "#/definitions/FileUsersDatabaseConfiguration"
                },
                "ldap": {
                    "$ref": "#/definitions/LdapConfiguration"
                }
            },
            "type": "object"
        },
        "DuoPushConfiguration": {
            "properties": {
                "hostname": {
                    "type": "string"
                },
                "integration_key": {
                    "type": "string"
                },
                "secret_key": {
                    "type": "string"
                }
            },
            "required": [
                "hostname",
                "integration_key",
                "secret_key"
            ],
            "type": "object"
        },
        "EmailNotifierConfiguration": {
            "properties": {
                "password": {
                    "type": "string"
                },
                "sender": {
                    "type": "string"
                },
                "service": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            },
            "required": [
                "password",
                "sender",
                "service",
                "username"
            ],
            "type": "object"
        },
        "FileSystemNotifierConfiguration": {
            "properties": {
                "filename": {
                    "type": "string"
                }
            },
            "required": [
                "filename"
            ],
            "type": "object"
        },
        "FileUsersDatabaseConfiguration": {
            "properties": {
                "path": {
                    "type": "string"
                }
            },
            "required": [
                "path"
            ],
            "type": "object"
        },
        "LdapConfiguration": {
            "properties": {
                "additional_groups_dn": {
                    "type": "string"
                },
                "additional_users_dn": {
                    "type": "string"
                },
                "base_dn": {
                    "type": "string"
                },
                "caCert": {
                    "type": "string"
                },
                "group_name_attribute": {
                    "type": "string"
                },
                "groups_filter": {
                    "type": "string"
                },
                "mail_attribute": {
                    "type": "string"
                },
                "password": {
                    "type": "string"
                },
                "reconnect": {
                    "type": "boolean"
                },
                "url": {
                    "type": "string"
                },
                "user": {
                    "type": "string"
                },
                "users_filter": {
                    "type": "string"
                }
            },
            "required": [
                "base_dn",
                "password",
                "url",
                "user"
            ],
            "type": "object"
        },
        "LocalStorageConfiguration": {
            "properties": {
                "in_memory": {
                    "type": "boolean"
                },
                "path": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "MongoStorageConfiguration": {
            "properties": {
                "auth": {
                    "properties": {
                        "password": {
                            "type": "string"
                        },
                        "username": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "password",
                        "username"
                    ],
                    "type": "object"
                },
                "database": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            },
            "required": [
                "database",
                "url"
            ],
            "type": "object"
        },
        "NotifierConfiguration": {
            "properties": {
                "email": {
                    "$ref": "#/definitions/EmailNotifierConfiguration"
                },
                "filesystem": {
                    "$ref": "#/definitions/FileSystemNotifierConfiguration"
                },
                "smtp": {
                    "$ref": "#/definitions/SmtpNotifierConfiguration"
                }
            },
            "type": "object"
        },
        "RegulationConfiguration": {
            "properties": {
                "ban_time": {
                    "type": "number"
                },
                "find_time": {
                    "type": "number"
                },
                "max_retries": {
                    "type": "number"
                }
            },
            "type": "object"
        },
        "SessionConfiguration": {
            "properties": {
                "domain": {
                    "type": "string"
                },
                "expiration": {
                    "type": "number"
                },
                "inactivity": {
                    "type": "number"
                },
                "name": {
                    "type": "string"
                },
                "redis": {
                    "$ref": "#/definitions/SessionRedisOptions"
                },
                "secret": {
                    "type": "string"
                }
            },
            "required": [
                "domain",
                "secret"
            ],
            "type": "object"
        },
        "SessionRedisOptions": {
            "properties": {
                "host": {
                    "type": "string"
                },
                "password": {
                    "type": "string"
                },
                "port": {
                    "type": "number"
                }
            },
            "required": [
                "host",
                "port"
            ],
            "type": "object"
        },
        "SmtpNotifierConfiguration": {
            "properties": {
                "host": {
                    "type": "string"
                },
                "password": {
                    "type": "string"
                },
                "port": {
                    "type": "number"
                },
                "secure": {
                    "type": "boolean"
                },
                "sender": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            },
            "required": [
                "host",
                "port",
                "secure",
                "sender"
            ],
            "type": "object"
        },
        "StorageConfiguration": {
            "properties": {
                "local": {
                    "$ref": "#/definitions/LocalStorageConfiguration"
                },
                "mongo": {
                    "$ref": "#/definitions/MongoStorageConfiguration"
                }
            },
            "type": "object"
        },
        "TotpConfiguration": {
            "properties": {
                "issuer": {
                    "type": "string"
                }
            },
            "required": [
                "issuer"
            ],
            "type": "object"
        }
    },
    "properties": {
        "access_control": {
            "$ref": "#/definitions/ACLConfiguration"
        },
        "authentication_backend": {
            "$ref": "#/definitions/AuthenticationBackendConfiguration"
        },
        "default_redirection_url": {
            "type": "string"
        },
        "duo_api": {
            "$ref": "#/definitions/DuoPushConfiguration"
        },
        "logs_level": {
            "type": "string"
        },
        "notifier": {
            "$ref": "#/definitions/NotifierConfiguration"
        },
        "port": {
            "type": "number"
        },
        "regulation": {
            "$ref": "#/definitions/RegulationConfiguration"
        },
        "session": {
            "$ref": "#/definitions/SessionConfiguration"
        },
        "storage": {
            "$ref": "#/definitions/StorageConfiguration"
        },
        "totp": {
            "$ref": "#/definitions/TotpConfiguration"
        }
    },
    "required": [
        "authentication_backend"
    ],
    "type": "object"
}

