id: onelogin
name: OneLogin
version: 1.0.0
description: "OneLogin (API v1/v2) — identity containment: list and read users, lock a user, log a user out of all sessions, and read events. OAuth2 client-credentials authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: list/get users, lock user, logout user, list events."
category: identity

# Per-instance configuration. Client credentials are exchanged for a bearer token.
config_schema:
  properties:
    base_url:
      type: string
      description: "OneLogin API base URL (region-specific)"
      default: "https://api.us.onelogin.com"
    client_id:
      type: string
      description: "API client ID"
    client_secret:
      type: string
      description: "API client secret"
      x-soar-sensitive: true
  required:
    - client_id
    - client_secret

commands:
  - id: list_users
    name: onelogin-list-users
    description: "List users (optionally filter by email)."
    risk: read
    inputs_schema:
      properties:
        email: { type: string, description: "Optional email filter" }
        limit: { type: number, description: "Max users (default 50)" }
      required: []
    outputs_schema: { properties: {} }
  - id: get_user
    name: onelogin-get-user
    description: "Get a single user by ID."
    risk: read
    inputs_schema:
      properties:
        user_id: { type: string, description: "User ID" }
      required: [user_id]
    outputs_schema: { properties: {} }
  - id: lock_user
    name: onelogin-lock-user
    description: "Lock a user account (containment)."
    inputs_schema:
      properties:
        user_id: { type: string, description: "User ID" }
        locked_minutes: { type: number, description: "Lock duration in minutes (0 = indefinite, default 0)" }
      required: [user_id]
    outputs_schema: { properties: {} }
  - id: logout_user
    name: onelogin-logout-user
    description: "Log a user out of all active sessions."
    inputs_schema:
      properties:
        user_id: { type: string, description: "User ID" }
      required: [user_id]
    outputs_schema: { properties: {} }
  - id: list_events
    name: onelogin-list-events
    description: "List events (optionally filter by user)."
    risk: read
    inputs_schema:
      properties:
        user_id: { type: string, description: "Optional user ID filter" }
        event_type_id: { type: string, description: "Optional event type ID filter" }
      required: []
    outputs_schema: { properties: {} }

  - id: test_connection
    name: onelogin-test-connection
    description: "Verify the credentials via the token exchange (used by the Test button)."
    risk: read
    inputs_schema:
      properties: {}
      required: []
    outputs_schema: { properties: {} }
