authlete 1.0.21 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,42 +15,47 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require 'json'
|
19
|
+
|
20
|
+
|
18
21
|
module Authlete
|
19
22
|
module Model
|
20
23
|
module Response
|
21
|
-
|
22
|
-
#
|
23
|
-
# This class represents a response from a developer authentication callback endpoint.
|
24
|
-
class DeveloperAuthenticationCallbackResponse
|
24
|
+
class DeveloperAuthenticationCallbackResponse < Authlete::Model::Base
|
25
25
|
include Authlete::Utility
|
26
|
-
|
26
|
+
|
27
27
|
attr_accessor :authenticated
|
28
28
|
|
29
|
-
# The unique identifier of the developer.
|
30
29
|
attr_accessor :subject
|
31
30
|
|
32
|
-
# The display name of the developer.
|
33
31
|
attr_accessor :displayName
|
34
32
|
alias_method :display_name, :displayName
|
35
33
|
alias_method :display_name=, :displayName=
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
private
|
36
|
+
|
37
|
+
def defaults
|
38
|
+
{
|
39
|
+
authenticated: false,
|
40
|
+
subject: nil,
|
41
|
+
displayName: nil
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def set_params(hash)
|
46
|
+
@authenticated = hash[:authenticated]
|
47
|
+
@subject = hash[:subject]
|
48
|
+
@displayName = hash[:displayName]
|
43
49
|
end
|
44
50
|
|
45
|
-
# Generate an array which is usable as a Rack response from this instance.
|
46
51
|
def to_rack_response
|
47
52
|
to_rack_response_json(200, JSON.generate(
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
53
|
+
authenticated: @authenticated,
|
54
|
+
subject: @subject,
|
55
|
+
displayNam: @displayName
|
51
56
|
))
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
end
|
56
|
-
end
|
61
|
+
end
|
@@ -0,0 +1,134 @@
|
|
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 Response
|
21
|
+
class DeviceAuthorizationResponse < Authlete::Model::Result
|
22
|
+
include Authlete::Utility
|
23
|
+
|
24
|
+
attr_accessor :action
|
25
|
+
|
26
|
+
attr_accessor :responseContent
|
27
|
+
alias_method :response_content, :responseContent
|
28
|
+
alias_method :response_content=, :responseContent=
|
29
|
+
|
30
|
+
attr_accessor :clientId
|
31
|
+
alias_method :client_id, :clientId
|
32
|
+
alias_method :client_id=, :clientId=
|
33
|
+
|
34
|
+
attr_accessor :clientIdAlias
|
35
|
+
alias_method :client_id_alias, :clientIdAlias
|
36
|
+
alias_method :client_id_alias=, :clientIdAlias=
|
37
|
+
|
38
|
+
attr_accessor :clientIdAliasUsed
|
39
|
+
alias_method :client_id_alias_used, :clientIdAliasUsed
|
40
|
+
alias_method :client_id_alias_used=, :clientIdAliasUsed=
|
41
|
+
|
42
|
+
attr_accessor :clientName
|
43
|
+
alias_method :client_name, :clientName
|
44
|
+
alias_method :client_name=, :clientName=
|
45
|
+
|
46
|
+
attr_accessor :clientAuthMethod
|
47
|
+
alias_method :client_auth_method, :clientAuthMethod
|
48
|
+
alias_method :client_auth_method=, :clientAuthMethod=
|
49
|
+
|
50
|
+
attr_accessor :scopes
|
51
|
+
|
52
|
+
attr_accessor :clientNames
|
53
|
+
alias_method :client_names, :clientNames
|
54
|
+
alias_method :client_names=, :clientNames=
|
55
|
+
|
56
|
+
attr_accessor :acrs
|
57
|
+
|
58
|
+
attr_accessor :deviceCode
|
59
|
+
alias_method :device_code, :deviceCode
|
60
|
+
alias_method :device_code=, :deviceCode=
|
61
|
+
|
62
|
+
attr_accessor :userCode
|
63
|
+
alias_method :user_code, :userCode
|
64
|
+
alias_method :user_code=, :userCode=
|
65
|
+
|
66
|
+
attr_accessor :verificationUri
|
67
|
+
alias_method :verification_uri, :verificationUri
|
68
|
+
alias_method :verification_uri=, :verificationUri=
|
69
|
+
|
70
|
+
attr_accessor :verificationUriComplete
|
71
|
+
alias_method :verification_uri_complete, :verificationUriComplete
|
72
|
+
alias_method :verification_uri_complete=, :verificationUriComplete=
|
73
|
+
|
74
|
+
attr_accessor :expiresIn
|
75
|
+
alias_method :expires_in, :expiresIn
|
76
|
+
alias_method :expires_in=, :expiresIn=
|
77
|
+
|
78
|
+
attr_accessor :interval
|
79
|
+
|
80
|
+
attr_accessor :resources
|
81
|
+
|
82
|
+
attr_accessor :warnings
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def defaults
|
87
|
+
super.merge(
|
88
|
+
action: nil,
|
89
|
+
responseContent: nil,
|
90
|
+
clientId: 0,
|
91
|
+
clientIdAlias: nil,
|
92
|
+
clientIdAliasUsed: false,
|
93
|
+
clientName: nil,
|
94
|
+
clientAuthMethod: nil,
|
95
|
+
scopes: nil,
|
96
|
+
clientNames: nil,
|
97
|
+
acrs: nil,
|
98
|
+
deviceCode: nil,
|
99
|
+
userCode: nil,
|
100
|
+
verificationUri: nil,
|
101
|
+
verificationUriComplete: nil,
|
102
|
+
expiresIn: 0,
|
103
|
+
interval: 0,
|
104
|
+
resources: nil,
|
105
|
+
warnings: nil
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def set_params(hash)
|
110
|
+
super(hash)
|
111
|
+
|
112
|
+
@action = hash[:action]
|
113
|
+
@responseContent = hash[:responseContent]
|
114
|
+
@clientId = hash[:clientId]
|
115
|
+
@clientIdAlias = hash[:clientIdAlias]
|
116
|
+
@clientIdAliasUsed = hash[:clientIdAliasUsed]
|
117
|
+
@clientName = hash[:clientName]
|
118
|
+
@clientAuthMethod = hash[:clientAuthMethod]
|
119
|
+
@scopes = get_parsed_array(hash[:scopes]) { |e| Authlete::Model::Scope.parse(e) }
|
120
|
+
@clientNames = hash[:clientNames]
|
121
|
+
@acrs = hash[:acrs]
|
122
|
+
@deviceCode = hash[:deviceCode]
|
123
|
+
@userCode = hash[:userCode]
|
124
|
+
@verificationUri = hash[:verificationUri]
|
125
|
+
@verificationUriComplete = hash[:verificationUriComplete]
|
126
|
+
@expiresIn = hash[:expiresIn]
|
127
|
+
@interval = hash[:interval]
|
128
|
+
@resources = hash[:resources]
|
129
|
+
@warnings = hash[:warnings]
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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 Response
|
21
|
+
class DeviceCompleteResponse < Authlete::Model::Result
|
22
|
+
|
23
|
+
attr_accessor :action
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def defaults
|
28
|
+
super.merge(action: nil)
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_params(hash)
|
32
|
+
super(hash)
|
33
|
+
|
34
|
+
@action = hash[:action]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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 Response
|
21
|
+
class DeviceVerificationResponse < Authlete::Model::Result
|
22
|
+
include Authlete::Utility
|
23
|
+
|
24
|
+
attr_accessor :action
|
25
|
+
|
26
|
+
attr_accessor :responseContent
|
27
|
+
alias_method :response_content, :responseContent
|
28
|
+
alias_method :response_content=, :responseContent=
|
29
|
+
|
30
|
+
attr_accessor :clientId
|
31
|
+
alias_method :client_id, :clientId
|
32
|
+
alias_method :client_id=, :clientId=
|
33
|
+
|
34
|
+
attr_accessor :clientIdAlias
|
35
|
+
alias_method :client_id_alias, :clientIdAlias
|
36
|
+
alias_method :client_id_alias=, :clientIdAlias=
|
37
|
+
|
38
|
+
attr_accessor :clientIdAliasUsed
|
39
|
+
alias_method :client_id_alias_used, :clientIdAliasUsed
|
40
|
+
alias_method :client_id_alias_used=, :clientIdAliasUsed=
|
41
|
+
|
42
|
+
attr_accessor :clientName
|
43
|
+
alias_method :client_name, :clientName
|
44
|
+
alias_method :client_name=, :clientName=
|
45
|
+
|
46
|
+
attr_accessor :scopes
|
47
|
+
|
48
|
+
attr_accessor :clientNames
|
49
|
+
alias_method :client_names, :clientNames
|
50
|
+
alias_method :client_names=, :clientNames=
|
51
|
+
|
52
|
+
attr_accessor :acrs
|
53
|
+
|
54
|
+
attr_accessor :expiresAt
|
55
|
+
alias_method :expires_at, :expiresAt
|
56
|
+
alias_method :expires_at=, :expiresAt=
|
57
|
+
|
58
|
+
attr_accessor :resources
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def defaults
|
63
|
+
super.merge(
|
64
|
+
action: nil,
|
65
|
+
responseContent: nil,
|
66
|
+
clientId: 0,
|
67
|
+
clientIdAlias: nil,
|
68
|
+
clientIdAliasUsed: false,
|
69
|
+
clientName: nil,
|
70
|
+
scopes: nil,
|
71
|
+
clientNames: nil,
|
72
|
+
acrs: nil,
|
73
|
+
expiresAt: 0,
|
74
|
+
resources: nil
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def set_params(hash)
|
79
|
+
super(hash)
|
80
|
+
|
81
|
+
@action = hash[:action]
|
82
|
+
@responseContent = hash[:responseContent]
|
83
|
+
@clientId = hash[:clientId]
|
84
|
+
@clientIdAlias = hash[:clientIdAlias]
|
85
|
+
@clientIdAliasUsed = hash[:clientIdAliasUsed]
|
86
|
+
@clientName = hash[:clientName]
|
87
|
+
@scopes = get_parsed_array(hash[:scopes]) { |e| Authlete::Model::Scope.parse(e) }
|
88
|
+
@clientNames = hash[:clientNames]
|
89
|
+
@acrs = hash[:acrs]
|
90
|
+
@expiresAt = hash[:expiresAt]
|
91
|
+
@resources = hash[:resources]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
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.
|
@@ -18,46 +18,54 @@
|
|
18
18
|
module Authlete
|
19
19
|
module Model
|
20
20
|
module Response
|
21
|
-
# == Authlete::Model::Response::GrantedScopesGetResponse class
|
22
|
-
#
|
23
|
-
# A class that represents a response from Authlete's
|
24
|
-
# /api/client/granted_scopes/get/{clientId} API.
|
25
21
|
class GrantedScopesGetResponse < Authlete::Model::Result
|
26
|
-
|
22
|
+
|
27
23
|
attr_accessor :serviceApiKey
|
28
24
|
alias_method :service_api_key, :serviceApiKey
|
29
25
|
alias_method :service_api_key=, :serviceApiKey=
|
30
26
|
|
31
|
-
# Client ID.. (Integer)
|
32
27
|
attr_accessor :clientId
|
33
28
|
alias_method :client_id, :clientId
|
34
29
|
alias_method :client_id=, :clientId=
|
35
30
|
|
36
|
-
# Unique User ID. (String)
|
37
31
|
attr_accessor :subject
|
38
32
|
|
39
|
-
# Scopes granted by the last authorization process. (String array)
|
40
33
|
attr_accessor :latestGrantedScopes
|
41
34
|
alias_method :latest_granted_scopes, :latestGrantedScopes
|
42
35
|
alias_method :latest_granted_scopes=, :latestGrantedScopes=
|
43
36
|
|
44
|
-
# All scopes granted so far. (String array)
|
45
37
|
attr_accessor :mergedGrantedScopes
|
46
38
|
alias_method :merged_granted_scopes, :mergedGrantedScopes
|
47
39
|
alias_method :merged_granted_scopes=, :mergedGrantedScopes=
|
48
40
|
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
attr_accessor :modifiedAt
|
42
|
+
alias_method :modified_at, :modifiedAt
|
43
|
+
alias_method :modified_at=, :modifiedAt=
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def defaults
|
48
|
+
super.merge(
|
49
|
+
serviceApiKey: nil,
|
50
|
+
clientId: 0,
|
51
|
+
subject: nil,
|
52
|
+
latestGrantedScopes: nil,
|
53
|
+
mergedGrantedScopes: nil,
|
54
|
+
modifiedAt: 0
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
def set_params(hash)
|
52
59
|
super(hash)
|
53
60
|
|
54
|
-
@serviceApiKey =
|
55
|
-
@clientId =
|
56
|
-
@subject =
|
57
|
-
@latestGrantedScopes =
|
58
|
-
@mergedGrantedScopes =
|
61
|
+
@serviceApiKey = hash[:serviceApiKey]
|
62
|
+
@clientId = hash[:clientId]
|
63
|
+
@subject = hash[:subject]
|
64
|
+
@latestGrantedScopes = hash[:latestGrantedScopes]
|
65
|
+
@mergedGrantedScopes = hash[:mergedGrantedScopes]
|
66
|
+
@modifiedAt = hash[:modifiedAt]
|
59
67
|
end
|
60
68
|
end
|
61
69
|
end
|
62
70
|
end
|
63
|
-
end
|
71
|
+
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.
|
@@ -18,102 +18,108 @@
|
|
18
18
|
module Authlete
|
19
19
|
module Model
|
20
20
|
module Response
|
21
|
-
# == Authlete::Model::Response::IntrospectionResponse class
|
22
|
-
#
|
23
|
-
# A class that represents a response from Authlete's
|
24
|
-
# /api/auth/introspection API.
|
25
21
|
class IntrospectionResponse < Authlete::Model::Result
|
26
|
-
|
27
|
-
|
22
|
+
include Authlete::Utility
|
23
|
+
|
28
24
|
attr_accessor :action
|
29
25
|
|
30
|
-
# The ID of the client application which is associated with
|
31
|
-
# the access token. (Integer)
|
32
26
|
attr_accessor :clientId
|
33
27
|
alias_method :client_id, :clientId
|
34
28
|
alias_method :client_id=, :clientId=
|
35
29
|
|
36
|
-
# The flag which indicates whether the client ID alias was used when
|
37
|
-
# the authorization request for the access token was made. (String)
|
38
30
|
attr_accessor :clientIdAlias
|
39
31
|
alias_method :client_id_alias, :clientIdAlias
|
40
32
|
alias_method :client_id_alias=, :clientIdAlias=
|
41
33
|
|
42
|
-
# The flag which indicates whether the client ID alias was used when
|
43
|
-
# the authorization request or the token request for the access token
|
44
|
-
# was made. (Boolean)
|
45
34
|
attr_accessor :clientIdAliasUsed
|
46
35
|
alias_method :client_id_alias_used, :clientIdAliasUsed
|
47
36
|
alias_method :client_id_alias_used=, :clientIdAliasUsed=
|
48
37
|
|
49
|
-
# The time at which the access token expires. (Integer)
|
50
38
|
attr_accessor :expiresAt
|
51
39
|
alias_method :expires_at, :expiresAt
|
52
40
|
alias_method :expires_at=, :expiresAt=
|
53
41
|
|
54
|
-
# The subject which is associated with the access token.
|
55
|
-
# This is <tt>nil</tt> if the access token was created
|
56
|
-
# through {Client Credentials Flow}[https://tools.ietf.org/html/rfc6749#section-4.4].
|
57
|
-
# (String)
|
58
42
|
attr_accessor :subject
|
59
43
|
|
60
|
-
# The scopes which is associated with the access token. (String array)
|
61
44
|
attr_accessor :scopes
|
62
45
|
|
63
|
-
# True when the access token exists. (Boolean)
|
64
46
|
attr_accessor :existent
|
47
|
+
alias_method :existent?, :existent
|
48
|
+
alias_method :exists, :existent
|
49
|
+
alias_method :exists?, :existent
|
50
|
+
alias_method :exist, :existent
|
51
|
+
alias_method :exist?, :existent
|
65
52
|
|
66
|
-
# True when the access token is usable (= exists and has not expired).
|
67
|
-
# (Boolean)
|
68
53
|
attr_accessor :usable
|
54
|
+
alias_method :usable?, :usable
|
69
55
|
|
70
|
-
# True when the access token covers all the scopes (if specified).
|
71
|
-
# (Boolean)
|
72
56
|
attr_accessor :sufficient
|
57
|
+
alias_method :sufficient?, :sufficient
|
73
58
|
|
74
|
-
# True when the access token can be refreshed using its corresponding
|
75
|
-
# refresh token. (Boolean)
|
76
59
|
attr_accessor :refreshable
|
60
|
+
alias_method :refreshable?, :refreshable
|
77
61
|
|
78
|
-
|
79
|
-
# should return to the client application. (String)
|
80
|
-
attr_accessor :response_content
|
62
|
+
attr_accessor :responseContent
|
81
63
|
alias_method :response_content, :responseContent
|
82
64
|
alias_method :response_content=, :responseContent=
|
83
65
|
|
84
|
-
# Extra properties associated with the access token. (Property array)
|
85
66
|
attr_accessor :properties
|
86
67
|
|
87
|
-
|
88
|
-
|
89
|
-
|
68
|
+
attr_accessor :certificateThumbprint
|
69
|
+
alias_method :certificate_thumbprint, :certificateThumbprint
|
70
|
+
alias_method :certificate_thumbprint=, :certificateThumbprint=
|
71
|
+
|
72
|
+
attr_accessor :resources
|
73
|
+
|
74
|
+
attr_accessor :accessTokenResources
|
75
|
+
alias_method :access_token_resources, :accessTokenResources
|
76
|
+
alias_method :access_token_resources=, :accessTokenResources=
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def defaults
|
81
|
+
super.merge(
|
82
|
+
action: nil,
|
83
|
+
clientId: 0,
|
84
|
+
clientIdAlias: nil,
|
85
|
+
clientIdAliasUsed: false,
|
86
|
+
expiresAt: 0,
|
87
|
+
subject: nil,
|
88
|
+
scopes: nil,
|
89
|
+
existent: false,
|
90
|
+
usable: false,
|
91
|
+
sufficient: false,
|
92
|
+
refreshable: false,
|
93
|
+
responseContent: nil,
|
94
|
+
properties: nil,
|
95
|
+
certificateThumbprint: nil,
|
96
|
+
resources: nil,
|
97
|
+
accessTokenResources: nil
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
def set_params(hash)
|
90
102
|
super(hash)
|
91
103
|
|
92
|
-
@action
|
93
|
-
@clientId
|
94
|
-
@clientIdAlias
|
95
|
-
@clientIdAliasUsed
|
96
|
-
@expiresAt
|
97
|
-
@subject
|
98
|
-
@scopes
|
99
|
-
@existent
|
100
|
-
@usable
|
101
|
-
@sufficient
|
102
|
-
@refreshable
|
103
|
-
@responseContent
|
104
|
-
@properties
|
105
|
-
|
106
|
-
|
104
|
+
@action = hash[:action]
|
105
|
+
@clientId = hash[:clientId]
|
106
|
+
@clientIdAlias = hash[:clientIdAlias]
|
107
|
+
@clientIdAliasUsed = hash[:clientIdAliasUsed]
|
108
|
+
@expiresAt = hash[:expiresAt]
|
109
|
+
@subject = hash[:subject]
|
110
|
+
@scopes = hash[:scopes]
|
111
|
+
@existent = hash[:existent]
|
112
|
+
@usable = hash[:usable]
|
113
|
+
@sufficient = hash[:sufficient]
|
114
|
+
@refreshable = hash[:refreshable]
|
115
|
+
@responseContent = hash[:responseContent]
|
116
|
+
@properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
|
117
|
+
@certificateThumbprint = hash[:certificateThumbprint]
|
118
|
+
@resources = hash[:resources]
|
119
|
+
@accessTokenResources = hash[:accessTokenResources]
|
107
120
|
end
|
108
121
|
|
109
|
-
|
110
|
-
alias_method :exists, :existent
|
111
|
-
alias_method :exists?, :existent
|
112
|
-
alias_method :exist, :existent
|
113
|
-
alias_method :exist?, :existent
|
114
|
-
alias_method :usable?, :usable
|
115
|
-
alias_method :sufficient?, :sufficient
|
116
|
-
alias_method :refreshable?, :refreshable
|
122
|
+
public
|
117
123
|
|
118
124
|
# Generate an array which is usable as a Rack response from this instance.
|
119
125
|
# When <tt>action</tt> method returns other value than 'OK', the array
|
@@ -161,4 +167,4 @@ module Authlete
|
|
161
167
|
end
|
162
168
|
end
|
163
169
|
end
|
164
|
-
end
|
170
|
+
end
|