auth0-ruby 0.9
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/.bundle/config +2 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +68 -0
- data/README.md +27 -0
- data/Rakefile +9 -0
- data/auth0.gemspec +29 -0
- data/doc/Auth0.html +153 -0
- data/doc/Auth0/Api.html +128 -0
- data/doc/Auth0/Api/AuthenticationEndpoints.html +596 -0
- data/doc/Auth0/Api/V1.html +192 -0
- data/doc/Auth0/Api/V1/Clients.html +440 -0
- data/doc/Auth0/Api/V1/Connections.html +506 -0
- data/doc/Auth0/Api/V1/Logs.html +366 -0
- data/doc/Auth0/Api/V1/Rules.html +439 -0
- data/doc/Auth0/Api/V1/Users.html +1617 -0
- data/doc/Auth0/BadRequest.html +142 -0
- data/doc/Auth0/Client.html +236 -0
- data/doc/Auth0/Exception.html +140 -0
- data/doc/Auth0/Mixins.html +225 -0
- data/doc/Auth0/Mixins/HTTPartyProxy.html +121 -0
- data/doc/Auth0/Mixins/Initializer.html +298 -0
- data/doc/Auth0/NotFound.html +143 -0
- data/doc/Auth0/ServerError.html +142 -0
- data/doc/Auth0/Unauthorized.html +143 -0
- data/doc/Auth0/Unsupported.html +142 -0
- data/doc/Auth0/UserIdIsBlank.html +143 -0
- data/doc/Auth0Client.html +235 -0
- data/doc/_index.html +347 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +103 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +103 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +327 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/auth0.rb +8 -0
- data/lib/auth0/api/authentication_endpoints.rb +71 -0
- data/lib/auth0/api/v1.rb +19 -0
- data/lib/auth0/api/v1/clients.rb +48 -0
- data/lib/auth0/api/v1/connections.rb +51 -0
- data/lib/auth0/api/v1/logs.rb +41 -0
- data/lib/auth0/api/v1/rules.rb +44 -0
- data/lib/auth0/api/v1/users.rb +163 -0
- data/lib/auth0/client.rb +7 -0
- data/lib/auth0/exception.rb +18 -0
- data/lib/auth0/mixins.rb +13 -0
- data/lib/auth0/mixins/httparty_proxy.rb +29 -0
- data/lib/auth0/mixins/initializer.rb +25 -0
- data/lib/auth0/version.rb +4 -0
- data/lib/auth0_client.rb +3 -0
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +56 -0
- data/spec/lib/auth0/api/v1/clients_spec.rb +62 -0
- data/spec/lib/auth0/api/v1/connections_spec.rb +62 -0
- data/spec/lib/auth0/api/v1/logs_spec.rb +46 -0
- data/spec/lib/auth0/api/v1/rules_spec.rb +40 -0
- data/spec/lib/auth0/api/v1/users_spec.rb +215 -0
- data/spec/lib/auth0/client_spec.rb +19 -0
- data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +60 -0
- data/spec/lib/auth0_client_spec.rb +8 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/dummy_class.rb +7 -0
- data/spec/support/dummy_class_for_proxy.rb +4 -0
- data/spec/support/stub_response.rb +2 -0
- metadata +253 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!top-level-namespace.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Top Level Namespace</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Top Level Namespace
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Defined Under Namespace</h2>
|
85
|
+
<p class="children">
|
86
|
+
|
87
|
+
|
88
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Auth0.html" title="Auth0 (module)">Auth0</a></span>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Auth0Client.html" title="Auth0Client (class)">Auth0Client</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
</p>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="footer">
|
108
|
+
Generated on Mon Jan 26 03:18:46 2015 by
|
109
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
110
|
+
0.8.7.6 (ruby-2.0.0).
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</body>
|
114
|
+
</html>
|
data/lib/auth0.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
# {https://auth0.com/docs/auth-api}
|
4
|
+
# Describing functionality of auth0 authentication endpoints
|
5
|
+
module AuthenticationEndpoints
|
6
|
+
# {https://auth0.com/docs/auth-api#!#post--oauth-access_token}
|
7
|
+
def obtain_access_token
|
8
|
+
request_params = {
|
9
|
+
client_id: @client_id,
|
10
|
+
client_secret: @client_secret,
|
11
|
+
grant_type: 'client_credentials'
|
12
|
+
}
|
13
|
+
post("/oauth/token", request_params)["access_token"]
|
14
|
+
end
|
15
|
+
|
16
|
+
# {https://auth0.com/docs/auth-api#!#post--delegation}
|
17
|
+
def delegation(id_token, target, scope = "open_id")
|
18
|
+
request_params = {
|
19
|
+
client_id: @client_id,
|
20
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
21
|
+
id_token: id_token,
|
22
|
+
target: target,
|
23
|
+
scope: scope
|
24
|
+
}
|
25
|
+
post("/delegation", request_params)
|
26
|
+
end
|
27
|
+
|
28
|
+
# {https://auth0.com/docs/auth-api#!#post--oauth-ro}
|
29
|
+
def login(username, password, scope = "openid", id_token=nil, connection_name="Username-Password-Authentication")
|
30
|
+
request_params = {
|
31
|
+
client_id: @client_id,
|
32
|
+
username: username,
|
33
|
+
password: password,
|
34
|
+
scope: scope,
|
35
|
+
connection: connection_name,
|
36
|
+
grand_type: "password",
|
37
|
+
id_token: id_token
|
38
|
+
}
|
39
|
+
post("/oauth/ro", request_params)
|
40
|
+
end
|
41
|
+
|
42
|
+
# {https://auth0.com/docs/auth-api#!#post--dbconnections-signup}
|
43
|
+
def signup(email, password, connection_name= "Username-Password-Authentication")
|
44
|
+
request_params = {
|
45
|
+
client_id: @client_id,
|
46
|
+
email: email,
|
47
|
+
connection: connection_name,
|
48
|
+
password: password
|
49
|
+
}
|
50
|
+
post("/dbconnections/signup", request_params)
|
51
|
+
end
|
52
|
+
|
53
|
+
# {https://auth0.com/docs/auth-api#!#post--dbconnections-change_password}
|
54
|
+
def change_password(email, password, connection_name = "Username-Password-Authentication")
|
55
|
+
request_params = {
|
56
|
+
client_id: @client_id,
|
57
|
+
email: email,
|
58
|
+
connection: connection_name,
|
59
|
+
password: password
|
60
|
+
}
|
61
|
+
post("/dbconnections/change_password", request_params)
|
62
|
+
end
|
63
|
+
|
64
|
+
# {https://auth0.com/docs/auth-api#!#post--tokeninfo}
|
65
|
+
def token_info(id_token)
|
66
|
+
request_params = { id_token: id_token}
|
67
|
+
post("/tokeninfo", request_params)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/auth0/api/v1.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "auth0/api/v1/users"
|
2
|
+
require "auth0/api/v1/clients"
|
3
|
+
require "auth0/api/v1/connections"
|
4
|
+
require "auth0/api/v1/rules"
|
5
|
+
require "auth0/api/v1/logs"
|
6
|
+
module Auth0
|
7
|
+
# Space for all API calls
|
8
|
+
module Api
|
9
|
+
# {https://auth0.com/docs/api}
|
10
|
+
# Describing current functionality of Auth0 API V1
|
11
|
+
module V1
|
12
|
+
include Auth0::Api::V1::Users
|
13
|
+
include Auth0::Api::V1::Connections
|
14
|
+
include Auth0::Api::V1::Clients
|
15
|
+
include Auth0::Api::V1::Rules
|
16
|
+
include Auth0::Api::V1::Logs
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
# {https://auth0.com/docs/api#applications}
|
5
|
+
module Clients
|
6
|
+
# {https://auth0.com/docs/api#!#get--api-clients}
|
7
|
+
def clients
|
8
|
+
path = "/api/clients"
|
9
|
+
get(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
alias :get_clients :clients
|
13
|
+
|
14
|
+
# {https://auth0.com/docs/api#!#post--api-clients}
|
15
|
+
def create_client(name, callbacks="")
|
16
|
+
path = "/api/clients"
|
17
|
+
request_params = {
|
18
|
+
name: name,
|
19
|
+
callbacks: callbacks
|
20
|
+
}
|
21
|
+
post(path, request_params)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @deprecated use {#patch_client}
|
25
|
+
# {https://auth0.com/docs/api#!#put--api-clients--client-id-}
|
26
|
+
def update_client(name, callbacks="", client_id=@client_id)
|
27
|
+
warn "This endpoint has been deprecated in favor of PUT."
|
28
|
+
path = "/api/clients/#{client_id}"
|
29
|
+
request_params = {
|
30
|
+
name: name,
|
31
|
+
callbacks: callbacks
|
32
|
+
}
|
33
|
+
put(path, request_params)
|
34
|
+
end
|
35
|
+
|
36
|
+
# {https://auth0.com/docs/api#!#patch--api-clients--client-id-}
|
37
|
+
def patch_client(name, callbacks="", client_id=@client_id)
|
38
|
+
path = "/api/clients/#{client_id}"
|
39
|
+
request_params = {
|
40
|
+
name: name,
|
41
|
+
callbacks: callbacks
|
42
|
+
}
|
43
|
+
patch(path, request_params)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
# {https://auth0.com/docs/api#connections}
|
5
|
+
module Connections
|
6
|
+
# {https://auth0.com/docs/api#!#get--api-connections}
|
7
|
+
def connections
|
8
|
+
get("/api/connections")
|
9
|
+
end
|
10
|
+
alias :get_connections :connections
|
11
|
+
|
12
|
+
# {https://auth0.com/docs/api#!#get--api-connections--connection-name-}
|
13
|
+
def connection(connection_name)
|
14
|
+
path = "/api/connections/#{connection_name.to_s}"
|
15
|
+
get(path)
|
16
|
+
end
|
17
|
+
alias :get_connection :connection
|
18
|
+
|
19
|
+
# {https://auth0.com/docs/api#!#delete--api-connections--connection-name-}
|
20
|
+
def delete_connection(connection_name)
|
21
|
+
path = "/api/connections/#{connection_name.to_s}"
|
22
|
+
delete(path)
|
23
|
+
end
|
24
|
+
|
25
|
+
# {https://auth0.com/docs/api#!#post--api-connections}
|
26
|
+
def create_connection(connection_name, strategy, tenant_domain, domain_aliases=nil)
|
27
|
+
path = "/api/connections"
|
28
|
+
request_params = { name: connection_name,
|
29
|
+
strategy: strategy,
|
30
|
+
options: {
|
31
|
+
tenant_domain: tenant_domain,
|
32
|
+
domain_aliases: domain_aliases
|
33
|
+
}
|
34
|
+
}
|
35
|
+
post(path, request_params)
|
36
|
+
end
|
37
|
+
|
38
|
+
# {https://auth0.com/docs/api#!#put--api-connections--connection-name-}
|
39
|
+
def update_connection(connection_name, tenant_domain, status=true)
|
40
|
+
path = "/api/connections/#{connection_name}"
|
41
|
+
request_params = { status: status,
|
42
|
+
options: {
|
43
|
+
tenant_domain: tenant_domain
|
44
|
+
}
|
45
|
+
}
|
46
|
+
put(path, request_params)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
# {https://auth0.com/docs/api#logs}
|
5
|
+
module Logs
|
6
|
+
# {https://auth0.com/docs/api#!#get--api-logs-page--number--per_page--items--sort--field----1-1--fields--fields--exclude_fields-true-false-}
|
7
|
+
#
|
8
|
+
# {https://auth0.com/docs/api#!#get--api-logs-search--criteria-}
|
9
|
+
#
|
10
|
+
# {https://auth0.com/docs/api#!#get--api-logs-from--checkpointId--take--count-}
|
11
|
+
def logs(options={})
|
12
|
+
acceptable_params = %i(take from search_criteria page per_page sort fields exclude_fields)
|
13
|
+
options.reject! do |key,value|
|
14
|
+
if key.nil? ||\
|
15
|
+
value.nil? ||\
|
16
|
+
!acceptable_params.include?(key.to_sym)
|
17
|
+
warn "#{key} is not in acceptable params list: #{acceptable_params}"
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
path= "/api/logs?"+URI.encode_www_form(options)
|
22
|
+
get(path)
|
23
|
+
end
|
24
|
+
|
25
|
+
alias :search_logs :logs
|
26
|
+
|
27
|
+
# {https://auth0.com/docs/api#!#get--api-logs--_id-}
|
28
|
+
def log(id)
|
29
|
+
path = "/api/logs/#{id}"
|
30
|
+
get(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
# {https://auth0.com/docs/api#!#get--api-users--user_id--logs-page--number--per_page--items-}
|
34
|
+
def user_logs(user_id, page=0, per_page=50)
|
35
|
+
path = "/api/users/#{user_id}/logs?page=#{page}&per_page=#{per_page}"
|
36
|
+
get(path)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
# https://auth0.com/docs/api#rules
|
5
|
+
module Rules
|
6
|
+
# https://auth0.com/docs/api#!#get--api-rules
|
7
|
+
def rules
|
8
|
+
path = "/api/rules"
|
9
|
+
get(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
alias :get_rules :rules
|
13
|
+
|
14
|
+
# https://auth0.com/docs/api#!#post--api-rules
|
15
|
+
def create_rule(name, script, order=nil,status=true)
|
16
|
+
path = "/api/rules"
|
17
|
+
request_params = { name: name,
|
18
|
+
status: status,
|
19
|
+
script: script,
|
20
|
+
order: order
|
21
|
+
}
|
22
|
+
post(path, request_params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# https://auth0.com/docs/api#!#put--api-rules--rule-name-
|
26
|
+
def update_rule(name, script, order=nil,status=true)
|
27
|
+
path = "/api/rules/#{name}"
|
28
|
+
request_params = {
|
29
|
+
status: status,
|
30
|
+
script: script,
|
31
|
+
order: order
|
32
|
+
}
|
33
|
+
put(path, request_params)
|
34
|
+
end
|
35
|
+
|
36
|
+
# https://auth0.com/docs/api#!#delete--api-rules--rule-name-
|
37
|
+
def delete_rule(name)
|
38
|
+
path = "/api/rules/#{name}"
|
39
|
+
delete(path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
# {https://auth0.com/docs/api#users}
|
5
|
+
module Users
|
6
|
+
# {https://auth0.com/docs/api#!#get--api-users}
|
7
|
+
#
|
8
|
+
# {https://auth0.com/docs/api#!#get--api-users-search--criteria-}
|
9
|
+
def users(search=nil)
|
10
|
+
path = "/api/users"
|
11
|
+
path += "?search=#{search.to_s}" unless search.to_s.empty?
|
12
|
+
get(path)
|
13
|
+
end
|
14
|
+
|
15
|
+
alias :users_search :users
|
16
|
+
alias :get_users :users
|
17
|
+
|
18
|
+
# {https://auth0.com/docs/api#!#get--api-users--user_id-}
|
19
|
+
def user(user_id)
|
20
|
+
path = "/api/users/#{user_id}"
|
21
|
+
get(path)
|
22
|
+
end
|
23
|
+
|
24
|
+
alias :get_user :user
|
25
|
+
|
26
|
+
# {https://auth0.com/docs/api#!#get--api-users--user_id--devices}
|
27
|
+
def user_devices(user_id)
|
28
|
+
path = "/api/users/#{user_id}/devices"
|
29
|
+
get(path)
|
30
|
+
end
|
31
|
+
|
32
|
+
# {https://auth0.com/docs/api#!#get--api-connections--connection--users}
|
33
|
+
# {https://auth0.com/docs/api#!#get--api-connections--connection--users-search--criteria-}
|
34
|
+
def connection_users(connection_name, search=nil)
|
35
|
+
path = "/api/connections/#{connection_name}/users"
|
36
|
+
path += "?search=#{search.to_s}" unless search.to_s.empty?
|
37
|
+
get(path)
|
38
|
+
end
|
39
|
+
|
40
|
+
alias :search_connection_users :connection_users
|
41
|
+
|
42
|
+
# {https://auth0.com/docs/api#!#get--api-enterpriseconnections-users-search--criteria-}
|
43
|
+
def enterpriseconnections_users(search_criteria=nil, per_page=500)
|
44
|
+
path = "/api/enterpriseconnections/users?search=#{search_criteria.to_s}&per_page=#{per_page.to_i.to_s}"
|
45
|
+
get(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
# {https://auth0.com/docs/api#!#get--api-socialconnections-users-search--criteria-}
|
49
|
+
def socialconnections_users(search_criteria=nil, per_page=500)
|
50
|
+
path = "/api/socialconnections/users?search=#{search_criteria.to_s}&per_page=#{per_page.to_i.to_s}"
|
51
|
+
get(path)
|
52
|
+
end
|
53
|
+
|
54
|
+
# {https://auth0.com/docs/api#!#get--api-clients--client-id--users}
|
55
|
+
def client_users(client_id=@client_id)
|
56
|
+
path = "/api/clients/#{client_id}/users"
|
57
|
+
get(path)
|
58
|
+
end
|
59
|
+
|
60
|
+
# {https://auth0.com/docs/api#!#post--api-users}
|
61
|
+
def create_user(email, password, connection_name, request_params={})
|
62
|
+
options = { email: email, password: password, connection: connection_name }
|
63
|
+
request_params.merge!(options)
|
64
|
+
path = "/api/users"
|
65
|
+
post(path, request_params)
|
66
|
+
end
|
67
|
+
|
68
|
+
# {https://auth0.com/docs/api#!#post--api-users--user_id--send_verification_email}
|
69
|
+
def send_verification_email(user_id)
|
70
|
+
path = "/api/users/#{user_id}/send_verification_email"
|
71
|
+
post(path)
|
72
|
+
end
|
73
|
+
|
74
|
+
# {https://auth0.com/docs/api#!#post--api-users--user_id--change_password_ticket}
|
75
|
+
def change_password_ticket(user_id, new_password, result_url=nil)
|
76
|
+
request_params = { "newPassword" => new_password, "resultUrl" => result_url }
|
77
|
+
path = "/api/users/#{user_id}/change_password_ticket"
|
78
|
+
post(path, request_params)
|
79
|
+
end
|
80
|
+
|
81
|
+
# {https://auth0.com/docs/api#!#post--api-users--user_id--verification_ticket}
|
82
|
+
def verification_ticket(user_id, result_url=nil)
|
83
|
+
request_params = {"resultUrl" => result_url}
|
84
|
+
path = "/api/users/#{user_id}/verification_ticket"
|
85
|
+
post(path, request_params)
|
86
|
+
end
|
87
|
+
|
88
|
+
# {https://auth0.com/docs/api#!#post--api-users--user_id--publickey}
|
89
|
+
def create_public_key(user_id, device, public_key)
|
90
|
+
path = "/api/users/#{user_id}/public_key"
|
91
|
+
request_params = { device: device, public_key: public_key }
|
92
|
+
post(path, request_params)
|
93
|
+
end
|
94
|
+
|
95
|
+
# {https://auth0.com/docs/api#!#put--api-users--user_id--email}
|
96
|
+
def update_user_email(user_id, email, verify=true)
|
97
|
+
path = "/api/users/#{user_id}/email"
|
98
|
+
request_params = { email: email, verify: verify }
|
99
|
+
put(path, request_params)
|
100
|
+
end
|
101
|
+
|
102
|
+
# {https://auth0.com/docs/api#!#put--api-users--user_id--metadata}
|
103
|
+
# This will overwrite user's metadata, be really carefull, preffer using patch instead
|
104
|
+
def update_user_metadata(user_id, metadata={})
|
105
|
+
path = "/api/users/#{user_id}/metadata"
|
106
|
+
put(path, metadata)
|
107
|
+
end
|
108
|
+
|
109
|
+
# {https://auth0.com/docs/api#!#put--api-users--user_id--password}
|
110
|
+
def update_user_password(user_id, password, verify=true)
|
111
|
+
path = "/api/users/#{user_id}/password"
|
112
|
+
request_params = { password: password, verify: verify }
|
113
|
+
put(path, request_params)
|
114
|
+
end
|
115
|
+
|
116
|
+
# {https://auth0.com/docs/api#!#put--api-users--email--password}
|
117
|
+
def update_user_password_using_email(email, password, connection_name, verify=true)
|
118
|
+
request_params = {
|
119
|
+
email: email,
|
120
|
+
password: password,
|
121
|
+
connection: connection_name,
|
122
|
+
verify: verify
|
123
|
+
}
|
124
|
+
path = "/api/users/#{email}/password"
|
125
|
+
put(path, request_params)
|
126
|
+
end
|
127
|
+
|
128
|
+
# {https://auth0.com/docs/api#!#patch--api-users--user_id--metadata}
|
129
|
+
def patch_user_metadata(user_id, metadata={})
|
130
|
+
path = "/api/users/#{user_id}/metadata"
|
131
|
+
patch(path, metadata)
|
132
|
+
end
|
133
|
+
|
134
|
+
# {https://auth0.com/docs/api#!#delete--api-users}
|
135
|
+
#
|
136
|
+
# This will remove all your users
|
137
|
+
def delete_users
|
138
|
+
path = "/api/users/"
|
139
|
+
delete(path)
|
140
|
+
end
|
141
|
+
|
142
|
+
# {https://auth0.com/docs/api#!#delete--api-users--user_id-}
|
143
|
+
def delete_user(user_id)
|
144
|
+
raise Auth0::UserIdIsBlank, "if you want to remove all users user delete_users method" if user_id.to_s.empty?
|
145
|
+
path = "/api/users/#{user_id}"
|
146
|
+
delete(path)
|
147
|
+
end
|
148
|
+
|
149
|
+
# {https://auth0.com/docs/api#!#delete--api-users--user_id--refresh_tokens--refresh_token-}
|
150
|
+
def revoke_user_refresh_token(user_id, refresh_token)
|
151
|
+
path = "/api/users/#{user_id}/refresh_tokens/#{refresh_token}"
|
152
|
+
delete(path)
|
153
|
+
end
|
154
|
+
|
155
|
+
# {https://auth0.com/docs/api#!#delete--api-users--user_id--publickey-device--device-}
|
156
|
+
def revoke_user_device_public_key(user_id, device)
|
157
|
+
path = "/api/users/#{user_id}/publickey?device=#{device}"
|
158
|
+
delete(path)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|