atlas-auth 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +132 -0
  4. data/lib/atlas/authorization.rb +78 -0
  5. data/lib/atlas/client.rb +124 -0
  6. data/lib/atlas/error.rb +92 -0
  7. data/lib/atlas/handshake.rb +241 -0
  8. data/lib/atlas/jwks_cache.rb +138 -0
  9. data/lib/atlas/pagination.rb +52 -0
  10. data/lib/atlas/resources/actions.rb +46 -0
  11. data/lib/atlas/resources/actor_tokens.rb +18 -0
  12. data/lib/atlas/resources/api_keys.rb +38 -0
  13. data/lib/atlas/resources/attack_protection.rb +18 -0
  14. data/lib/atlas/resources/audit_logs.rb +14 -0
  15. data/lib/atlas/resources/base.rb +32 -0
  16. data/lib/atlas/resources/billing.rb +35 -0
  17. data/lib/atlas/resources/bot_signals.rb +26 -0
  18. data/lib/atlas/resources/branding.rb +24 -0
  19. data/lib/atlas/resources/data_subject_requests.rb +28 -0
  20. data/lib/atlas/resources/domains.rb +26 -0
  21. data/lib/atlas/resources/email_templates.rb +29 -0
  22. data/lib/atlas/resources/fga.rb +146 -0
  23. data/lib/atlas/resources/import_export.rb +35 -0
  24. data/lib/atlas/resources/instance.rb +18 -0
  25. data/lib/atlas/resources/instance_security.rb +46 -0
  26. data/lib/atlas/resources/invitations.rb +22 -0
  27. data/lib/atlas/resources/jwt_templates.rb +32 -0
  28. data/lib/atlas/resources/localizations.rb +30 -0
  29. data/lib/atlas/resources/log_streams.rb +35 -0
  30. data/lib/atlas/resources/lti_platforms.rb +30 -0
  31. data/lib/atlas/resources/managed_waf.rb +35 -0
  32. data/lib/atlas/resources/messaging.rb +32 -0
  33. data/lib/atlas/resources/network_acls.rb +30 -0
  34. data/lib/atlas/resources/oauth_clients.rb +55 -0
  35. data/lib/atlas/resources/oauth_providers.rb +44 -0
  36. data/lib/atlas/resources/organizations.rb +140 -0
  37. data/lib/atlas/resources/radius_clients.rb +30 -0
  38. data/lib/atlas/resources/rate_limit.rb +18 -0
  39. data/lib/atlas/resources/resource_servers.rb +30 -0
  40. data/lib/atlas/resources/restrictions.rb +29 -0
  41. data/lib/atlas/resources/risk_based_mfa.rb +18 -0
  42. data/lib/atlas/resources/roles.rb +55 -0
  43. data/lib/atlas/resources/scim_provisioning.rb +46 -0
  44. data/lib/atlas/resources/scim_tokens.rb +23 -0
  45. data/lib/atlas/resources/sessions.rb +29 -0
  46. data/lib/atlas/resources/sign_in_tokens.rb +17 -0
  47. data/lib/atlas/resources/sms_templates.rb +37 -0
  48. data/lib/atlas/resources/sso_connections.rb +35 -0
  49. data/lib/atlas/resources/sso_onboarding.rb +37 -0
  50. data/lib/atlas/resources/tokens.rb +15 -0
  51. data/lib/atlas/resources/users.rb +121 -0
  52. data/lib/atlas/resources/waitlist.rb +19 -0
  53. data/lib/atlas/resources/webhooks.rb +35 -0
  54. data/lib/atlas/transport.rb +158 -0
  55. data/lib/atlas/verifier.rb +227 -0
  56. data/lib/atlas/version.rb +6 -0
  57. data/lib/atlas.rb +41 -0
  58. metadata +148 -0
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/oauth_providers+ — the social sign-in provider catalog + this
8
+ # instance's per-provider credentials and toggles.
9
+ class OAuthProviders < Base
10
+ # The whole catalog, configured or not.
11
+ def list
12
+ request(method: :get, path: "/v1/oauth_providers")
13
+ end
14
+
15
+ def get(provider)
16
+ request(method: :get, path: "/v1/oauth_providers/#{enc(provider)}")
17
+ end
18
+
19
+ # Set (or replace) this instance's own credentials for a provider.
20
+ def upsert(provider, body, idempotency_key: nil)
21
+ request(method: :put, path: "/v1/oauth_providers/#{enc(provider)}", body: body, idempotency_key: idempotency_key)
22
+ end
23
+
24
+ def delete(provider)
25
+ request(method: :delete, path: "/v1/oauth_providers/#{enc(provider)}")
26
+ end
27
+
28
+ # Turn a configured provider on or off.
29
+ def set_enabled(provider, enabled)
30
+ request(method: :post, path: "/v1/oauth_providers/#{enc(provider)}/enabled", body: { enabled: enabled })
31
+ end
32
+
33
+ # §6.5 which screens this provider serves. At least one must be true.
34
+ def set_scope(provider, body)
35
+ request(method: :post, path: "/v1/oauth_providers/#{enc(provider)}/scope", body: body)
36
+ end
37
+
38
+ # Verify the stored credentials against the provider's token endpoint.
39
+ def test(provider)
40
+ request(method: :post, path: "/v1/oauth_providers/#{enc(provider)}/test")
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/organizations+ — orgs plus their memberships, invitations, domains,
8
+ # hierarchy, policy, entitlements, and directory-group role grants.
9
+ class Organizations < Base
10
+ def list(params = {})
11
+ request(method: :get, path: "/v1/organizations", query: params)
12
+ end
13
+
14
+ def get(id)
15
+ request(method: :get, path: "/v1/organizations/#{enc(id)}")
16
+ end
17
+
18
+ def create(body, idempotency_key: nil)
19
+ request(method: :post, path: "/v1/organizations", body: body, idempotency_key: idempotency_key)
20
+ end
21
+
22
+ def update(id, body)
23
+ request(method: :patch, path: "/v1/organizations/#{enc(id)}", body: body)
24
+ end
25
+
26
+ def delete(id)
27
+ request(method: :delete, path: "/v1/organizations/#{enc(id)}")
28
+ end
29
+
30
+ # +PUT /v1/organizations/:id/metadata+ — replaces the named bags wholesale.
31
+ def update_metadata(id, body)
32
+ request(method: :put, path: "/v1/organizations/#{enc(id)}/metadata", body: body)
33
+ end
34
+
35
+ # +PATCH /v1/organizations/:id/policy+.
36
+ def update_policy(id, body)
37
+ request(method: :patch, path: "/v1/organizations/#{enc(id)}/policy", body: body)
38
+ end
39
+
40
+ # +PUT /v1/organizations/:id/parent+ — set (or clear, with nil) the parent.
41
+ def set_parent(id, body)
42
+ request(method: :put, path: "/v1/organizations/#{enc(id)}/parent", body: body)
43
+ end
44
+
45
+ # +GET /v1/organizations/:id/hierarchy+ — ancestor chain + direct children.
46
+ def hierarchy(id)
47
+ request(method: :get, path: "/v1/organizations/#{enc(id)}/hierarchy")
48
+ end
49
+
50
+ # +GET /v1/organizations/:id/entitlements+ — the org's active feature set.
51
+ def entitlements(id)
52
+ request(method: :get, path: "/v1/organizations/#{enc(id)}/entitlements")
53
+ end
54
+
55
+ # +organizations.memberships+ — members of an org.
56
+ def memberships
57
+ @memberships ||= Memberships.new(@transport)
58
+ end
59
+
60
+ # +organizations.invitations+ — pending org invitations.
61
+ def invitations
62
+ @invitations ||= Invitations.new(@transport)
63
+ end
64
+
65
+ # +organizations.domains+ — verified email domains for an org.
66
+ def domains
67
+ @domains ||= Domains.new(@transport)
68
+ end
69
+
70
+ # +organizations.group_roles+ — directory-group → role grants.
71
+ def group_roles
72
+ @group_roles ||= GroupRoles.new(@transport)
73
+ end
74
+
75
+ # Nested: memberships.
76
+ class Memberships < Base
77
+ def list(org_id)
78
+ request(method: :get, path: "/v1/organizations/#{enc(org_id)}/memberships")
79
+ end
80
+
81
+ def add(org_id, body, idempotency_key: nil)
82
+ request(method: :post, path: "/v1/organizations/#{enc(org_id)}/memberships", body: body, idempotency_key: idempotency_key)
83
+ end
84
+
85
+ def update(org_id, user_id, body)
86
+ request(method: :patch, path: "/v1/organizations/#{enc(org_id)}/memberships/#{enc(user_id)}", body: body)
87
+ end
88
+
89
+ def remove(org_id, user_id)
90
+ request(method: :delete, path: "/v1/organizations/#{enc(org_id)}/memberships/#{enc(user_id)}")
91
+ end
92
+ end
93
+
94
+ # Nested: invitations.
95
+ class Invitations < Base
96
+ def list(org_id)
97
+ request(method: :get, path: "/v1/organizations/#{enc(org_id)}/invitations")
98
+ end
99
+
100
+ def create(org_id, body, idempotency_key: nil)
101
+ request(method: :post, path: "/v1/organizations/#{enc(org_id)}/invitations", body: body, idempotency_key: idempotency_key)
102
+ end
103
+
104
+ def revoke(org_id, invitation_id)
105
+ request(method: :post, path: "/v1/organizations/#{enc(org_id)}/invitations/#{enc(invitation_id)}/revoke")
106
+ end
107
+ end
108
+
109
+ # Nested: domains.
110
+ class Domains < Base
111
+ def list(org_id)
112
+ request(method: :get, path: "/v1/organizations/#{enc(org_id)}/domains")
113
+ end
114
+
115
+ def create(org_id, body, idempotency_key: nil)
116
+ request(method: :post, path: "/v1/organizations/#{enc(org_id)}/domains", body: body, idempotency_key: idempotency_key)
117
+ end
118
+
119
+ def verify(org_id, domain_id)
120
+ request(method: :post, path: "/v1/organizations/#{enc(org_id)}/domains/#{enc(domain_id)}/verify")
121
+ end
122
+
123
+ def delete(org_id, domain_id)
124
+ request(method: :delete, path: "/v1/organizations/#{enc(org_id)}/domains/#{enc(domain_id)}")
125
+ end
126
+ end
127
+
128
+ # Nested: directory-group role grants.
129
+ class GroupRoles < Base
130
+ def grant(org_id, group_id, role_id)
131
+ request(method: :put, path: "/v1/organizations/#{enc(org_id)}/groups/#{enc(group_id)}/roles/#{enc(role_id)}")
132
+ end
133
+
134
+ def revoke(org_id, group_id, role_id)
135
+ request(method: :delete, path: "/v1/organizations/#{enc(org_id)}/groups/#{enc(group_id)}/roles/#{enc(role_id)}")
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/radius_clients+ — RADIUS NAS clients allowed to authenticate users.
8
+ class RadiusClients < Base
9
+ def list
10
+ request(method: :get, path: "/v1/radius_clients")
11
+ end
12
+
13
+ def create(body, idempotency_key: nil)
14
+ request(method: :post, path: "/v1/radius_clients", body: body, idempotency_key: idempotency_key)
15
+ end
16
+
17
+ def get(id)
18
+ request(method: :get, path: "/v1/radius_clients/#{enc(id)}")
19
+ end
20
+
21
+ def update(id, body)
22
+ request(method: :patch, path: "/v1/radius_clients/#{enc(id)}", body: body)
23
+ end
24
+
25
+ def delete(id)
26
+ request(method: :delete, path: "/v1/radius_clients/#{enc(id)}")
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/rate_limit_policy+ — the two tunable budgets over the built-in limiter.
8
+ class RateLimitPolicy < Base
9
+ def get
10
+ request(method: :get, path: "/v1/rate_limit_policy")
11
+ end
12
+
13
+ def update(body)
14
+ request(method: :patch, path: "/v1/rate_limit_policy", body: body)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/resource_servers+ — API audiences and the scopes they define.
8
+ class ResourceServers < Base
9
+ def list
10
+ request(method: :get, path: "/v1/resource_servers")
11
+ end
12
+
13
+ def get(id)
14
+ request(method: :get, path: "/v1/resource_servers/#{enc(id)}")
15
+ end
16
+
17
+ def create(body)
18
+ request(method: :post, path: "/v1/resource_servers", body: body)
19
+ end
20
+
21
+ def update(id, body)
22
+ request(method: :patch, path: "/v1/resource_servers/#{enc(id)}", body: body)
23
+ end
24
+
25
+ def delete(id)
26
+ request(method: :delete, path: "/v1/resource_servers/#{enc(id)}")
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # Allowlist and blocklist share an identical route shape, so they share a
8
+ # class; only the base path differs. Exposed on the client as
9
+ # +client.allowlist+ and +client.blocklist+.
10
+ class Restriction < Base
11
+ def initialize(transport, path)
12
+ super(transport)
13
+ @path = path
14
+ end
15
+
16
+ def list
17
+ request(method: :get, path: @path)
18
+ end
19
+
20
+ def add(identifier)
21
+ request(method: :post, path: @path, body: { identifier: identifier })
22
+ end
23
+
24
+ def remove(id)
25
+ request(method: :delete, path: "#{@path}/#{enc(id)}")
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/risk_based_mfa+ — the adaptive / risk-based MFA engine config.
8
+ class RiskBasedMfa < Base
9
+ def get
10
+ request(method: :get, path: "/v1/risk_based_mfa")
11
+ end
12
+
13
+ def update(body)
14
+ request(method: :patch, path: "/v1/risk_based_mfa", body: body)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/roles+ — instance roles and their permission sets.
8
+ class Roles < Base
9
+ def list
10
+ request(method: :get, path: "/v1/roles")
11
+ end
12
+
13
+ def create(body, idempotency_key: nil)
14
+ request(method: :post, path: "/v1/roles", body: body, idempotency_key: idempotency_key)
15
+ end
16
+
17
+ def update(id, body)
18
+ request(method: :patch, path: "/v1/roles/#{enc(id)}", body: body)
19
+ end
20
+
21
+ # Replace a role's permission set wholesale.
22
+ def set_permissions(id, permissions)
23
+ request(method: :put, path: "/v1/roles/#{enc(id)}/permissions", body: { permissions: permissions })
24
+ end
25
+
26
+ # Delete a role. Pass +reassign_to:+ to move every member onto another role
27
+ # first (atomic, before the delete) so an in-use role can be retired.
28
+ def delete(id, reassign_to: nil)
29
+ query = reassign_to ? { reassign_to: reassign_to } : nil
30
+ request(method: :delete, path: "/v1/roles/#{enc(id)}", query: query)
31
+ end
32
+ end
33
+
34
+ # +/v1/permissions+ — instance permissions.
35
+ class Permissions < Base
36
+ def list
37
+ request(method: :get, path: "/v1/permissions")
38
+ end
39
+
40
+ def create(body, idempotency_key: nil)
41
+ request(method: :post, path: "/v1/permissions", body: body, idempotency_key: idempotency_key)
42
+ end
43
+
44
+ # Relabel a custom permission (name/description only — the key is immutable).
45
+ def update(id, body)
46
+ request(method: :patch, path: "/v1/permissions/#{enc(id)}", body: body)
47
+ end
48
+
49
+ # Delete a custom permission. Fails with +role_in_use+ if a role grants it.
50
+ def delete(id)
51
+ request(method: :delete, path: "/v1/permissions/#{enc(id)}")
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/scim_provisioning_targets+ — OUTBOUND SCIM provisioning targets Atlas
8
+ # pushes users/groups to.
9
+ class ScimProvisioning < Base
10
+ def list
11
+ request(method: :get, path: "/v1/scim_provisioning_targets")
12
+ end
13
+
14
+ def get(id)
15
+ request(method: :get, path: "/v1/scim_provisioning_targets/#{enc(id)}")
16
+ end
17
+
18
+ def create(body, idempotency_key: nil)
19
+ request(method: :post, path: "/v1/scim_provisioning_targets", body: body, idempotency_key: idempotency_key)
20
+ end
21
+
22
+ def update(id, body)
23
+ request(method: :patch, path: "/v1/scim_provisioning_targets/#{enc(id)}", body: body)
24
+ end
25
+
26
+ def delete(id)
27
+ request(method: :delete, path: "/v1/scim_provisioning_targets/#{enc(id)}")
28
+ end
29
+
30
+ # Probe connectivity + auth to the downstream with the real bearer.
31
+ def test(id)
32
+ request(method: :post, path: "/v1/scim_provisioning_targets/#{enc(id)}/test")
33
+ end
34
+
35
+ # Force one user's sync now (backfill / re-push).
36
+ def sync_user(id, user_id)
37
+ request(method: :post, path: "/v1/scim_provisioning_targets/#{enc(id)}/sync_user", body: { user_id: user_id })
38
+ end
39
+
40
+ # Force one org's (group) sync now.
41
+ def sync_group(id, organization_id)
42
+ request(method: :post, path: "/v1/scim_provisioning_targets/#{enc(id)}/sync_group", body: { organization_id: organization_id })
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/scim_tokens+ — inbound SCIM bearer tokens for directory sync.
8
+ class ScimTokens < Base
9
+ def list
10
+ request(method: :get, path: "/v1/scim_tokens")
11
+ end
12
+
13
+ # Create reveals the usable secret exactly once.
14
+ def create(body, idempotency_key: nil)
15
+ request(method: :post, path: "/v1/scim_tokens", body: body, idempotency_key: idempotency_key)
16
+ end
17
+
18
+ def revoke(id)
19
+ request(method: :post, path: "/v1/scim_tokens/#{enc(id)}/revoke")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/sessions+ — mint, list, inspect, and revoke sessions.
8
+ class Sessions < Base
9
+ # +POST /v1/sessions+ — mint a session for a user without the sign-in flow.
10
+ # Returns the bearer jwt + refresh token in-body. Refused for a banned user.
11
+ def create(params)
12
+ request(method: :post, path: "/v1/sessions", body: params)
13
+ end
14
+
15
+ # +GET /v1/sessions?user_id=+ — requires a +user_id+.
16
+ def list(params)
17
+ request(method: :get, path: "/v1/sessions", query: params)
18
+ end
19
+
20
+ def get(id)
21
+ request(method: :get, path: "/v1/sessions/#{enc(id)}")
22
+ end
23
+
24
+ def revoke(id)
25
+ request(method: :post, path: "/v1/sessions/#{enc(id)}/revoke")
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/sign_in_tokens+ — one-time sign-in tokens for a user.
8
+ #
9
+ # @deprecated POST /v1/sign_in_tokens is deprecated (Sunset 2026-04-01). Use
10
+ # Sessions#create (POST /v1/sessions), which mints a real redeemable session.
11
+ class SignInTokens < Base
12
+ def create(body, idempotency_key: nil)
13
+ request(method: :post, path: "/v1/sign_in_tokens", body: body, idempotency_key: idempotency_key)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/sms_templates+ — transactional SMS templates, keyed by name.
8
+ class SmsTemplates < Base
9
+ def list
10
+ request(method: :get, path: "/v1/sms_templates")
11
+ end
12
+
13
+ # Upsert an override by name.
14
+ def create(body, idempotency_key: nil)
15
+ request(method: :post, path: "/v1/sms_templates", body: body, idempotency_key: idempotency_key)
16
+ end
17
+
18
+ def get(name)
19
+ request(method: :get, path: "/v1/sms_templates/#{enc(name)}")
20
+ end
21
+
22
+ def update(name, body)
23
+ request(method: :patch, path: "/v1/sms_templates/#{enc(name)}", body: body)
24
+ end
25
+
26
+ # Revert to the built-in.
27
+ def delete(name)
28
+ request(method: :delete, path: "/v1/sms_templates/#{enc(name)}")
29
+ end
30
+
31
+ # Render an unsaved draft (if a body is given) or the stored/built-in.
32
+ def preview(name, body = {})
33
+ request(method: :post, path: "/v1/sms_templates/#{enc(name)}/preview", body: body)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/sso_connections+ — enterprise SSO connections (OIDC, SAML, Discourse).
8
+ class SsoConnections < Base
9
+ def list
10
+ request(method: :get, path: "/v1/sso_connections")
11
+ end
12
+
13
+ def get(id)
14
+ request(method: :get, path: "/v1/sso_connections/#{enc(id)}")
15
+ end
16
+
17
+ def create(body, idempotency_key: nil)
18
+ request(method: :post, path: "/v1/sso_connections", body: body, idempotency_key: idempotency_key)
19
+ end
20
+
21
+ def update(id, body)
22
+ request(method: :patch, path: "/v1/sso_connections/#{enc(id)}", body: body)
23
+ end
24
+
25
+ def delete(id)
26
+ request(method: :delete, path: "/v1/sso_connections/#{enc(id)}")
27
+ end
28
+
29
+ # SP SAML metadata for a connection (JSON envelope carrying the XML).
30
+ def saml_metadata(id)
31
+ request(method: :get, path: "/v1/sso_connections/#{enc(id)}/saml_metadata")
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/sso_onboarding_profiles+ — self-service SSO onboarding profiles and
8
+ # the one-time tickets they issue.
9
+ class SsoOnboarding < Base
10
+ def list
11
+ request(method: :get, path: "/v1/sso_onboarding_profiles")
12
+ end
13
+
14
+ def get(id)
15
+ request(method: :get, path: "/v1/sso_onboarding_profiles/#{enc(id)}")
16
+ end
17
+
18
+ def create(body, idempotency_key: nil)
19
+ request(method: :post, path: "/v1/sso_onboarding_profiles", body: body, idempotency_key: idempotency_key)
20
+ end
21
+
22
+ def delete(id)
23
+ request(method: :delete, path: "/v1/sso_onboarding_profiles/#{enc(id)}")
24
+ end
25
+
26
+ # Issue a one-time ticket for a profile. The token is returned once, here.
27
+ def create_ticket(profile_id, body = {}, idempotency_key: nil)
28
+ request(method: :post, path: "/v1/sso_onboarding_profiles/#{enc(profile_id)}/tickets", body: body, idempotency_key: idempotency_key)
29
+ end
30
+
31
+ # Kill a still-live ticket. 404 once used, expired, or already revoked.
32
+ def revoke_ticket(ticket_id)
33
+ request(method: :post, path: "/v1/sso_onboarding_tickets/#{enc(ticket_id)}/revoke")
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Atlas
6
+ module Resources
7
+ # +/v1/tokens+ — authoritative online session-token verification (checks the
8
+ # revocation set). The slow path; prefer local {Atlas::Backend#verify}.
9
+ class Tokens < Base
10
+ def verify(body)
11
+ request(method: :post, path: "/v1/tokens/verify", body: body)
12
+ end
13
+ end
14
+ end
15
+ end