authing_ruby 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aea089117c37cb1ba0f187b8ed1b26d3971af87adb438275c8ed5cf8ca74785
|
4
|
+
data.tar.gz: 27dcf489dd3465c984898573ad885d778db8e32fd915b7538418e825f012888e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50c2815f4009a9f0bbff3e8b22c02ee9b4ade53cf927c34daab002ac4c456383165dd7ffa248004246c0cf24e953aa40e2d46d0de7c3747f6934eebe416ea7f
|
7
|
+
data.tar.gz: e2ce98c1d7d1af2d9a60df129bfa11b6c323f412a91e6143878c13c4a0b36b3d4b59fa090f309acb12963a572c797d3f687f83f3145b21b9a104739e6171b86f
|
@@ -15,7 +15,7 @@ module AuthingRuby
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def getCurrentUser(garpqhlClient, tokenProvider, variables)
|
18
|
-
return _graphql_query_request("
|
18
|
+
return _graphql_query_request("user", garpqhlClient, tokenProvider, variables)
|
19
19
|
end
|
20
20
|
|
21
21
|
def sendEmail(garpqhlClient, variables)
|
@@ -39,6 +39,11 @@ module AuthingRuby
|
|
39
39
|
@tokenEndPointAuthMethod = options.fetch(:tokenEndPointAuthMethod, 'client_secret_post')
|
40
40
|
@introspectionEndPointAuthMethod = options.fetch(:introspectionEndPointAuthMethod, 'client_secret_post')
|
41
41
|
@revocationEndPointAuthMethod = options.fetch(:revocationEndPointAuthMethod, 'client_secret_post')
|
42
|
+
|
43
|
+
token = options.fetch(:token, nil)
|
44
|
+
if token
|
45
|
+
setToken(token)
|
46
|
+
end
|
42
47
|
end
|
43
48
|
|
44
49
|
# 使用邮箱+密码注册 (完成, 测试通过)
|
@@ -272,7 +277,7 @@ module AuthingRuby
|
|
272
277
|
# 返回:用户信息
|
273
278
|
def getCurrentUser()
|
274
279
|
graphqlAPI = AuthingRuby::GraphQLAPI.new
|
275
|
-
res = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider,
|
280
|
+
res = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider, {})
|
276
281
|
json = JSON.parse(res)
|
277
282
|
user = json.dig("data", "user")
|
278
283
|
if user
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# 测试内容: 用户认证模块-认证核心模块
|
2
|
-
# 如何运行: ruby
|
2
|
+
# 如何运行: ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb
|
3
3
|
|
4
4
|
require "minitest/autorun" # Minitest
|
5
5
|
require "./lib/authing_ruby.rb" # 模块主文件
|
6
|
-
require "./lib/test/helper.rb"
|
6
|
+
require "./lib/authing_ruby/test/helper.rb"
|
7
7
|
require 'dotenv'
|
8
8
|
Dotenv.load('.env.test') # 你可以编辑这个文件来修改环境变量
|
9
9
|
# 备注: 不要用 staging 或 production 环境的用户池来测试,新建一个用户池专门做测试,因为测试期间会注册随机名字的用户
|
@@ -19,7 +19,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# 测试邮箱+密码注册
|
22
|
-
# ruby
|
22
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_registerByEmail
|
23
23
|
def test_registerByEmail
|
24
24
|
random_string = @helper.randomNumString()
|
25
25
|
email = "#{random_string}@qq.com"
|
@@ -34,7 +34,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# 测试用户名+密码注册
|
37
|
-
# ruby
|
37
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_registerByUsername
|
38
38
|
def test_registerByUsername
|
39
39
|
random_string = @helper.randomString(9)
|
40
40
|
username = random_string
|
@@ -44,7 +44,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# 测试邮箱+密码登录
|
47
|
-
# ruby
|
47
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_loginByEmail
|
48
48
|
def test_loginByEmail
|
49
49
|
# 第一步:先注册
|
50
50
|
random_string = @helper.randomString(9)
|
@@ -58,7 +58,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# 测试用户名+密码登录
|
61
|
-
# ruby
|
61
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_loginByUsername
|
62
62
|
def test_loginByUsername
|
63
63
|
random_string = @helper.randomString(9)
|
64
64
|
username = random_string
|
@@ -73,7 +73,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
73
73
|
# end
|
74
74
|
|
75
75
|
# 测试获取当前用户
|
76
|
-
# ruby ./lib/test/mini_test/TestAuthenticationClient.rb -n test_getCurrentUser
|
76
|
+
# ruby ./lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_getCurrentUser
|
77
77
|
def test_getCurrentUser
|
78
78
|
# 注册+登录
|
79
79
|
username = "test_getCurrentUser_#{@helper.randomString()}"
|
@@ -87,7 +87,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# 测试退出登录
|
90
|
-
# ruby
|
90
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_logout
|
91
91
|
def test_logout
|
92
92
|
# 如何测试?
|
93
93
|
# 1. 先登录, 用身份去做一些事情 (比如修改 nickname)
|
@@ -119,7 +119,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
119
119
|
end
|
120
120
|
|
121
121
|
# 测试: 修改用户资料
|
122
|
-
# ruby
|
122
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_updateProfile
|
123
123
|
def test_updateProfile
|
124
124
|
# 先登录
|
125
125
|
username = 'zhengcheng123'
|
@@ -141,7 +141,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
141
141
|
end
|
142
142
|
|
143
143
|
# 测试: 检查密码强度
|
144
|
-
# ruby
|
144
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_checkPasswordStrength
|
145
145
|
# 注意, 在 Authing 用户池里 -> "扩展能力" -> "自定义密码加密",选的是 "用户可使用任意非空字符串作为密码"
|
146
146
|
def test_checkPasswordStrength
|
147
147
|
password = "123"
|
@@ -162,7 +162,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
162
162
|
end
|
163
163
|
|
164
164
|
# 测试: 更新用户密码
|
165
|
-
# ruby
|
165
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_updatePassword
|
166
166
|
def test_updatePassword
|
167
167
|
# 例子1:如果不登陆,直接改,会提示尚未登录
|
168
168
|
# oldPassword = "123456789"
|
@@ -205,7 +205,7 @@ class TestAuthenticationClient < Minitest::Test
|
|
205
205
|
end
|
206
206
|
|
207
207
|
# 测试: 检测 Token 登录状态
|
208
|
-
# ruby
|
208
|
+
# ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_checkLoginStatus
|
209
209
|
def test_checkLoginStatus
|
210
210
|
# 第一步:先登录然后获取 token
|
211
211
|
username = 'zhengcheng123'
|
data/lib/authing_ruby/version.rb
CHANGED