authlete 0.5.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/authlete.rb +24 -1
- data/lib/authlete/api.rb +298 -146
- data/lib/authlete/authentication-server.rb +1 -1
- data/lib/authlete/exception.rb +6 -3
- data/lib/authlete/model/client-extension.rb +135 -135
- data/lib/authlete/model/client-list.rb +128 -128
- data/lib/authlete/model/client.rb +468 -468
- data/lib/authlete/model/hashable.rb +1 -1
- data/lib/authlete/model/pair.rb +102 -102
- data/lib/authlete/model/property.rb +116 -0
- data/lib/authlete/model/request/authentication-callback-request.rb +90 -90
- data/lib/authlete/model/request/authorization-fail-request.rb +107 -104
- data/lib/authlete/model/request/authorization-issue-request.rb +167 -133
- data/lib/authlete/model/request/authorization-request.rb +101 -101
- data/lib/authlete/model/request/client-authorization-delete-request.rb +123 -0
- data/lib/authlete/model/request/client-authorization-get-list-request.rb +123 -0
- data/lib/authlete/model/request/client-authorization-update-request.rb +118 -0
- data/lib/authlete/model/request/client-secret-update-request.rb +121 -0
- data/lib/authlete/model/request/developer-authentication-callback-request.rb +84 -84
- data/lib/authlete/model/request/granted-scopes-request.rb +103 -0
- data/lib/authlete/model/request/introspection-request.rb +117 -39
- data/lib/authlete/model/request/revocation-request.rb +125 -0
- data/lib/authlete/model/request/standard-introspection-request.rb +102 -0
- data/lib/authlete/model/request/token-create-request.rb +250 -0
- data/lib/authlete/model/request/token-fail-request.rb +104 -101
- data/lib/authlete/model/request/token-issue-request.rb +116 -101
- data/lib/authlete/model/request/token-request.rb +127 -121
- data/lib/authlete/model/request/token-update-request.rb +165 -0
- data/lib/authlete/model/request/user-info-issue-request.rb +113 -0
- data/lib/authlete/model/request/user-info-request.rb +102 -0
- data/lib/authlete/model/response/authentication-callback-response.rb +53 -53
- data/lib/authlete/model/response/authorization-fail-response.rb +48 -48
- data/lib/authlete/model/response/authorization-issue-response.rb +85 -48
- data/lib/authlete/model/response/authorization-response.rb +177 -164
- data/lib/authlete/model/response/client-authorization-get-list-response.rb +60 -0
- data/lib/authlete/model/response/client-secret-refresh-response.rb +48 -0
- data/lib/authlete/model/response/client-secret-update-response.rb +48 -0
- data/lib/authlete/model/response/developer-authentication-callback-response.rb +55 -55
- data/lib/authlete/model/response/granted-scopes-get-response.rb +63 -0
- data/lib/authlete/model/response/introspection-response.rb +163 -132
- data/lib/authlete/model/response/revocation-response.rb +49 -0
- data/lib/authlete/model/response/service-creatable-response.rb +50 -50
- data/lib/authlete/model/response/standard-introspection-response.rb +49 -0
- data/lib/authlete/model/response/token-create-response.rb +100 -0
- data/lib/authlete/model/response/token-fail-response.rb +49 -49
- data/lib/authlete/model/response/token-issue-response.rb +138 -49
- data/lib/authlete/model/response/token-response.rb +168 -70
- data/lib/authlete/model/response/token-update-response.rb +62 -0
- data/lib/authlete/model/response/user-info-issue-response.rb +47 -0
- data/lib/authlete/model/response/user-info-response.rb +85 -0
- data/lib/authlete/model/result.rb +44 -44
- data/lib/authlete/model/scope.rb +1 -1
- data/lib/authlete/model/service-list.rb +1 -1
- data/lib/authlete/model/service-owner.rb +1 -1
- data/lib/authlete/model/service.rb +4 -2
- data/lib/authlete/model/sns-credentials.rb +1 -1
- data/lib/authlete/model/tagged-value.rb +97 -97
- data/lib/authlete/utility.rb +1 -1
- data/lib/authlete/version.rb +2 -2
- metadata +24 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::RevicationResponse class
|
22
|
+
#
|
23
|
+
# This class represents a response from Authlete's /api/auth/revocation API.
|
24
|
+
class RevocationResponse < Authlete::Model::Result
|
25
|
+
# The next action that the service implementation should take.
|
26
|
+
# (String)
|
27
|
+
attr_accessor :action
|
28
|
+
|
29
|
+
# The response content which can be used to generate a response
|
30
|
+
# to the client application. The format of the value varies
|
31
|
+
# depending on the value of "action". (String)
|
32
|
+
attr_accessor :responseContent
|
33
|
+
alias_method :response_content, :responseContent
|
34
|
+
alias_method :response_content=, :responseContent=
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# The constructor which takes a hash that represents a JSON response
|
39
|
+
# from Authlete's /api/auth/revocation API.
|
40
|
+
def initialize(hash = {})
|
41
|
+
super(hash)
|
42
|
+
|
43
|
+
@action = extract_value(hash, :action)
|
44
|
+
@responseContent = extract_value(hash, :responseContent)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C)
|
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
|
-
# == Authlete::Model::Response::ServiceCreatableResponse class
|
22
|
-
class ServiceCreatableResponse
|
23
|
-
include Authlete::Utility
|
24
|
-
# A boolean flag to indicate whether the service owner can
|
25
|
-
# create a new service or not.
|
26
|
-
attr_accessor :creatable
|
27
|
-
|
28
|
-
# The number of services that the service owner currently has.
|
29
|
-
attr_accessor :count
|
30
|
-
|
31
|
-
# The maximum number of services allowed in the plan of the
|
32
|
-
# service owner.
|
33
|
-
attr_accessor :limit
|
34
|
-
|
35
|
-
# The plan of the service owner.
|
36
|
-
attr_accessor :plan
|
37
|
-
|
38
|
-
# The constructor which takes a hash that represents a JSON
|
39
|
-
# response from /api/service/creatable API.
|
40
|
-
def initialize(hash = {})
|
41
|
-
@creatable = extract_boolean_value(hash, :creatable)
|
42
|
-
@count =
|
43
|
-
@limit =
|
44
|
-
@plan = extract_value(hash, :plan)
|
45
|
-
end
|
46
|
-
|
47
|
-
alias_method :creatable?, :creatable
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::ServiceCreatableResponse class
|
22
|
+
class ServiceCreatableResponse
|
23
|
+
include Authlete::Utility
|
24
|
+
# A boolean flag to indicate whether the service owner can
|
25
|
+
# create a new service or not.
|
26
|
+
attr_accessor :creatable
|
27
|
+
|
28
|
+
# The number of services that the service owner currently has.
|
29
|
+
attr_accessor :count
|
30
|
+
|
31
|
+
# The maximum number of services allowed in the plan of the
|
32
|
+
# service owner.
|
33
|
+
attr_accessor :limit
|
34
|
+
|
35
|
+
# The plan of the service owner.
|
36
|
+
attr_accessor :plan
|
37
|
+
|
38
|
+
# The constructor which takes a hash that represents a JSON
|
39
|
+
# response from /api/service/creatable API.
|
40
|
+
def initialize(hash = {})
|
41
|
+
@creatable = extract_boolean_value(hash, :creatable)
|
42
|
+
@count = extract_integer_value(hash, :count)
|
43
|
+
@limit = extract_integer_value(hash, :limit)
|
44
|
+
@plan = extract_value(hash, :plan)
|
45
|
+
end
|
46
|
+
|
47
|
+
alias_method :creatable?, :creatable
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
51
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::StandardIntrospectionResponse class
|
22
|
+
#
|
23
|
+
# This class represents a response from Authlete's /api/auth/introspection/standard API.
|
24
|
+
class StandardIntrospectionResponse < Authlete::Model::Result
|
25
|
+
# The next action that the service implementation should take.
|
26
|
+
# (String)
|
27
|
+
attr_accessor :action
|
28
|
+
|
29
|
+
# The response content which can be used to generate a response
|
30
|
+
# to the client application. The format of the value varies
|
31
|
+
# depending on the value of "action". (String)
|
32
|
+
attr_accessor :responseContent
|
33
|
+
alias_method :response_content, :responseContent
|
34
|
+
alias_method :response_content=, :responseContent=
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# The constructor which takes a hash that represents a JSON response
|
39
|
+
# from Authlete's /api/auth/introspection/standard API.
|
40
|
+
def initialize(hash = {})
|
41
|
+
super(hash)
|
42
|
+
|
43
|
+
@action = extract_value(hash, :action)
|
44
|
+
@responseContent = extract_value(hash, :responseContent)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::TokenCreateResponse class
|
22
|
+
#
|
23
|
+
# A class that represents a response from Authlete's
|
24
|
+
# /api/auth/token/create API.
|
25
|
+
class TokenCreateResponse < Authlete::Model::Result
|
26
|
+
# The next action which the caller of the API should take next.
|
27
|
+
# (String)
|
28
|
+
attr_accessor :action
|
29
|
+
|
30
|
+
# The newly issued access token. (String)
|
31
|
+
attr_accessor :accessToken
|
32
|
+
alias_method :access_token, :accessToken
|
33
|
+
alias_method :access_token=, :accessToken=
|
34
|
+
|
35
|
+
# The ID of the client application which is associated with the access
|
36
|
+
# token. (Integer)
|
37
|
+
attr_accessor :clientId
|
38
|
+
alias_method :client_id, :clientId
|
39
|
+
alias_method :client_id=, :clientId=
|
40
|
+
|
41
|
+
# The time at which the access token expires. (Integer)
|
42
|
+
attr_accessor :expiresAt
|
43
|
+
alias_method :expires_at, :expiresAt
|
44
|
+
alias_method :expires_at=, :expiresAt=
|
45
|
+
|
46
|
+
# The duration of the newly issued access token in seconds. (Integer)
|
47
|
+
attr_accessor :expires_in
|
48
|
+
alias_method :expires_in, :expiresIn
|
49
|
+
alias_method :expires_in=, :expiresIn=
|
50
|
+
|
51
|
+
# The grant type for the newly issued access token. (String)
|
52
|
+
attr_accessor :grantType
|
53
|
+
alias_method :grant_type, :grantType
|
54
|
+
alias_method :grant_type=, :grantType=
|
55
|
+
|
56
|
+
# Extra properties associated with the access token. (Property array)
|
57
|
+
attr_accessor :properties
|
58
|
+
|
59
|
+
# The newly issued refresh token. (String)
|
60
|
+
attr_accessor :refreshToken
|
61
|
+
alias_method :refresh_token, :refreshToken
|
62
|
+
alias_method :refresh_token=, :refreshToken=
|
63
|
+
|
64
|
+
# The scopes which is associated with the access token. (String array)
|
65
|
+
attr_accessor :scopes
|
66
|
+
|
67
|
+
# The subject which is associated with the access token.
|
68
|
+
# This is <tt>nil</tt> if the access token was created
|
69
|
+
# through {Client Credentials Flow}[https://tools.ietf.org/html/rfc6749#section-4.4].
|
70
|
+
# (String)
|
71
|
+
attr_accessor :subject
|
72
|
+
|
73
|
+
# The token type of the access token. (String)
|
74
|
+
attr_accessor :tokenType
|
75
|
+
alias_method :token_type, :tokenType
|
76
|
+
alias_method :token_type=, :tokenType=
|
77
|
+
|
78
|
+
# The constructor which takes a hash that represents a JSON response
|
79
|
+
# from /api/auth/token/create API.
|
80
|
+
def initialize(hash = {})
|
81
|
+
super(hash)
|
82
|
+
|
83
|
+
@action = extract_value(hash, :action)
|
84
|
+
@accessToken = extract_value(hash, :accessToken)
|
85
|
+
@clientId = extract_integer_value(hash, :clientId)
|
86
|
+
@expiresAt = extract_integer_value(hash, :expiresAt)
|
87
|
+
@expiresIn = extract_integer_value(hash, :expiresIn)
|
88
|
+
@grantType = extract_value(hash, :grantType)
|
89
|
+
@properties = extract_array_value(hash, :scopes) do |element|
|
90
|
+
Authlete::Model::Property.parse(element)
|
91
|
+
end
|
92
|
+
@refreshToken = extract_value(hash, :refreshToken)
|
93
|
+
@scopes = extract_value(hash, :scopes)
|
94
|
+
@subject = extract_value(hash, :subject)
|
95
|
+
@tokenType = extract_value(hash, :tokenType)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-
|
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
|
-
# == Authlete::Model::Response::TokenFailRequest class
|
22
|
-
#
|
23
|
-
# This class represents a response from Authlete's /api/auth/token API.
|
24
|
-
class TokenFailRequest
|
25
|
-
include Authlete::Utility < Authlete::Model::Result
|
26
|
-
# The next action that the service implementation should take.
|
27
|
-
# (String)
|
28
|
-
attr_accessor :action
|
29
|
-
|
30
|
-
# The response content which can be used to generate a response
|
31
|
-
# to the client application. The format of the value varies
|
32
|
-
# depending on the value of "action". (String)
|
33
|
-
attr_accessor :responseContent
|
34
|
-
alias_method :response_content, :responseContent
|
35
|
-
alias_method :response_content=, :responseContent=
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
# The constructor which takes a hash that represents a JSON response
|
40
|
-
# from Authlete's /api/auth/token/fail API.
|
41
|
-
def initialize(hash = {})
|
42
|
-
super(hash)
|
43
|
-
|
44
|
-
@action = extract_value(hash, :action)
|
45
|
-
@responseContent = extract_value(hash, :responseContent)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::TokenFailRequest class
|
22
|
+
#
|
23
|
+
# This class represents a response from Authlete's /api/auth/token API.
|
24
|
+
class TokenFailRequest
|
25
|
+
include Authlete::Utility < Authlete::Model::Result
|
26
|
+
# The next action that the service implementation should take.
|
27
|
+
# (String)
|
28
|
+
attr_accessor :action
|
29
|
+
|
30
|
+
# The response content which can be used to generate a response
|
31
|
+
# to the client application. The format of the value varies
|
32
|
+
# depending on the value of "action". (String)
|
33
|
+
attr_accessor :responseContent
|
34
|
+
alias_method :response_content, :responseContent
|
35
|
+
alias_method :response_content=, :responseContent=
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# The constructor which takes a hash that represents a JSON response
|
40
|
+
# from Authlete's /api/auth/token/fail API.
|
41
|
+
def initialize(hash = {})
|
42
|
+
super(hash)
|
43
|
+
|
44
|
+
@action = extract_value(hash, :action)
|
45
|
+
@responseContent = extract_value(hash, :responseContent)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
50
|
end
|
@@ -1,50 +1,139 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-
|
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
|
-
# == Authlete::Model::Response::TokenIssueResponse class
|
22
|
-
#
|
23
|
-
# This class represents a response from Authlete's /api/auth/token/issue API.
|
24
|
-
class TokenIssueResponse < Authlete::Model::Result
|
25
|
-
include Authlete::Utility
|
26
|
-
# The next action that the service implementation should take.
|
27
|
-
# (String)
|
28
|
-
attr_accessor :action
|
29
|
-
|
30
|
-
# The response content which can be used to generate a response
|
31
|
-
# to the client application. The format of the value varies
|
32
|
-
# depending on the value of "action". (String)
|
33
|
-
attr_accessor :responseContent
|
34
|
-
alias_method :response_content, :responseContent
|
35
|
-
alias_method :response_content=, :responseContent=
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2018 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
|
+
# == Authlete::Model::Response::TokenIssueResponse class
|
22
|
+
#
|
23
|
+
# This class represents a response from Authlete's /api/auth/token/issue API.
|
24
|
+
class TokenIssueResponse < Authlete::Model::Result
|
25
|
+
include Authlete::Utility
|
26
|
+
# The next action that the service implementation should take.
|
27
|
+
# (String)
|
28
|
+
attr_accessor :action
|
29
|
+
|
30
|
+
# The response content which can be used to generate a response
|
31
|
+
# to the client application. The format of the value varies
|
32
|
+
# depending on the value of "action". (String)
|
33
|
+
attr_accessor :responseContent
|
34
|
+
alias_method :response_content, :responseContent
|
35
|
+
alias_method :response_content=, :responseContent=
|
36
|
+
|
37
|
+
# The newly issued access token. This parameter is a non-nil value
|
38
|
+
# only when the value of "action" parameter is "OK". (String)
|
39
|
+
attr_accessor :accessToken
|
40
|
+
alias_method :access_token, :accessToken
|
41
|
+
alias_method :access_token=, :accessToken=
|
42
|
+
|
43
|
+
# The datetime at which the newly issued access token will expire.
|
44
|
+
# The value is represented in milliseconds since the Unix epoch (1970-01-01).
|
45
|
+
# (Integer)
|
46
|
+
attr_accessor :accessTokenExpiresAt
|
47
|
+
alias_method :access_token_expires_at, :accessTokenExpiresAt
|
48
|
+
alias_method :access_token_expires_at=, :accessTokenExpiresAt=
|
49
|
+
|
50
|
+
# The duration of the newly issued access token in seconds. (Integer)
|
51
|
+
attr_accessor :accessTokenDuration
|
52
|
+
alias_method :access_token_duration, :accessTokenDuration
|
53
|
+
alias_method :access_token_duration=, :accessTokenDuration=
|
54
|
+
|
55
|
+
# The refresh token. This parameter is a non-nil value only when
|
56
|
+
# "action" = "OK" and the service supports the refresh token flow.
|
57
|
+
# If "Refresh Token Continuous Use" configuration parameter is "NO"
|
58
|
+
# (= refreshTokenKept=false), a new refresh token is issued and the
|
59
|
+
# old refresh token used in the refresh token flow is invalidated.
|
60
|
+
# On the contrary, if the configuration parameter is "YES", the refresh
|
61
|
+
# token itself is not refreshed. (String)
|
62
|
+
attr_accessor :refreshToken
|
63
|
+
alias_method :refresh_token, :refreshToken
|
64
|
+
alias_method :refresh_token=, :refreshToken=
|
65
|
+
|
66
|
+
# The datetime at which the newly issued refresh token will expire.
|
67
|
+
# The value is represented in milliseconds since the Unix epoch (1970-01-01).
|
68
|
+
# (Integer)
|
69
|
+
attr_accessor :refreshTokenExpiresAt
|
70
|
+
alias_method :refresh_token_expires_at, :refreshTokenExpiresAt
|
71
|
+
alias_method :refresh_token_expires_at=, :refreshTokenExpiresAt=
|
72
|
+
|
73
|
+
# The duration of the newly issued refresh token in seconds. (Integer)
|
74
|
+
attr_accessor :refreshTokenDuration
|
75
|
+
alias_method :refresh_token_duration, :refreshTokenDuration
|
76
|
+
alias_method :refresh_token_duration=, :refreshTokenDuration=
|
77
|
+
|
78
|
+
# The client ID. (Integer)
|
79
|
+
attr_accessor :clientId
|
80
|
+
alias_method :client_id, :clientId
|
81
|
+
alias_method :client_id=, :clientId=
|
82
|
+
|
83
|
+
# If the client did not have an alias, this parameter is nil. (String)
|
84
|
+
attr_accessor :clientIdAlias
|
85
|
+
alias_method :client_id_alias, :clientIdAlias
|
86
|
+
alias_method :client_id_alias=, :clientIdAlias=
|
87
|
+
|
88
|
+
# The flag which indicates whether the client ID alias was used when
|
89
|
+
# the token request was made. "true" if the client ID alias was used
|
90
|
+
# when the token request was made. (Boolean)
|
91
|
+
attr_accessor :clientIdAliasUsed
|
92
|
+
alias_method :client_id_alias_used, :clientIdAliasUsed
|
93
|
+
alias_method :client_id_alias_used=, :clientIdAliasUsed=
|
94
|
+
|
95
|
+
# The subject (= resource owner's ID) of the access token.
|
96
|
+
# Even if an access token has been issued by the call of /api/auth/token API,
|
97
|
+
# this parameter is "nil" if the flow of the token request was "Client Credentials Flow"
|
98
|
+
# (grant_type=client_credentials) because it means the access token
|
99
|
+
# is not associated with any specific end-user.
|
100
|
+
# (String)
|
101
|
+
attr_accessor :subject
|
102
|
+
|
103
|
+
# The scopes covered by the access token.
|
104
|
+
# (Scope array)
|
105
|
+
attr_accessor :scopes
|
106
|
+
|
107
|
+
# The extra properties associated with the access token.
|
108
|
+
# This parameter is "nil" when no extra property is associated with
|
109
|
+
# the issued access token.
|
110
|
+
attr_accessor :properties
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
# The constructor which takes a hash that represents a JSON response
|
115
|
+
# from Authlete's /api/auth/token/issue API.
|
116
|
+
def initialize(hash = {})
|
117
|
+
super(hash)
|
118
|
+
|
119
|
+
@action = extract_value(hash, :action)
|
120
|
+
@responseContent = extract_value(hash, :responseContent)
|
121
|
+
@accessToken = extract_value(hash, :accessToken)
|
122
|
+
@accessTokenExpiresAt = extract_integer_value(hash, :accessTokenExpiresAt)
|
123
|
+
@accessTokenDuration = extract_integer_value(hash, :accessTokenDuration)
|
124
|
+
@refreshToken = extract_value(hash, :refreshToken)
|
125
|
+
@refreshTokenExpiresAt = extract_integer_value(hash, :refreshTokenExpiresAt)
|
126
|
+
@refreshTokenDuration = extract_integer_value(hash, :refreshTokenDuration)
|
127
|
+
@clientId = extract_integer_value(hash, :clientId)
|
128
|
+
@clientIdAlias = extract_value(hash, :clientIdAlias)
|
129
|
+
@clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)
|
130
|
+
@subject = extract_value(hash, :subject)
|
131
|
+
@scopes = extract_value(hash, :scopes)
|
132
|
+
@properties = extract_array_value(hash, :scopes) do |element|
|
133
|
+
Authlete::Model::Property.parse(element)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
50
139
|
end
|