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,88 +15,23 @@
|
|
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/auth/authorization API.
|
27
|
-
class AuthorizationRequest < Authlete::Model::Hashable
|
28
|
-
# The OAuth 2.0 authorization request parameters. (String)
|
21
|
+
class AuthorizationRequest < Authlete::Model::Request::Base
|
22
|
+
|
29
23
|
attr_accessor :parameters
|
30
24
|
|
31
25
|
private
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# The constructor which takes a hash that represents a JSON request to
|
37
|
-
# Authlete's /api/auth/authorization API.
|
38
|
-
def initialize(hash = nil)
|
39
|
-
# Set default values to string attributes.
|
40
|
-
STRING_ATTRIBUTES.each do |attr|
|
41
|
-
send("#{attr}=", nil)
|
42
|
-
end
|
43
|
-
|
44
|
-
# Set attribute values using the given hash.
|
45
|
-
authlete_model_update(hash)
|
27
|
+
def defaults
|
28
|
+
{ parameters: nil }
|
46
29
|
end
|
47
30
|
|
48
|
-
def
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
def authlete_model_simple_attribute?(key)
|
53
|
-
STRING_ATTRIBUTES.include?(key)
|
54
|
-
end
|
55
|
-
|
56
|
-
def authlete_model_update(hash)
|
57
|
-
return if hash.nil?
|
58
|
-
|
59
|
-
hash.each do |key, value|
|
60
|
-
key = authlete_model_convert_key(key)
|
61
|
-
|
62
|
-
if authlete_model_simple_attribute?(key)
|
63
|
-
send("#{key}=", value)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
self
|
68
|
-
end
|
69
|
-
|
70
|
-
public
|
71
|
-
|
72
|
-
# Construct an instance from the given hash.
|
73
|
-
#
|
74
|
-
# If the given argument is nil or is not a Hash, nil is returned.
|
75
|
-
# Otherwise, AuthorizationRequest.new(hash) is returned.
|
76
|
-
def self.parse(hash)
|
77
|
-
if hash.nil? or (hash.kind_of?(Hash) == false)
|
78
|
-
return nil
|
79
|
-
end
|
80
|
-
|
81
|
-
return AuthorizationRequest.new(hash)
|
82
|
-
end
|
83
|
-
|
84
|
-
# Convert this object into a hash.
|
85
|
-
def to_hash
|
86
|
-
hash = {}
|
87
|
-
|
88
|
-
instance_variables.each do |var|
|
89
|
-
key = var.to_s.delete("@").to_sym
|
90
|
-
val = instance_variable_get(var)
|
91
|
-
|
92
|
-
if authlete_model_simple_attribute?(key) or val.nil?
|
93
|
-
hash[key] = val
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
hash
|
31
|
+
def set_params(hash)
|
32
|
+
@parameters = hash[:parameters]
|
98
33
|
end
|
99
34
|
end
|
100
35
|
end
|
101
36
|
end
|
102
|
-
end
|
37
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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 BackchannelAuthenticationCompleteRequest < Authlete::Model::Request::Base
|
22
|
+
include Authlete::Utility
|
23
|
+
|
24
|
+
attr_accessor :ticket
|
25
|
+
|
26
|
+
attr_accessor :result
|
27
|
+
|
28
|
+
attr_accessor :subject
|
29
|
+
|
30
|
+
attr_accessor :sub
|
31
|
+
|
32
|
+
attr_accessor :authTime
|
33
|
+
alias_method :auth_time, :authTime
|
34
|
+
alias_method :auth_time=, :authTime=
|
35
|
+
|
36
|
+
attr_accessor :acr
|
37
|
+
|
38
|
+
attr_accessor :claims
|
39
|
+
|
40
|
+
attr_accessor :properties
|
41
|
+
|
42
|
+
attr_accessor :scopes
|
43
|
+
|
44
|
+
attr_accessor :errorDescription
|
45
|
+
alias_method :error_description, :errorDescription
|
46
|
+
alias_method :error_description=, :errorDescription=
|
47
|
+
|
48
|
+
attr_accessor :errorUri
|
49
|
+
alias_method :error_uri, :errorUri
|
50
|
+
alias_method :error_uri=, :errorUri=
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def defaults
|
55
|
+
{
|
56
|
+
ticket: nil,
|
57
|
+
result: nil,
|
58
|
+
subject: nil,
|
59
|
+
sub: nil,
|
60
|
+
authTime: 0,
|
61
|
+
acr: nil,
|
62
|
+
claims: nil,
|
63
|
+
properties: nil,
|
64
|
+
scopes: nil,
|
65
|
+
errorDescription: nil,
|
66
|
+
errorUri: nil
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def set_params(hash)
|
71
|
+
@ticket = hash[:ticket]
|
72
|
+
@result = hash[:result]
|
73
|
+
@subject = hash[:subject]
|
74
|
+
@sub = hash[:sub]
|
75
|
+
@authTime = hash[:authTime]
|
76
|
+
@acr = hash[:acr]
|
77
|
+
@claims = hash[:claims]
|
78
|
+
@properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
|
79
|
+
@scopes = hash[:scopes]
|
80
|
+
@errorDescription = hash[:errorDescription]
|
81
|
+
@errorUri = hash[:errorUri]
|
82
|
+
end
|
83
|
+
|
84
|
+
def to_hash_value(key, var)
|
85
|
+
raw_val = instance_variable_get(var)
|
86
|
+
|
87
|
+
case key
|
88
|
+
when :properties
|
89
|
+
raw_val&.map { |e| e.to_hash }
|
90
|
+
else
|
91
|
+
raw_val
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 BackchannelAuthenticationFailRequest < Authlete::Model::Request::Base
|
22
|
+
|
23
|
+
attr_accessor :ticket
|
24
|
+
|
25
|
+
attr_accessor :reason
|
26
|
+
|
27
|
+
attr_accessor :errorDescription
|
28
|
+
alias_method :error_description, :errorDescription
|
29
|
+
alias_method :error_description=, :errorDescription=
|
30
|
+
|
31
|
+
attr_accessor :errorUri
|
32
|
+
alias_method :error_uri, :errorUri
|
33
|
+
alias_method :error_uri=, :errorUri=
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def defaults
|
38
|
+
{
|
39
|
+
ticket: nil,
|
40
|
+
reason: nil,
|
41
|
+
errorDescription: nil,
|
42
|
+
errorUri: nil
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_params(hash)
|
47
|
+
@ticket = hash[:ticket]
|
48
|
+
@reason = hash[:reason]
|
49
|
+
@errorDescription = hash[:errorDescription]
|
50
|
+
@errorUri = hash[:errorUri]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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 BackchannelAuthenticationIssueRequest < Authlete::Model::Request::Base
|
22
|
+
|
23
|
+
attr_accessor :ticket
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def defaults
|
28
|
+
{ ticket: nil }
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_params(hash)
|
32
|
+
@ticket = hash[:ticket]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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 BackchannelAuthenticationRequest < Authlete::Model::Request::Base
|
22
|
+
|
23
|
+
attr_accessor :parameters
|
24
|
+
|
25
|
+
attr_accessor :clientId
|
26
|
+
alias_method :client_id, :clientId
|
27
|
+
alias_method :client_id=, :clientId=
|
28
|
+
|
29
|
+
attr_accessor :clientSecret
|
30
|
+
alias_method :client_secret, :clientSecret
|
31
|
+
alias_method :client_secret=, :clientSecret=
|
32
|
+
|
33
|
+
attr_accessor :clientCertificate
|
34
|
+
alias_method :client_certificate, :clientCertificate
|
35
|
+
alias_method :client_certificate=, :clientCertificate=
|
36
|
+
|
37
|
+
attr_accessor :clientCertificatePath
|
38
|
+
alias_method :client_certificate_path, :clientCertificatePath
|
39
|
+
alias_method :client_certificate_path=, :clientCertificatePath=
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def defaults
|
44
|
+
{
|
45
|
+
parameters: nil,
|
46
|
+
clientId: nil,
|
47
|
+
clientSecret: nil,
|
48
|
+
clientCertificate: nil,
|
49
|
+
clientCertificatePath: nil
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_params(hash)
|
54
|
+
@parameters = hash[:parameters]
|
55
|
+
@clientId = hash[:clientId]
|
56
|
+
@clientSecret = hash[:clientSecret]
|
57
|
+
@clientCertificate = hash[:clientCertificate]
|
58
|
+
@clientCertificatePath = hash[:clientCertificatePath]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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 Base < Authlete::Model::Base
|
22
|
+
include Authlete::Model::Hashable
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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,109 +15,23 @@
|
|
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/delete API.
|
27
|
-
class ClientAuthorizationDeleteRequest < Authlete::Model::Hashable
|
21
|
+
class ClientAuthorizationDeleteRequest < Authlete::Model::Request::Base
|
28
22
|
|
29
|
-
# Unique user ID. (String)
|
30
23
|
attr_accessor :subject
|
31
24
|
|
32
|
-
# Start index of search results (inclusive).
|
33
|
-
# (Integer)
|
34
|
-
attr_accessor :start
|
35
|
-
|
36
|
-
# End index of search results (exclusive).
|
37
|
-
# (Integer)
|
38
|
-
attr_accessor :end
|
39
|
-
|
40
|
-
# Unique Developer ID. (String)
|
41
|
-
attr_accessor :developer
|
42
|
-
|
43
25
|
private
|
44
26
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# String attributes.
|
49
|
-
STRING_ATTRIBUTES = ::Set.new([ :subject, :developer ])
|
50
|
-
|
51
|
-
# The constructor which takes a hash that represents a JSON request
|
52
|
-
# to Authlete's /api/client/authorization/delete 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)
|
27
|
+
def defaults
|
28
|
+
{ subject: nil }
|
75
29
|
end
|
76
30
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
80
|
-
hash.each do |key, value|
|
81
|
-
key = authlete_model_convert_key(key)
|
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, ClientAuthorizationDeleteRequest.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 ClientAuthorizationDeleteRequest.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
|
31
|
+
def set_params(hash)
|
32
|
+
@subject = hash[:subject]
|
119
33
|
end
|
120
34
|
end
|
121
35
|
end
|
122
36
|
end
|
123
|
-
end
|
37
|
+
end
|