authlete 1.0.21 → 1.2.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 +4 -4
- data/.gitignore +2 -1
- data/Makefile +40 -0
- data/README.md +20 -20
- data/Rakefile +5 -0
- data/authlete.gemspec +2 -2
- data/lib/authlete.rb +28 -9
- data/lib/authlete/api.rb +153 -322
- data/lib/authlete/authentication-server.rb +230 -230
- data/lib/authlete/exception.rb +14 -15
- data/lib/authlete/model/base.rb +30 -0
- data/lib/authlete/model/client-extension.rb +17 -119
- data/lib/authlete/model/client.rb +203 -338
- data/lib/authlete/model/hashable.rb +13 -33
- data/lib/authlete/model/named-uri.rb +13 -74
- data/lib/authlete/model/pair.rb +13 -74
- data/lib/authlete/model/param-initializer.rb +45 -0
- data/lib/authlete/model/property.rb +15 -85
- data/lib/authlete/model/request/authentication-callback-request.rb +63 -55
- data/lib/authlete/model/request/authorization-fail-request.rb +14 -75
- data/lib/authlete/model/request/authorization-issue-request.rb +38 -119
- data/lib/authlete/model/request/authorization-request.rb +8 -73
- data/lib/authlete/model/request/backchannel-authentication-complete-request.rb +97 -0
- data/lib/authlete/model/request/backchannel-authentication-fail-request.rb +55 -0
- data/lib/authlete/model/request/backchannel-authentication-issue-request.rb +37 -0
- data/lib/authlete/model/request/backchannel-authentication-request.rb +63 -0
- data/lib/authlete/model/request/base.rb +26 -0
- data/lib/authlete/model/request/client-authorization-delete-request.rb +7 -93
- data/lib/authlete/model/request/client-authorization-get-list-request.rb +17 -89
- data/lib/authlete/model/request/client-authorization-update-request.rb +11 -86
- data/lib/authlete/model/request/client-registration-request.rb +49 -0
- data/lib/authlete/model/request/client-secret-update-request.rb +7 -89
- data/lib/authlete/model/request/developer-authentication-callback-request.rb +40 -43
- data/lib/authlete/model/request/device-authorization-request.rb +63 -0
- data/lib/authlete/model/request/device-complete-request.rb +99 -0
- data/lib/authlete/model/request/device-verification-request.rb +40 -0
- data/lib/authlete/model/request/granted-scopes-request.rb +8 -74
- data/lib/authlete/model/request/introspection-request.rb +24 -83
- data/lib/authlete/model/request/pushed-auth-req-request.rb +64 -0
- data/lib/authlete/model/request/revocation-request.rb +14 -88
- data/lib/authlete/model/request/standard-introspection-request.rb +8 -73
- data/lib/authlete/model/request/token-create-request.rb +52 -183
- data/lib/authlete/model/request/token-fail-request.rb +12 -74
- data/lib/authlete/model/request/token-issue-request.rb +22 -80
- data/lib/authlete/model/request/token-request.rb +44 -81
- data/lib/authlete/model/request/token-update-request.rb +35 -121
- data/lib/authlete/model/request/user-info-issue-request.rb +14 -80
- data/lib/authlete/model/request/user-info-request.rb +25 -70
- data/lib/authlete/model/response/access-token.rb +96 -0
- data/lib/authlete/model/response/authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/authorization-fail-response.rb +13 -15
- data/lib/authlete/model/response/authorization-issue-response.rb +29 -32
- data/lib/authlete/model/response/authorization-response.rb +97 -123
- data/lib/authlete/model/response/authorized-client-list-response.rb +37 -0
- data/lib/authlete/model/response/backchannel-authentication-complete-response.rb +143 -0
- data/lib/authlete/model/response/backchannel-authentication-fail-response.rb +47 -0
- data/lib/authlete/model/response/backchannel-authentication-issue-response.rb +63 -0
- data/lib/authlete/model/response/backchannel-authentication-response.rb +160 -0
- data/lib/authlete/model/response/client-list-response.rb +58 -0
- data/lib/authlete/model/response/client-registration-response.rb +50 -0
- data/lib/authlete/model/response/client-secret-refresh-response.rb +12 -12
- data/lib/authlete/model/response/client-secret-update-response.rb +12 -12
- data/lib/authlete/model/response/developer-authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/device-authorization-response.rb +134 -0
- data/lib/authlete/model/response/device-complete-response.rb +39 -0
- data/lib/authlete/model/response/device-verification-response.rb +96 -0
- data/lib/authlete/model/response/granted-scopes-get-response.rb +27 -19
- data/lib/authlete/model/response/introspection-response.rb +64 -58
- data/lib/authlete/model/response/pushed-auth-req-response.rb +59 -0
- data/lib/authlete/model/response/revocation-response.rb +12 -15
- data/lib/authlete/model/response/service-list-response.rb +54 -0
- data/lib/authlete/model/response/standard-introspection-response.rb +13 -15
- data/lib/authlete/model/response/token-create-response.rb +50 -55
- data/lib/authlete/model/response/token-fail-response.rb +14 -17
- data/lib/authlete/model/response/token-issue-response.rb +49 -62
- data/lib/authlete/model/response/token-list-response.rb +64 -0
- data/lib/authlete/model/response/token-response.rb +59 -79
- data/lib/authlete/model/response/token-update-response.rb +28 -23
- data/lib/authlete/model/response/user-info-issue-response.rb +16 -16
- data/lib/authlete/model/response/user-info-response.rb +48 -42
- data/lib/authlete/model/result.rb +14 -13
- data/lib/authlete/model/scope.rb +68 -158
- data/lib/authlete/model/service-owner.rb +32 -116
- data/lib/authlete/model/service.rb +672 -837
- data/lib/authlete/model/sns-credentials.rb +51 -124
- data/lib/authlete/model/tagged-value.rb +14 -69
- data/lib/authlete/utility.rb +70 -99
- data/lib/authlete/version.rb +3 -3
- data/test/authlete/model/request/test_authentication-callback-request.rb +100 -0
- data/test/authlete/model/request/test_authorization-fail-request.rb +67 -0
- data/test/authlete/model/request/test_authorization-issue-request.rb +94 -0
- data/test/authlete/model/request/test_authorization-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +102 -0
- data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +71 -0
- data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-request.rb +75 -0
- data/test/authlete/model/request/test_client-authorization-delete-request.rb +57 -0
- data/test/authlete/model/request/test_client-authorization-get-list-request.rb +71 -0
- data/test/authlete/model/request/test_client-authorization-update-request.rb +63 -0
- data/test/authlete/model/request/test_client-registration-request.rb +68 -0
- data/test/authlete/model/request/test_device-authorization-request.rb +75 -0
- data/test/authlete/model/request/test_device-complete-request.rb +102 -0
- data/test/authlete/model/request/test_device-verification-request.rb +57 -0
- data/test/authlete/model/request/test_granted-scopes-request.rb +57 -0
- data/test/authlete/model/request/test_introspection-request.rb +79 -0
- data/test/authlete/model/request/test_pushed-auth-req-request.rb +75 -0
- data/test/authlete/model/request/test_revocation-request.rb +67 -0
- data/test/authlete/model/request/test_standard-introspection-request.rb +57 -0
- data/test/authlete/model/request/test_token-create-request.rb +110 -0
- data/test/authlete/model/request/test_token-fail-request.rb +63 -0
- data/test/authlete/model/request/test_token-issue-request.rb +70 -0
- data/test/authlete/model/request/test_token-request.rb +94 -0
- data/test/authlete/model/request/test_token-update-request.rb +82 -0
- data/test/authlete/model/request/test_user-info-issue-request.rb +67 -0
- data/test/authlete/model/request/test_user-info-request.rb +75 -0
- data/test/authlete/model/response/test_access-token.rb +101 -0
- data/test/authlete/model/response/test_authorization-fail-response.rb +68 -0
- data/test/authlete/model/response/test_authorization-issue-response.rb +92 -0
- data/test/authlete/model/response/test_authorization-response.rb +145 -0
- data/test/authlete/model/response/test_authorized-client-list-response.rb +83 -0
- data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +132 -0
- data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +68 -0
- data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +80 -0
- data/test/authlete/model/response/test_backchannel-authentication-response.rb +156 -0
- data/test/authlete/model/response/test_client-list-response.rb +79 -0
- data/test/authlete/model/response/test_client-secret-refresh-response.rb +68 -0
- data/test/authlete/model/response/test_client-secret-update-response.rb +68 -0
- data/test/authlete/model/response/test_device-authorization-response.rb +140 -0
- data/test/authlete/model/response/test_device-complete-response.rb +64 -0
- data/test/authlete/model/response/test_device-verification-response.rb +112 -0
- data/test/authlete/model/response/test_granted-scopes-get-response.rb +84 -0
- data/test/authlete/model/response/test_introspection-response.rb +127 -0
- data/test/authlete/model/response/test_pushed-auth-req-response.rb +76 -0
- data/test/authlete/model/response/test_revocation-response.rb +68 -0
- data/test/authlete/model/response/test_service-list-response.rb +72 -0
- data/test/authlete/model/response/test_standard-introspection-response.rb +68 -0
- data/test/authlete/model/response/test_token-create-response.rb +107 -0
- data/test/authlete/model/response/test_token-fail-response.rb +68 -0
- data/test/authlete/model/response/test_token-issue-response.rb +127 -0
- data/test/authlete/model/response/test_token-list-response.rb +84 -0
- data/test/authlete/model/response/test_token-response.rb +147 -0
- data/test/authlete/model/response/test_token-update-response.rb +87 -0
- data/test/authlete/model/response/test_user-info-issue-response.rb +68 -0
- data/test/authlete/model/response/test_user-info-response.rb +107 -0
- data/test/authlete/model/test_client-extension.rb +95 -0
- data/test/authlete/model/test_client.rb +461 -0
- data/test/authlete/model/test_named-uri.rb +85 -0
- data/test/authlete/model/test_pair.rb +85 -0
- data/test/authlete/model/test_property.rb +90 -0
- data/test/authlete/model/test_result.rb +68 -0
- data/test/authlete/model/test_scope.rb +106 -0
- data/test/authlete/model/test_service-owner.rb +80 -0
- data/test/authlete/model/test_service.rb +624 -0
- data/test/authlete/model/test_sns-credentials.rb +88 -0
- data/test/authlete/model/test_tagged-value.rb +83 -0
- data/test/authlete/test_exception.rb +70 -0
- metadata +173 -13
- data/lib/authlete/model/client-list.rb +0 -129
- data/lib/authlete/model/response/client-authorization-get-list-response.rb +0 -60
- data/lib/authlete/model/response/service-creatable-response.rb +0 -51
- data/lib/authlete/model/service-list.rb +0 -128
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,109 +15,37 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'set'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
#
|
26
|
-
# This class represents a request to Authlete's /api/client/authorization/get/list API.
|
27
|
-
class ClientAuthorizationGetListRequest < Authlete::Model::Hashable
|
21
|
+
class ClientAuthorizationGetListRequest < Authlete::Model::Request::Base
|
28
22
|
|
29
|
-
# Unique user ID. (String)
|
30
23
|
attr_accessor :subject
|
31
24
|
|
32
|
-
|
33
|
-
|
25
|
+
attr_accessor :developer
|
26
|
+
|
34
27
|
attr_accessor :start
|
35
28
|
|
36
|
-
# End index of search results (exclusive).
|
37
|
-
# (Integer)
|
38
29
|
attr_accessor :end
|
39
30
|
|
40
|
-
# Unique Developer ID. (String)
|
41
|
-
attr_accessor :developer
|
42
|
-
|
43
31
|
private
|
44
32
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
# to Authlete's /api/client/authorization/get/list API.
|
53
|
-
def initialize(hash = nil)
|
54
|
-
# Set default values to integer attributes.
|
55
|
-
INTEGER_ATTRIBUTES.each do |attr|
|
56
|
-
send("#{attr}=", 0)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Set default values to string attributes.
|
60
|
-
STRING_ATTRIBUTES.each do |attr|
|
61
|
-
send("#{attr}=", nil)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Set attribute values using the given hash.
|
65
|
-
authlete_model_update(hash)
|
66
|
-
end
|
67
|
-
|
68
|
-
def authlete_model_convert_key(key)
|
69
|
-
key.to_sym
|
70
|
-
end
|
71
|
-
|
72
|
-
def authlete_model_simple_attribute?(key)
|
73
|
-
INTEGER_ATTRIBUTES.include?(key) or
|
74
|
-
STRING_ATTRIBUTES.include?(key)
|
33
|
+
def defaults
|
34
|
+
{
|
35
|
+
subject: nil,
|
36
|
+
developer: nil,
|
37
|
+
start: 0,
|
38
|
+
end: 0
|
39
|
+
}
|
75
40
|
end
|
76
41
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
80
|
-
hash
|
81
|
-
|
82
|
-
|
83
|
-
if authlete_model_simple_attribute?(key)
|
84
|
-
send("#{key}=", value)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
self
|
89
|
-
end
|
90
|
-
|
91
|
-
public
|
92
|
-
|
93
|
-
# Construct an instance from the given hash.
|
94
|
-
#
|
95
|
-
# If the given argument is nil or is not a Hash, nil is returned.
|
96
|
-
# Otherwise, ClientAuthorizationGetListRequest.new(hash) is returned.
|
97
|
-
def self.parse(hash)
|
98
|
-
if hash.nil? or (hash.kind_of?(Hash) == false)
|
99
|
-
return nil
|
100
|
-
end
|
101
|
-
|
102
|
-
return ClientAuthorizationGetListRequest.new(hash)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Convert this object into a hash.
|
106
|
-
def to_hash
|
107
|
-
hash = {}
|
108
|
-
|
109
|
-
instance_variables.each do |var|
|
110
|
-
key = var.to_s.delete("@").to_sym
|
111
|
-
val = instance_variable_get(var)
|
112
|
-
|
113
|
-
if authlete_model_simple_attribute?(key) or val.nil?
|
114
|
-
hash[key] = val
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
hash
|
42
|
+
def set_params(hash)
|
43
|
+
@subject = hash[:subject]
|
44
|
+
@developer = hash[:developer]
|
45
|
+
@start = hash[:start]
|
46
|
+
@end = hash[:end]
|
119
47
|
end
|
120
48
|
end
|
121
49
|
end
|
122
50
|
end
|
123
|
-
end
|
51
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,104 +15,29 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'set'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
#
|
26
|
-
# This class represents a request to Authlete's /api/client/authorization/update API.
|
27
|
-
class ClientAuthorizationUpdateRequest < Authlete::Model::Hashable
|
21
|
+
class ClientAuthorizationUpdateRequest < Authlete::Model::Request::Base
|
28
22
|
|
29
|
-
# Unique user ID. (String)
|
30
23
|
attr_accessor :subject
|
31
24
|
|
32
|
-
# The new value of scopes that is set to existing access tokens.
|
33
|
-
# "nil" means that scopes are not changed. (String array)
|
34
25
|
attr_accessor :scopes
|
35
26
|
|
36
27
|
private
|
37
28
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# The constructor which takes a hash that represents a JSON request
|
45
|
-
# to Authlete's /api/client/authorization/update API.
|
46
|
-
def initialize(hash = nil)
|
47
|
-
# Set default values to string attributes.
|
48
|
-
STRING_ATTRIBUTES.each do |attr|
|
49
|
-
send("#{attr}=", nil)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Set default values to string array attributes.
|
53
|
-
STRING_ARRAY_ATTRIBUTES.each do |attr|
|
54
|
-
send("#{attr}=", nil)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Set attribute values using the given hash.
|
58
|
-
authlete_model_update(hash)
|
59
|
-
end
|
60
|
-
|
61
|
-
def authlete_model_convert_key(key)
|
62
|
-
key.to_sym
|
63
|
-
end
|
64
|
-
|
65
|
-
def authlete_model_simple_attribute?(key)
|
66
|
-
STRING_ATTRIBUTES.include?(key) or
|
67
|
-
STRING_ARRAY_ATTRIBUTES.include?(key)
|
68
|
-
end
|
69
|
-
|
70
|
-
def authlete_model_update(hash)
|
71
|
-
return if hash.nil?
|
72
|
-
|
73
|
-
hash.each do |key, value|
|
74
|
-
key = authlete_model_convert_key(key)
|
75
|
-
|
76
|
-
if authlete_model_simple_attribute?(key)
|
77
|
-
send("#{key}=", value)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
self
|
29
|
+
def defaults
|
30
|
+
{
|
31
|
+
subject: nil,
|
32
|
+
scopes: nil
|
33
|
+
}
|
82
34
|
end
|
83
35
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
# If the given argument is nil or is not a Hash, nil is returned.
|
89
|
-
# Otherwise, ClientAuthorizationUpdateRequest.new(hash) is returned.
|
90
|
-
def self.parse(hash)
|
91
|
-
if hash.nil? or (hash.kind_of?(Hash) == false)
|
92
|
-
return nil
|
93
|
-
end
|
94
|
-
|
95
|
-
return ClientAuthorizationUpdateRequest.new(hash)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Convert this object into a hash.
|
99
|
-
def to_hash
|
100
|
-
hash = {}
|
101
|
-
|
102
|
-
instance_variables.each do |var|
|
103
|
-
key = var.to_s.delete("@").to_sym
|
104
|
-
val = instance_variable_get(var)
|
105
|
-
|
106
|
-
if authlete_model_simple_attribute?(key) or val.nil?
|
107
|
-
hash[key] = val
|
108
|
-
elsif val.kind_of?(Array)
|
109
|
-
hash[key] = val.map { |element| element.to_hash }
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
hash
|
36
|
+
def set_params(hash)
|
37
|
+
@subject = hash[:subject]
|
38
|
+
@scopes = hash[:scopes]
|
114
39
|
end
|
115
40
|
end
|
116
41
|
end
|
117
42
|
end
|
118
|
-
end
|
43
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
|
18
|
+
module Authlete
|
19
|
+
module Model
|
20
|
+
module Request
|
21
|
+
class ClientRegistrationRequest < Authlete::Model::Request::Base
|
22
|
+
|
23
|
+
attr_accessor :json
|
24
|
+
|
25
|
+
attr_accessor :token
|
26
|
+
|
27
|
+
attr_accessor :clientId
|
28
|
+
alias_method :client_id, :clientId
|
29
|
+
alias_method :client_id=, :clientId=
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def defaults
|
34
|
+
{
|
35
|
+
json: nil,
|
36
|
+
token: nil,
|
37
|
+
clientId: nil
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_params(hash)
|
42
|
+
@json = hash[:json]
|
43
|
+
@token = hash[:token]
|
44
|
+
@clientId = hash[:clientId]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,107 +15,25 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'set'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
#
|
26
|
-
# This class represents a request to Authlete's /api/client/secret/update/{clientIdentifier} API.
|
27
|
-
class ClientSecretUpdateRequest < Authlete::Model::Hashable
|
21
|
+
class ClientSecretUpdateRequest < Authlete::Model::Request::Base
|
28
22
|
|
29
|
-
# Client secret. (String)
|
30
|
-
#
|
31
|
-
# The new value of the client secret. Valid characters for a client
|
32
|
-
# secret are A-Z, a-z, 0-9, -, and _. The maximum length of a client
|
33
|
-
# secret is 86.
|
34
23
|
attr_accessor :clientSecret
|
35
24
|
alias_method :client_secret, :clientSecret
|
36
25
|
alias_method :client_secret=, :clientSecret=
|
37
26
|
|
38
27
|
private
|
39
28
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Mapping from snake cases to camel cases.
|
44
|
-
SNAKE_TO_CAMEL = {
|
45
|
-
:client_secret => :clientSecret
|
46
|
-
}
|
47
|
-
|
48
|
-
# The constructor which takes a hash that represents a JSON request
|
49
|
-
# to Authlete's /api/client/secret/update/{clientIdentifier} API.
|
50
|
-
def initialize(hash = nil)
|
51
|
-
# Set default values to string attributes.
|
52
|
-
STRING_ATTRIBUTES.each do |attr|
|
53
|
-
send("#{attr}=", nil)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Set attribute values using the given hash.
|
57
|
-
authlete_model_update(hash)
|
58
|
-
end
|
59
|
-
|
60
|
-
def authlete_model_convert_key(key)
|
61
|
-
key = key.to_sym
|
62
|
-
|
63
|
-
# Convert snakecase to camelcase, if necessary.
|
64
|
-
if SNAKE_TO_CAMEL.has_key?(key)
|
65
|
-
key = SNAKE_TO_CAMEL[key]
|
66
|
-
end
|
67
|
-
|
68
|
-
key
|
29
|
+
def defaults
|
30
|
+
{ clientSecret: nil }
|
69
31
|
end
|
70
32
|
|
71
|
-
def
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
def authlete_model_update(hash)
|
76
|
-
return if hash.nil?
|
77
|
-
|
78
|
-
hash.each do |key, value|
|
79
|
-
key = authlete_model_convert_key(key)
|
80
|
-
|
81
|
-
if authlete_model_simple_attribute?(key)
|
82
|
-
send("#{key}=", value)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
self
|
87
|
-
end
|
88
|
-
|
89
|
-
public
|
90
|
-
|
91
|
-
# Construct an instance from the given hash.
|
92
|
-
#
|
93
|
-
# If the given argument is nil or is not a Hash, nil is returned.
|
94
|
-
# Otherwise, ClientSecretUpdateRequest.new(hash) is returned.
|
95
|
-
def self.parse(hash)
|
96
|
-
if hash.nil? or (hash.kind_of?(Hash) == false)
|
97
|
-
return nil
|
98
|
-
end
|
99
|
-
|
100
|
-
return ClientSecretUpdateRequest.new(hash)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Convert this object into a hash.
|
104
|
-
def to_hash
|
105
|
-
hash = {}
|
106
|
-
|
107
|
-
instance_variables.each do |var|
|
108
|
-
key = var.to_s.delete("@").to_sym
|
109
|
-
val = instance_variable_get(var)
|
110
|
-
|
111
|
-
if authlete_model_simple_attribute?(key) or val.nil?
|
112
|
-
hash[key] = val
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
hash
|
33
|
+
def set_params(hash)
|
34
|
+
@clientSecret = hash[:clientSecret]
|
117
35
|
end
|
118
36
|
end
|
119
37
|
end
|
120
38
|
end
|
121
|
-
end
|
39
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,62 +15,59 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'json'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
# == Authlete::Model::Request::DeveloperAuthenticationCallbackRequest class
|
25
|
-
#
|
26
|
-
# This class represents a request to a developer authentication callback endpoint.
|
27
21
|
class DeveloperAuthenticationCallbackRequest
|
28
|
-
include Authlete::Utility
|
29
|
-
# The API key of the service.
|
30
|
-
attr_accessor :service_api_key
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
|
23
|
+
attr_accessor :serviceApiKey
|
24
|
+
alias_method :service_api_key, :serviceApiKey
|
25
|
+
alias_method :service_api_key=, :serviceApiKey=
|
26
|
+
|
35
27
|
attr_accessor :id
|
36
28
|
|
37
|
-
# The password that the developer input to the password field.
|
38
|
-
# If 'sns' property is nil, it is ensured that this attribute
|
39
|
-
# is not nil. In such a case, authentication should be performed
|
40
|
-
# on the pair of 'id' attribute and this 'password' attribute.
|
41
|
-
# On the other hand, if 'sns' attribute is not nil, this attribute
|
42
|
-
# has no meaning, because authentication has performed by the SNS.
|
43
29
|
attr_accessor :password
|
44
30
|
|
45
|
-
# The SNS which the developer used for social login.
|
46
|
-
# For example, 'FACEBOOK'.
|
47
31
|
attr_accessor :sns
|
48
32
|
|
49
|
-
|
50
|
-
|
33
|
+
attr_accessor :accessToken
|
34
|
+
alias_method :access_token, :accessToken
|
35
|
+
alias_method :access_token=, :accessToken=
|
51
36
|
|
52
|
-
|
53
|
-
|
37
|
+
attr_accessor :refreshToken
|
38
|
+
alias_method :refresh_token, :refreshToken
|
39
|
+
alias_method :refresh_token=, :refreshToken=
|
54
40
|
|
55
|
-
|
56
|
-
|
41
|
+
attr_accessor :expiresIn
|
42
|
+
alias_method :expires_in, :expiresIn
|
43
|
+
alias_method :expires_in=, :expiresIn=
|
57
44
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
45
|
+
attr_accessor :rawTokenResponse
|
46
|
+
alias_method :raw_token_response, :rawTokenResponse
|
47
|
+
alias_method :raw_token_response=, :rawTokenResponse=
|
48
|
+
|
49
|
+
def defaults
|
50
|
+
{
|
51
|
+
serviceApiKey: nil,
|
52
|
+
id: nil,
|
53
|
+
password: nil,
|
54
|
+
sns: nil,
|
55
|
+
accessToken: nil,
|
56
|
+
refreshToken: nil,
|
57
|
+
expiresIn: 0,
|
58
|
+
rawTokenResponse: nil
|
59
|
+
}
|
60
|
+
end
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@
|
67
|
-
@
|
68
|
-
@
|
69
|
-
@
|
70
|
-
@
|
71
|
-
@
|
72
|
-
@expires_in = extract_integer_value(hash, :expiresIn)
|
73
|
-
@raw_token_response = extract_value(hash, :rawTokenResponse)
|
62
|
+
def set_params(hash)
|
63
|
+
@serviceApiKey = hash[:serviceApiKey]
|
64
|
+
@id = hash[:id]
|
65
|
+
@password = hash[:password]
|
66
|
+
@sns = hash[:sns]
|
67
|
+
@accessToken = hash[:accessToken]
|
68
|
+
@refreshToken = hash[:refreshToken]
|
69
|
+
@expiresIn = hash[:expiresIn]
|
70
|
+
@rawTokenResponse = hash[:rawTokenResponse]
|
74
71
|
end
|
75
72
|
|
76
73
|
# Parse a JSON string which represents a request to a developer
|
@@ -82,4 +79,4 @@ module Authlete
|
|
82
79
|
end
|
83
80
|
end
|
84
81
|
end
|
85
|
-
end
|
82
|
+
end
|