oktakit 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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +84 -0
- data/.travis.yml +6 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +19 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/dev.yml +11 -0
- data/lib/oktakit.rb +8 -0
- data/lib/oktakit/client.rb +165 -0
- data/lib/oktakit/client/admin_roles.rb +160 -0
- data/lib/oktakit/client/apps.rb +363 -0
- data/lib/oktakit/client/events.rb +20 -0
- data/lib/oktakit/client/factors.rb +223 -0
- data/lib/oktakit/client/groups.rb +149 -0
- data/lib/oktakit/client/identity_providers.rb +274 -0
- data/lib/oktakit/client/schemas.rb +65 -0
- data/lib/oktakit/client/templates.rb +99 -0
- data/lib/oktakit/client/users.rb +290 -0
- data/lib/oktakit/error.rb +166 -0
- data/lib/oktakit/response/raise_error.rb +19 -0
- data/lib/oktakit/version.rb +3 -0
- data/oktakit.gemspec +25 -0
- metadata +101 -0
@@ -0,0 +1,363 @@
|
|
1
|
+
module Oktakit
|
2
|
+
class Client
|
3
|
+
module Apps
|
4
|
+
# Add Application
|
5
|
+
#
|
6
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
7
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
8
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
9
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
10
|
+
# @param options [Hash] Optional. Body params for request.
|
11
|
+
# @return [Hash<Sawyer::Resource>] All responses return the created Application.
|
12
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#add-application
|
13
|
+
# @example
|
14
|
+
# Oktakit.add_application
|
15
|
+
def add_application(options = {})
|
16
|
+
post('/apps', options)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get Application
|
20
|
+
#
|
21
|
+
# @params id [string] Application ID
|
22
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
23
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
24
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
25
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
26
|
+
# @param options [Hash] Optional. Body params for request.
|
27
|
+
# @return [Hash<Sawyer::Resource>] Fetched Application
|
28
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#get-application
|
29
|
+
# @example
|
30
|
+
# Oktakit.get_application('id')
|
31
|
+
def get_application(id, options = {})
|
32
|
+
get("/apps/#{id}", options)
|
33
|
+
end
|
34
|
+
|
35
|
+
# List Applications
|
36
|
+
#
|
37
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
38
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
39
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
40
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
41
|
+
# @param options [Hash] Optional. Body params for request.
|
42
|
+
# @return [Array<Sawyer::Resource>] Array of Applications
|
43
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#list-applications
|
44
|
+
# @example
|
45
|
+
# Oktakit.list_applications
|
46
|
+
def list_applications(options = {})
|
47
|
+
get('/apps', options)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Update Application
|
51
|
+
#
|
52
|
+
# @params id [string] Application ID
|
53
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
54
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
55
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
56
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
57
|
+
# @param options [Hash] Optional. Body params for request.
|
58
|
+
# @return [Hash<Sawyer::Resource>] Updated Application
|
59
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#update-application
|
60
|
+
# @example
|
61
|
+
# Oktakit.update_application('id')
|
62
|
+
def update_application(id, options = {})
|
63
|
+
put("/apps/#{id}", options)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Delete Application
|
67
|
+
#
|
68
|
+
# @params id [string] Application ID
|
69
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
70
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
71
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
72
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
73
|
+
# @param options [Hash] Optional. Body params for request.
|
74
|
+
# @return [Hash<Sawyer::Resource>] An empty JSON object {}
|
75
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#delete-application
|
76
|
+
# @example
|
77
|
+
# Oktakit.delete_application('id')
|
78
|
+
def delete_application(id, options = {})
|
79
|
+
delete("/apps/#{id}", options)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Activate Application
|
83
|
+
#
|
84
|
+
# @params id [string] Application ID
|
85
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
86
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
87
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
88
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
89
|
+
# @param options [Hash] Optional. Body params for request.
|
90
|
+
# @return [Hash<Sawyer::Resource>] An empty JSON object {}
|
91
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#activate-application
|
92
|
+
# @example
|
93
|
+
# Oktakit.activate_application('id')
|
94
|
+
def activate_application(id, options = {})
|
95
|
+
post("/apps/#{id}/lifecycle/activate", options)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Deactivate Application
|
99
|
+
#
|
100
|
+
# @params id [string] Application ID
|
101
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
102
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
103
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
104
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
105
|
+
# @param options [Hash] Optional. Body params for request.
|
106
|
+
# @return [Hash<Sawyer::Resource>] An empty JSON object {}
|
107
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#deactivate-application
|
108
|
+
# @example
|
109
|
+
# Oktakit.deactivate_application('id')
|
110
|
+
def deactivate_application(id, options = {})
|
111
|
+
post("/apps/#{id}/lifecycle/deactivate", options)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Assign User to Application for SSO
|
115
|
+
#
|
116
|
+
# @params id [string] Application ID
|
117
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
118
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
119
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
120
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
121
|
+
# @param options [Hash] Optional. Body params for request.
|
122
|
+
# @return [Hash<Sawyer::Resource>] Application User
|
123
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#assign-user-to-application-for-sso
|
124
|
+
# @example
|
125
|
+
# Oktakit.assign_user_to_application_for_sso('id')
|
126
|
+
def assign_user_to_application_for_sso(id, options = {})
|
127
|
+
post("/apps/#{id}/users", options)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Assign User to Application for SSO & Provisioning
|
131
|
+
#
|
132
|
+
# @params od [string] Application ID
|
133
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
134
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
135
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
136
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
137
|
+
# @param options [Hash] Optional. Body params for request.
|
138
|
+
# @return [Hash<Sawyer::Resource>] Application User with user profile mappings applied
|
139
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#assign-user-to-application-for-sso--provisioning
|
140
|
+
# @example
|
141
|
+
# Oktakit.assign_user_to_application_for_sso_provisioning('id')
|
142
|
+
def assign_user_to_application_for_sso_provisioning(id, options = {})
|
143
|
+
post("/apps/#{id}/users", options)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Get Assigned User for Application
|
147
|
+
#
|
148
|
+
# @params app_id [string] Application ID
|
149
|
+
# @params user_id [string] User ID
|
150
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
151
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
152
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
153
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
154
|
+
# @param options [Hash] Optional. Body params for request.
|
155
|
+
# @return [Hash<Sawyer::Resource>] Application User
|
156
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#get-assigned-user-for-application
|
157
|
+
# @example
|
158
|
+
# Oktakit.get_assigned_user_for_application('user_id', 'app_id')
|
159
|
+
def get_assigned_user_for_application(app_id, user_id, options = {})
|
160
|
+
get("/apps/#{app_id}/users/#{user_id}", options)
|
161
|
+
end
|
162
|
+
|
163
|
+
# List Users Assigned to Application
|
164
|
+
#
|
165
|
+
# @params id [string] Application ID
|
166
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
167
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
168
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
169
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
170
|
+
# @param options [Hash] Optional. Body params for request.
|
171
|
+
# @return [Array<Sawyer::Resource>] Array of Application Users
|
172
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#list-users-assigned-to-application
|
173
|
+
# @example
|
174
|
+
# Oktakit.list_users_assigned_to_application('id')
|
175
|
+
def list_users_assigned_to_application(id, options = {})
|
176
|
+
get("/apps/#{id}/users", options)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Update Application Credentials for Assigned User
|
180
|
+
#
|
181
|
+
# @params app_id [string] Application ID
|
182
|
+
# @params user_id [string] User ID
|
183
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
184
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
185
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
186
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
187
|
+
# @param options [Hash] Optional. Body params for request.
|
188
|
+
# @return [Hash<Sawyer::Resource>] Application User
|
189
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#update-application-credentials-for-assigned-user
|
190
|
+
# @example
|
191
|
+
# Oktakit.update_application_credentials_for_assigned_user('user_id', 'app_id')
|
192
|
+
def update_application_credentials_for_assigned_user(app_id, user_id, options = {})
|
193
|
+
post("/apps/#{app_id}/users/#{user_id}", options)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Update Application Profile for Assigned User
|
197
|
+
#
|
198
|
+
# @params app_id [string] Application ID
|
199
|
+
# @params user_id [string] User ID
|
200
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
201
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
202
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
203
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
204
|
+
# @param options [Hash] Optional. Body params for request.
|
205
|
+
# @return [Hash<Sawyer::Resource>] Application User with user profile mappings applied
|
206
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#update-application-profile-for-assigned-user
|
207
|
+
# @example
|
208
|
+
# Oktakit.update_application_profile_for_assigned_user('user_id', 'app_id')
|
209
|
+
def update_application_profile_for_assigned_user(app_id, user_id, options = {})
|
210
|
+
post("/apps/#{app_id}/users/#{user_id}", options)
|
211
|
+
end
|
212
|
+
|
213
|
+
# Remove User from Application
|
214
|
+
#
|
215
|
+
# @params app_id [string] Application ID
|
216
|
+
# @params user_id [string] User ID
|
217
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
218
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
219
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
220
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
221
|
+
# @param options [Hash] Optional. Body params for request.
|
222
|
+
# @return [Hash<Sawyer::Resource>] An empty JSON object {}
|
223
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#remove-user-from-application
|
224
|
+
# @example
|
225
|
+
# Oktakit.remove_user_from_application('user_id', 'app_id')
|
226
|
+
def remove_user_from_application(app_id, user_id, options = {})
|
227
|
+
delete("/apps/#{app_id}/users/#{user_id}", options)
|
228
|
+
end
|
229
|
+
|
230
|
+
# Assign Group to Application
|
231
|
+
#
|
232
|
+
# @params app_id [string] Application ID
|
233
|
+
# @params group_id [string] Group ID
|
234
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
235
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
236
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
237
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
238
|
+
# @param options [Hash] Optional. Body params for request.
|
239
|
+
# @return [Hash<Sawyer::Resource>] All responses return the assigned Application Group.
|
240
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#assign-group-to-application
|
241
|
+
# @example
|
242
|
+
# Oktakit.assign_group_to_application('group_id', 'app_id')
|
243
|
+
def assign_group_to_application(app_id, group_id, options = {})
|
244
|
+
put("/apps/#{app_id}/groups/#{group_id}", options)
|
245
|
+
end
|
246
|
+
|
247
|
+
# Get Assigned Group for Application
|
248
|
+
#
|
249
|
+
# @params app_id [string] Application ID
|
250
|
+
# @params group_id [string] Group ID
|
251
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
252
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
253
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
254
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
255
|
+
# @param options [Hash] Optional. Body params for request.
|
256
|
+
# @return [Hash<Sawyer::Resource>] Fetched Application Group
|
257
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#get-assigned-group-for-application
|
258
|
+
# @example
|
259
|
+
# Oktakit.get_assigned_group_for_application('group_id', 'app_id')
|
260
|
+
def get_assigned_group_for_application(app_id, group_id, options = {})
|
261
|
+
get("/apps/#{app_id}/groups/#{group_id}", options)
|
262
|
+
end
|
263
|
+
|
264
|
+
# List Groups Assigned to Application
|
265
|
+
#
|
266
|
+
# @params id [string] Application ID
|
267
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
268
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
269
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
270
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
271
|
+
# @param options [Hash] Optional. Body params for request.
|
272
|
+
# @return [Array<Sawyer::Resource>] Array of Application Groups
|
273
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#list-groups-assigned-to-application
|
274
|
+
# @example
|
275
|
+
# Oktakit.list_groups_assigned_to_application('id')
|
276
|
+
def list_groups_assigned_to_application(id, options = {})
|
277
|
+
get("/apps/#{id}/groups", options)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Remove Group from Application
|
281
|
+
#
|
282
|
+
# @params app_id [string] Application ID
|
283
|
+
# @params group_id [string] Group ID
|
284
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
285
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
286
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
287
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
288
|
+
# @param options [Hash] Optional. Body params for request.
|
289
|
+
# @return [Hash<Sawyer::Resource>] An empty JSON object {}
|
290
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#remove-group-from-application
|
291
|
+
# @example
|
292
|
+
# Oktakit.remove_group_from_application('group_id', 'app_id')
|
293
|
+
def remove_group_from_application(app_id, group_id, options = {})
|
294
|
+
delete("/apps/#{app_id}/groups/#{group_id}", options)
|
295
|
+
end
|
296
|
+
|
297
|
+
# Generate New Application Key Credential
|
298
|
+
#
|
299
|
+
# @params app_id [string] Application ID
|
300
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
301
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
302
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
303
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
304
|
+
# @param options [Hash] Optional. Body params for request.
|
305
|
+
# @return [Hash<Sawyer::Resource>] Return the generated Application Key Credential.
|
306
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#generate-new-application-key-credential
|
307
|
+
# @example
|
308
|
+
# Oktakit.generate_new_application_key_credential('app_id')
|
309
|
+
def generate_new_application_key_credential(app_id, options = {})
|
310
|
+
post("/apps/#{app_id}/credentials/keys/generate", options)
|
311
|
+
end
|
312
|
+
|
313
|
+
# List Key Credentials for Application
|
314
|
+
#
|
315
|
+
# @params app_id [string] Application ID
|
316
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
317
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
318
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
319
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
320
|
+
# @param options [Hash] Optional. Body params for request.
|
321
|
+
# @return [Array<Sawyer::Resource>] Array of Application Key Credential.
|
322
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#list-key-credentials-for-application
|
323
|
+
# @example
|
324
|
+
# Oktakit.list_key_credentials_for_application('app_id')
|
325
|
+
def list_key_credentials_for_application(app_id, options = {})
|
326
|
+
get("/apps/#{app_id}/credentials/keys", options)
|
327
|
+
end
|
328
|
+
|
329
|
+
# Get Key Credential for Application
|
330
|
+
#
|
331
|
+
# @params app_id [string] App ID
|
332
|
+
# @params key_id [string] Key ID
|
333
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
334
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
335
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
336
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
337
|
+
# @param options [Hash] Optional. Body params for request.
|
338
|
+
# @return [Hash<Sawyer::Resource>] Application Key Credential.
|
339
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#get-key-credential-for-application
|
340
|
+
# @example
|
341
|
+
# Oktakit.get_key_credential_for_application('app_id', 'key_id')
|
342
|
+
def get_key_credential_for_application(app_id, key_id, options = {})
|
343
|
+
get("/apps/#{app_id}/credentials/keys/#{key_id}", options)
|
344
|
+
end
|
345
|
+
|
346
|
+
# Preview SAML metadata for Application
|
347
|
+
#
|
348
|
+
# @params app_id [string] Application ID
|
349
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
350
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
351
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
352
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
353
|
+
# @param options [Hash] Optional. Body params for request.
|
354
|
+
# @return [Hash<Sawyer::Resource>] SAML metadata in XML
|
355
|
+
# @see http://developer.okta.com/docs/api/resources/apps.html#preview-saml-metadata-for-application
|
356
|
+
# @example
|
357
|
+
# Oktakit.preview_saml_metadata_for_application('app_id')
|
358
|
+
def preview_saml_metadata_for_application(app_id, options = {})
|
359
|
+
get("/apps/#{app_id}/sso/saml/metadata", options)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Oktakit
|
2
|
+
class Client
|
3
|
+
module Events
|
4
|
+
# List Events
|
5
|
+
#
|
6
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
7
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
8
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
9
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
10
|
+
# @param options [Hash] Optional. Body params for request.
|
11
|
+
# @return [Array<Sawyer::Resource>] Array of Events
|
12
|
+
# @see http://developer.okta.com/docs/api/resources/events.html#list-events
|
13
|
+
# @example
|
14
|
+
# Oktakit.list_events
|
15
|
+
def list_events(options = {})
|
16
|
+
get('/events', options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
module Oktakit
|
2
|
+
class Client
|
3
|
+
module Factors
|
4
|
+
# Get Factor
|
5
|
+
#
|
6
|
+
# @params user_id [string] User ID
|
7
|
+
# @params factor_id [string] Factor ID
|
8
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
9
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
10
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
11
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
12
|
+
# @param options [Hash] Optional. Body params for request.
|
13
|
+
# @return [Hash<Sawyer::Resource>] Factor
|
14
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#get-factor
|
15
|
+
# @example
|
16
|
+
# Oktakit.get_factor('user_id', 'factor_id')
|
17
|
+
def get_factor(user_id, factor_id, options = {})
|
18
|
+
get("/users/#{user_id}/factors/#{factor_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# List Enrolled Factors
|
22
|
+
#
|
23
|
+
# @params user_id [string] User ID
|
24
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
25
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
26
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
27
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
28
|
+
# @param options [Hash] Optional. Body params for request.
|
29
|
+
# @return [Array<Sawyer::Resource>] Array of Factors
|
30
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#list-enrolled-factors
|
31
|
+
# @example
|
32
|
+
# Oktakit.list_enrolled_factors('user_id')
|
33
|
+
def list_enrolled_factors(user_id, options = {})
|
34
|
+
get("/users/#{user_id}/factors", options)
|
35
|
+
end
|
36
|
+
|
37
|
+
# List Factors to Enroll
|
38
|
+
#
|
39
|
+
# @params user_id [string] User ID
|
40
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
41
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
42
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
43
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
44
|
+
# @param options [Hash] Optional. Body params for request.
|
45
|
+
# @return [Array<Sawyer::Resource>] Array of Factors
|
46
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#list-factors-to-enroll
|
47
|
+
# @example
|
48
|
+
# Oktakit.list_factors_to_enroll('user_id')
|
49
|
+
def list_factors_to_enroll(user_id, options = {})
|
50
|
+
get("/users/#{user_id}/factors/catalog", options)
|
51
|
+
end
|
52
|
+
|
53
|
+
# List Security Questions
|
54
|
+
#
|
55
|
+
# @params user_id [string] User ID
|
56
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
57
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
58
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
59
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
60
|
+
# @param options [Hash] Optional. Body params for request.
|
61
|
+
# @return [Array<Sawyer::Resource>] Array of Questions
|
62
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#list-security-questions
|
63
|
+
# @example
|
64
|
+
# Oktakit.list_security_questions('user_id')
|
65
|
+
def list_security_questions(user_id, options = {})
|
66
|
+
get("/users/#{user_id}/factors/questions", options)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Enroll Factor
|
70
|
+
#
|
71
|
+
# @params user_id [string] User ID
|
72
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
73
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
74
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
75
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
76
|
+
# @param options [Hash] Optional. Body params for request.
|
77
|
+
# @return [Hash<Sawyer::Resource>] All responses return the enrolled Factor with a status of either PENDING_ACTIVATION or ACTIVE.
|
78
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#enroll-factor
|
79
|
+
# @example
|
80
|
+
# Oktakit.enroll_factor('id')
|
81
|
+
def enroll_factor(user_id, options = {})
|
82
|
+
post("/users/#{user_id}/factors", options)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Activate Factor
|
86
|
+
#
|
87
|
+
# @params user_id [string] User ID
|
88
|
+
# @params factor_id [string] Factor ID
|
89
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
90
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
91
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
92
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
93
|
+
# @param options [Hash] Optional. Body params for request.
|
94
|
+
# @return [Hash<Sawyer::Resource>] If the passcode is correct you will receive the Factor with an ACTIVE status.
|
95
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#activate-factor
|
96
|
+
# @example
|
97
|
+
# Oktakit.activate_factor('user_id', 'factor_id')
|
98
|
+
def activate_factor(user_id, factor_id, options = {})
|
99
|
+
post("/users/#{user_id}/factors/#{factor_id}/lifecycle/activate", options)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Reset Factor
|
103
|
+
#
|
104
|
+
# @params user_id [string] User ID
|
105
|
+
# @params factor_id [string] Factor ID
|
106
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
107
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
108
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
109
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
110
|
+
# @param options [Hash] Optional. Body params for request.
|
111
|
+
# @return 204 No Content
|
112
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#reset-factor
|
113
|
+
# @example
|
114
|
+
# Oktakit.reset_factor('user_id', 'factor_id')
|
115
|
+
def reset_factor(user_id, factor_id, options = {})
|
116
|
+
delete("/users/#{user_id}/factors/#{factor_id}", options)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Verify Security Question Factor
|
120
|
+
#
|
121
|
+
# @params user_id [string] User ID
|
122
|
+
# @params factor_id [string] Factor ID
|
123
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
124
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
125
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
126
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
127
|
+
# @param options [Hash] Optional. Body params for request.
|
128
|
+
# @return [Hash<Sawyer::Resource>] Verification result
|
129
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#verify-security-question-factor
|
130
|
+
# @example
|
131
|
+
# Oktakit.verify_security_question_factor('user_id', 'factor_id')
|
132
|
+
def verify_security_question_factor(user_id, factor_id, options = {})
|
133
|
+
post("/users/#{user_id}/factors/#{factor_id}/verify", options)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Verify SMS Factor
|
137
|
+
#
|
138
|
+
# @params user_id [string] User ID
|
139
|
+
# @params factor_id [string] Factor ID
|
140
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
141
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
142
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
143
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
144
|
+
# @param options [Hash] Optional. Body params for request.
|
145
|
+
# @return [Hash<Sawyer::Resource>] Verification result
|
146
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#verify-sms-factor
|
147
|
+
# @example
|
148
|
+
# Oktakit.verify_sms_factor('user_id', 'factor_id')
|
149
|
+
def verify_sms_factor(user_id, factor_id, options = {})
|
150
|
+
post("/users/#{user_id}/factors/#{factor_id}/verify", options)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Verify TOTP Factor
|
154
|
+
#
|
155
|
+
# @params user_id [string] User ID
|
156
|
+
# @params factor_id [string] Factor ID
|
157
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
158
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
159
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
160
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
161
|
+
# @param options [Hash] Optional. Body params for request.
|
162
|
+
# @return [Hash<Sawyer::Resource>] Verification result
|
163
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#verify-totp-factor
|
164
|
+
# @example
|
165
|
+
# Oktakit.verify_totp_factor('user_id', 'factor_id')
|
166
|
+
def verify_totp_factor(user_id, factor_id, options = {})
|
167
|
+
post("/users/#{user_id}/factors/#{factor_id}/verify", options)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Verify Push Factor
|
171
|
+
#
|
172
|
+
# @params user_id [string] User ID
|
173
|
+
# @params factor_id [string] Factor ID
|
174
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
175
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
176
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
177
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
178
|
+
# @param options [Hash] Optional. Body params for request.
|
179
|
+
# @return [Hash<Sawyer::Resource>] Verification result (waiting, success, rejected, or timeout)
|
180
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#verify-push-factor
|
181
|
+
# @example
|
182
|
+
# Oktakit.verify_push_factor('user_id', 'factor_id')
|
183
|
+
def verify_push_factor(user_id, factor_id, options = {})
|
184
|
+
post("/users/#{user_id}/factors/#{factor_id}/verify", options)
|
185
|
+
end
|
186
|
+
|
187
|
+
# Poll for Verify Transaction Completion
|
188
|
+
#
|
189
|
+
# @params user_id [string] User ID
|
190
|
+
# @params factor_id [string] Factor ID
|
191
|
+
# @params transaction_id [string] Transaction ID
|
192
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
193
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
194
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
195
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
196
|
+
# @param options [Hash] Optional. Body params for request.
|
197
|
+
# @return [Hash<Sawyer::Resource>] Verification result
|
198
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#poll-for-verify-transaction-completion
|
199
|
+
# @example
|
200
|
+
# Oktakit.poll_for_verify_transaction_completion('user_id', 'factor_id', 'transaction_id')
|
201
|
+
def poll_for_verify_transaction_completion(user_id, factor_id, transaction_id, options = {})
|
202
|
+
get("/users/#{user_id}/factors/#{factor_id}/transactions/#{transaction_id}", options)
|
203
|
+
end
|
204
|
+
|
205
|
+
# Verify Token Factor
|
206
|
+
#
|
207
|
+
# @params user_id [string] User ID
|
208
|
+
# @params factor_id [string] Factor ID
|
209
|
+
# @param options[:query] [Hash] Optional. Query params for request
|
210
|
+
# @param options[:headers] [Hash] Optional. Header params for the request.
|
211
|
+
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
|
212
|
+
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
|
213
|
+
# @param options [Hash] Optional. Body params for request.
|
214
|
+
# @return [Hash<Sawyer::Resource>] Verification result
|
215
|
+
# @see http://developer.okta.com/docs/api/resources/factors.html#verify-token-factor
|
216
|
+
# @example
|
217
|
+
# Oktakit.verify_token_factor('user_id', 'factor_id')
|
218
|
+
def verify_token_factor(user_id, factor_id, options = {})
|
219
|
+
post("/users/#{user_id}/factors/#{factor_id}/verify", options)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|