Compare commits

..

3 Commits

Author SHA1 Message Date
Guillaume BOURGEOIS 86fdd8483a feat(pingone): new PingOne identity-containment integration
PingOne Platform API, 6 commands: list/get users, enable/disable user, list
populations. OAuth2 client-credentials auth, stdlib-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 15:14:01 +02:00
Guillaume BOURGEOIS cd02c26b45 feat(jumpcloud): new JumpCloud identity integration
JumpCloud API v1, 6 commands: list/get users, suspend/activate user, list
systems. API-key auth, stdlib-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 15:14:01 +02:00
Guillaume BOURGEOIS ab68b3ae71 feat(onelogin): new OneLogin identity-containment integration
OneLogin API v1/v2, 6 commands: list/get users, lock user, logout user (revoke
sessions), list events. OAuth2 client-credentials auth, stdlib-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 15:14:00 +02:00
21 changed files with 1384 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
id: jumpcloud
name: JumpCloud
version: 1.0.0
description: "JumpCloud (API v1) — identity and device containment: list and read users, suspend/activate a user, and list systems (devices). API-key authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: list/get users, suspend/activate user, list systems."
category: identity
# Per-instance configuration. Auth header 'x-api-key: <api_key>'.
config_schema:
properties:
api_key:
type: string
description: "JumpCloud API key"
x-soar-sensitive: true
org_id:
type: string
description: "Organization ID (required for multi-tenant admins)"
required:
- api_key
commands:
- id: list_users
name: jumpcloud-list-users
description: "List users."
risk: read
inputs_schema:
properties:
search: { type: string, description: "Optional email/username search" }
limit: { type: number, description: "Max users (default 50)" }
required: []
outputs_schema: { properties: {} }
- id: get_user
name: jumpcloud-get-user
description: "Get a single user by ID."
risk: read
inputs_schema:
properties:
user_id: { type: string, description: "System user ID" }
required: [user_id]
outputs_schema: { properties: {} }
- id: suspend_user
name: jumpcloud-suspend-user
description: "Suspend a user (containment)."
inputs_schema:
properties:
user_id: { type: string, description: "System user ID" }
required: [user_id]
outputs_schema: { properties: {} }
- id: activate_user
name: jumpcloud-activate-user
description: "Un-suspend (activate) a user."
inputs_schema:
properties:
user_id: { type: string, description: "System user ID" }
required: [user_id]
outputs_schema: { properties: {} }
- id: list_systems
name: jumpcloud-list-systems
description: "List systems (managed devices)."
risk: read
inputs_schema:
properties:
limit: { type: number, description: "Max systems (default 50)" }
required: []
outputs_schema: { properties: {} }
- id: test_connection
name: jumpcloud-test-connection
description: "Verify the API key (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
@@ -0,0 +1,51 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
q = lambda v: urllib.parse.quote(str(v), safe="")
return request("PUT", "/systemusers/" + q(user_id), cfg, body={"suspended": False})
_run(main)
@@ -0,0 +1,51 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
q = lambda v: urllib.parse.quote(str(v), safe="")
return request("GET", "/systemusers/" + q(user_id), cfg)
_run(main)
@@ -0,0 +1,48 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
limit = inputs.get("limit")
return request("GET", "/systems", cfg, params={"limit": int(limit or 50)})
_run(main)
@@ -0,0 +1,49 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
search = inputs.get("search")
limit = inputs.get("limit")
return request("GET", "/systemusers", cfg, params={"search": search, "limit": int(limit or 50)})
_run(main)
@@ -0,0 +1,51 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
q = lambda v: urllib.parse.quote(str(v), safe="")
return request("PUT", "/systemusers/" + q(user_id), cfg, body={"suspended": True})
_run(main)
@@ -0,0 +1,48 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
BASE = "https://console.jumpcloud.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def request(method, path, cfg, body=None, params=None):
url = BASE + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"x-api-key": str(cfg.get("api_key", "")), "Accept": "application/json"}
if cfg.get("org_id"):
headers["x-org-id"] = str(cfg["org_id"])
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
print(json.dumps(fn(_cfg(), _inputs())))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, inputs):
request("GET", "/systemusers", cfg, params={"limit": 1})
return {"ok": True}
_run(main)
+81
View File
@@ -0,0 +1,81 @@
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: {} }
+68
View File
@@ -0,0 +1,68 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
q = lambda v: urllib.parse.quote(str(v), safe="")
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
return request("GET", "/api/2/users/" + q(user_id), cfg, token)
_run(main)
@@ -0,0 +1,66 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
user_id = inputs.get("user_id")
event_type_id = inputs.get("event_type_id")
return request("GET", "/api/1/events", cfg, token, params={"user_id": user_id, "event_type_id": event_type_id})
_run(main)
@@ -0,0 +1,66 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
email = inputs.get("email")
limit = inputs.get("limit")
return request("GET", "/api/2/users", cfg, token, params={"email": email, "limit": int(limit or 50)})
_run(main)
@@ -0,0 +1,70 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
q = lambda v: urllib.parse.quote(str(v), safe="")
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
locked_minutes = inputs.get("locked_minutes")
return request("POST", "/api/1/users/" + q(user_id) + "/lock_user", cfg, token,
body={"locked_until": int(locked_minutes or 0)})
_run(main)
@@ -0,0 +1,68 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
q = lambda v: urllib.parse.quote(str(v), safe="")
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
return request("PUT", "/api/1/users/" + q(user_id) + "/logout", cfg, token)
_run(main)
@@ -0,0 +1,65 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _base(cfg):
return (str(cfg.get("base_url") or "https://api.us.onelogin.com")).rstrip("/")
def _token(cfg):
body = json.dumps({"grant_type": "client_credentials"}).encode("utf-8")
auth = "client_id:" + str(cfg.get("client_id", "")) + ", client_secret:" + str(cfg.get("client_secret", ""))
req = urllib.request.Request(_base(cfg) + "/auth/oauth2/v2/token", data=body,
headers={"Authorization": auth, "Content-Type": "application/json",
"Accept": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
at = tok.get("access_token")
if not at:
raise Exception("Token request failed: " + json.dumps(tok))
return at
def request(method, path, cfg, token, body=None, params=None):
url = _base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
request("GET", "/api/2/users", cfg, token, params={"limit": 1})
return {"ok": True}
_run(main)
+87
View File
@@ -0,0 +1,87 @@
id: pingone
name: PingOne
version: 1.0.0
description: "Ping Identity PingOne (Platform API) — identity containment: list and read users, enable/disable a user, and list populations. OAuth2 client-credentials authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: list/get users, enable/disable user, list populations."
category: identity
# Per-instance configuration. Client credentials are exchanged for a token at the
# environment's token endpoint; environment_id scopes all API calls.
config_schema:
properties:
auth_url:
type: string
description: "PingOne auth base URL (region-specific)"
default: "https://auth.pingone.com"
api_url:
type: string
description: "PingOne API base URL (region-specific)"
default: "https://api.pingone.com"
environment_id:
type: string
description: "PingOne environment ID"
client_id:
type: string
description: "Worker application client ID"
client_secret:
type: string
description: "Worker application client secret"
x-soar-sensitive: true
required:
- environment_id
- client_id
- client_secret
commands:
- id: list_users
name: pingone-list-users
description: "List users (optionally filter by username or email)."
risk: read
inputs_schema:
properties:
filter: { type: string, description: "SCIM filter (e.g. username eq \"jdoe\")" }
limit: { type: number, description: "Max users (default 50)" }
required: []
outputs_schema: { properties: {} }
- id: get_user
name: pingone-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: disable_user
name: pingone-disable-user
description: "Disable a user account (containment)."
inputs_schema:
properties:
user_id: { type: string, description: "User ID" }
required: [user_id]
outputs_schema: { properties: {} }
- id: enable_user
name: pingone-enable-user
description: "Enable a user account."
inputs_schema:
properties:
user_id: { type: string, description: "User ID" }
required: [user_id]
outputs_schema: { properties: {} }
- id: list_populations
name: pingone-list-populations
description: "List populations."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
- id: test_connection
name: pingone-test-connection
description: "Verify the credentials via the token exchange (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
@@ -0,0 +1,76 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
q = lambda v: urllib.parse.quote(str(v), safe="")
def main(cfg, token, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
return request("PUT", "/users/" + q(user_id) + "/enabled", cfg, token, body={"enabled": False}, content_type="application/vnd.pingidentity.user.enabled+json")
_run(main)
@@ -0,0 +1,76 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
q = lambda v: urllib.parse.quote(str(v), safe="")
def main(cfg, token, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
return request("PUT", "/users/" + q(user_id) + "/enabled", cfg, token, body={"enabled": True}, content_type="application/vnd.pingidentity.user.enabled+json")
_run(main)
+76
View File
@@ -0,0 +1,76 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
q = lambda v: urllib.parse.quote(str(v), safe="")
def main(cfg, token, inputs):
user_id = inputs.get("user_id")
if not user_id:
raise Exception("user_id is required")
return request("GET", "/users/" + q(user_id), cfg, token)
_run(main)
@@ -0,0 +1,70 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
return request("GET", "/populations", cfg, token)
_run(main)
@@ -0,0 +1,72 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
filter_ = inputs.get("filter")
limit = inputs.get("limit")
return request("GET", "/users", cfg, token, params={"filter": filter_, "limit": int(limit or 50)})
_run(main)
@@ -0,0 +1,71 @@
import json, os, sys, base64, urllib.parse, urllib.request, urllib.error
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def _inputs():
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
def _auth_url(cfg):
return (str(cfg.get("auth_url") or "https://auth.pingone.com")).rstrip("/")
def _api_base(cfg):
return (str(cfg.get("api_url") or "https://api.pingone.com")).rstrip("/") + "/v1/environments/" + str(cfg.get("environment_id", ""))
def _token(cfg):
basic = base64.b64encode((str(cfg.get("client_id", "")) + ":" + str(cfg.get("client_secret", ""))).encode("utf-8")).decode("utf-8")
form = urllib.parse.urlencode({"grant_type": "client_credentials"}).encode("utf-8")
url = _auth_url(cfg) + "/" + str(cfg.get("environment_id", "")) + "/as/token"
req = urllib.request.Request(url, data=form, headers={
"Authorization": "Basic " + basic,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=60) as r:
tok = json.loads(r.read())
if not tok.get("access_token"):
raise Exception("Token request failed: " + json.dumps(tok))
return tok["access_token"]
def request(method, path, cfg, token, body=None, params=None, content_type="application/json"):
url = _api_base(cfg) + path
if params:
clean = {k: v for k, v in params.items() if v not in (None, "")}
if clean:
url += "?" + urllib.parse.urlencode(clean)
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Authorization": "Bearer " + token, "Accept": "application/json"}
if data is not None:
headers["Content-Type"] = content_type
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
def _run(fn):
try:
cfg = _cfg()
inputs = _inputs()
token = _token(cfg)
print(json.dumps(fn(cfg, token, inputs)))
except urllib.error.HTTPError as e:
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
def main(cfg, token, inputs):
request("GET", "/users", cfg, token, params={"limit": 1})
return {"ok": True}
_run(main)