{
    "$id": "http://glue42.com/gd/authController.json",
    "$schema": "http://json-schema.org/draft-06/schema#",
    "description": "Configuration settings for SSO, SSPI, Gateway or custom authentication mechanisms.",
    "title": "AuthController",
    "type": "object",
    "oneOf": [
        {
            "description": "Gateway authentication using the built-in io.Connect Gateway login screen.",
            "type": "object",
            "properties": {
                "authController": {
                    "description": "The authentication controller type.",
                    "type": "string",
                    "const": "gw"
                },
                "options": {
                    "description": "Optional settings for the gateway authentication dialog.",
                    "type": "object",
                    "properties": {
                        "theme": {
                            "description": "Visual theme for the gateway login dialog.",
                            "type": "string",
                            "enum": [
                                "black",
                                "white"
                            ]
                        },
                        "window": {
                            "description": "Settings for the login window.",
                            "type": "object",
                            "properties": {
                                "url": {
                                    "description": "Optional URL of a custom login page. The page must use `glue42basicAuth.send(\"login\", { username, password })` to submit credentials. If omitted, the built-in login page is used.\n\nThe auth window has a privileged preload script attached, so only trusted protocols are allowed: `file:`, `https:`, and `http:` for `localhost` / `127.0.0.1` / `[::1]` only. Any other scheme (`data:`, `javascript:`, custom schemes) or non-localhost `http:` URL is rejected at startup with a fatal error.",
                                    "type": "string"
                                },
                                "width": {
                                    "description": "Width in pixels for the login window.",
                                    "type": "integer"
                                },
                                "height": {
                                    "description": "Height in pixels for the login window.",
                                    "type": "integer"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "additionalProperties": false
                }
            },
            "additionalProperties": false,
            "required": [
                "authController"
            ]
        },
        {
            "description": "Single Sign-On (SSO) authentication using a custom or built-in login screen.",
            "type": "object",
            "properties": {
                "authController": {
                    "description": "The authentication controller type.",
                    "type": "string",
                    "const": "sso"
                },
                "options": {
                    "$ref": "#/definitions/ssoConfig"
                }
            },
            "additionalProperties": false,
            "required": [
                "authController"
            ]
        },
        {
            "description": "Custom authentication mechanism implemented by the user.",
            "type": "object",
            "properties": {
                "authController": {
                    "description": "The authentication controller type.",
                    "type": "string",
                    "const": "custom"
                },
                "options": {
                    "description": "Optional settings for custom authentication. The structure depends on your custom implementation.",
                    "type": "object",
                    "properties": {}
                }
            },
            "additionalProperties": false,
            "required": [
                "authController"
            ]
        },
        {
            "description": "Windows Security Support Provider Interface (SSPI) for integrated Windows authentication.",
            "type": "object",
            "properties": {
                "authController": {
                    "description": "The authentication controller type.",
                    "type": "string",
                    "const": "sspi"
                },
                "options": {
                    "description": "Optional settings for SSPI authentication.",
                    "type": "object",
                    "properties": {}
                }
            },
            "additionalProperties": false,
            "required": [
                "authController"
            ]
        }
    ],
    "definitions": {
        "ssoConfig": {
            "title": "SSOConfig",
            "description": "Configuration options for Single Sign-On (SSO) authentication.",
            "type": "object",
            "properties": {
                "url": {
                    "description": "Location of the login screen. If not provided, will default to the location of the built-in login screen of **io.Connect Desktop**.",
                    "type": "string"
                },
                "successUrl": {
                    "description": "URL to load after successful authentication.",
                    "type": "string"
                },
                "logoffUrl": {
                    "description": "URL to load after the user logs off.",
                    "type": "string"
                },
                "keepAlive": {
                    "description": "If `true`, **io.Connect Desktop** won't close the login window. This way, you can hide it yourself and use it to refresh the authentication parameters (user, token and headers) when necessary.",
                    "type": "boolean"
                },
                "window": {
                    "description": "Settings for the io.Connect Window in which the login screen will be loaded.",
                    "type": "object",
                    "properties": {
                        "width": {
                            "description": "Width in pixels for the login window.",
                            "type": "integer"
                        },
                        "height": {
                            "description": "Height in pixels for the login window.",
                            "type": "integer"
                        },
                        "mode": {
                            "description": "io.Connect Window mode.",
                            "type": "string",
                            "enum": [
                                "flat",
                                "tab",
                                "html",
                                "frameless"
                            ],
                            "default": "html"
                        },
                        "hidden": {
                            "description": "If `true`, the login window will be hidden.",
                            "type": "boolean"
                        }
                    },
                    "additionalProperties": false
                }
            },
            "additionalProperties": false
        }
    }
}