authlete 0.3.9 → 0.4.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 +14 -1
- data/lib/authlete/api.rb +4 -4
- data/lib/authlete/exception.rb +14 -13
- data/lib/authlete/model/request/authorization-fail-request.rb +1 -3
- data/lib/authlete/model/request/authorization-issue-request.rb +1 -3
- data/lib/authlete/model/request/authorization-request.rb +1 -3
- data/lib/authlete/model/request/introspection-request.rb +1 -1
- data/lib/authlete/model/request/token-fail-request.rb +1 -3
- data/lib/authlete/model/request/token-issue-request.rb +1 -3
- data/lib/authlete/model/request/token-request.rb +1 -3
- data/lib/authlete/model/response/authorization-fail-response.rb +6 -4
- data/lib/authlete/model/response/authorization-issue-response.rb +6 -4
- data/lib/authlete/model/response/authorization-response.rb +42 -23
- data/lib/authlete/model/response/introspection-response.rb +15 -11
- data/lib/authlete/model/response/service-creatable-response.rb +3 -3
- data/lib/authlete/model/response/token-fail-response.rb +6 -4
- data/lib/authlete/model/response/token-issue-response.rb +5 -3
- data/lib/authlete/model/response/token-response.rb +9 -7
- data/lib/authlete/model/result.rb +45 -0
- data/lib/authlete/model/scope.rb +1 -1
- data/lib/authlete/model/tagged-value.rb +1 -1
- data/lib/authlete/utility.rb +3 -3
- data/lib/authlete/version.rb +1 -1
- metadata +3 -3
- data/lib/authlete/model/response/result.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4bc0a21da39fb94266eff44862e6a1b2dc7b5e6
|
4
|
+
data.tar.gz: b2169c4bf562492b11edadea9a00b1841e7ed5a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e70219e541ceac628f810e297f3b458a9c617fd5b4206707de1ad96ce3517d4fa67d892e506ff2f1024c708cf276af16a1eb7e860792f2cce514e9b9486fcc05
|
7
|
+
data.tar.gz: 502e74de96cf12d92a228f984d67edec838e8b6609c61aa9d485bd779329c8088953e485a46a85e7b5c67dc526bd168ca667c359d2ff06f116b05c5724dd0157
|
data/lib/authlete.rb
CHANGED
@@ -32,6 +32,7 @@ module Authlete
|
|
32
32
|
autoload :Hashable, 'authlete/model/hashable'
|
33
33
|
autoload :Client, 'authlete/model/client'
|
34
34
|
autoload :ClientList, 'authlete/model/client-list'
|
35
|
+
autoload :Result, 'authlete/model/result'
|
35
36
|
autoload :Scope, 'authlete/model/scope'
|
36
37
|
autoload :Service, 'authlete/model/service'
|
37
38
|
autoload :ServiceList, 'authlete/model/service-list'
|
@@ -41,15 +42,27 @@ module Authlete
|
|
41
42
|
|
42
43
|
module Request
|
43
44
|
autoload :AuthenticationCallbackRequest, 'authlete/model/request/authentication-callback-request'
|
45
|
+
autoload :AuthorizationFailRequest, 'authlete/model/request/authorization-fail-request'
|
46
|
+
autoload :AuthorizationIssueRequest, 'authlete/model/request/authorization-issue-request'
|
47
|
+
autoload :AuthorizationRequest, 'authlete/model/request/authorization-request'
|
44
48
|
autoload :DeveloperAuthenticationCallbackRequest, 'authlete/model/request/developer-authentication-callback-request'
|
49
|
+
autoload :IntrospectionRequest, 'authlete/model/request/introspection-request'
|
50
|
+
autoload :TokenFailRequest, 'authlete/model/request/token-fail-request'
|
51
|
+
autoload :TokenIssueRequest, 'authlete/model/request/token-issue-request'
|
52
|
+
autoload :TokenReqeust, 'authlete/model/request/token-request'
|
45
53
|
end
|
46
54
|
|
47
55
|
module Response
|
48
56
|
autoload :AuthenticationCallbackResponse, 'authlete/model/response/authentication-callback-response'
|
49
|
-
autoload :
|
57
|
+
autoload :AuthorizationFailResponse, 'authlete/model/response/authorization-fail-response'
|
58
|
+
autoload :AuthorizationIssueResponse, 'authlete/model/response/authorization-issue-response'
|
59
|
+
autoload :AuthorizationResponse, 'authlete/model/response/authorization-response'
|
50
60
|
autoload :DeveloperAuthenticationCallbackResponse, 'authlete/model/response/developer-authentication-callback-response'
|
51
61
|
autoload :IntrospectionResponse, 'authlete/model/response/introspection-response'
|
52
62
|
autoload :ServiceCreatableResponse, 'authlete/model/response/service-creatable-response'
|
63
|
+
autoload :TokenFailResponse, 'authlete/model/response/token-fail-response'
|
64
|
+
autoload :TokenIssueResponse, 'authlete/model/response/token-issue-response'
|
65
|
+
autoload :TokenResponse, 'authlete/model/response/token-response'
|
53
66
|
end
|
54
67
|
end
|
55
68
|
end
|
data/lib/authlete/api.rb
CHANGED
@@ -121,8 +121,8 @@ module Authlete
|
|
121
121
|
|
122
122
|
# Raise an error with 'status_code' and the original error message.
|
123
123
|
raise Authlete::Exception.new(
|
124
|
-
:message
|
125
|
-
:
|
124
|
+
:message => message,
|
125
|
+
:statusCode => status_code
|
126
126
|
)
|
127
127
|
end
|
128
128
|
|
@@ -132,8 +132,8 @@ module Authlete
|
|
132
132
|
rescue
|
133
133
|
# Failed to parse the response body as a json.
|
134
134
|
raise Authlete::Exception.new(
|
135
|
-
:message
|
136
|
-
:
|
135
|
+
:message => message,
|
136
|
+
:statusCode => status_code
|
137
137
|
)
|
138
138
|
end
|
139
139
|
end
|
data/lib/authlete/exception.rb
CHANGED
@@ -17,28 +17,29 @@
|
|
17
17
|
|
18
18
|
module Authlete
|
19
19
|
class Exception < StandardError
|
20
|
-
|
21
|
-
attr_reader :status_code
|
20
|
+
include Authlete::Utility
|
22
21
|
|
23
|
-
# The code of the
|
24
|
-
|
22
|
+
# The HTTP status code of the error.
|
23
|
+
attr_accessor :statusCode
|
24
|
+
alias_method :status_code, :statusCode
|
25
|
+
alias_method :status_code=, :statusCode=
|
25
26
|
|
26
|
-
# The
|
27
|
-
|
27
|
+
# The result of the API call.
|
28
|
+
attr_accessor :result
|
28
29
|
|
29
30
|
private
|
30
31
|
|
31
32
|
def initialize(hash = {})
|
32
|
-
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
33
|
+
# The error message from RestClient or the other general exceptions.
|
34
|
+
@message = extract_value(hash, :message)
|
35
|
+
@statusCode = extract_integer_value(hash, :statusCode)
|
36
|
+
@result = Authlete::Model::Result.new(hash)
|
36
37
|
end
|
37
38
|
|
38
39
|
public
|
39
40
|
|
40
41
|
def message
|
41
|
-
@
|
42
|
+
@result.resultMessage || @message || self.class.default_message
|
42
43
|
end
|
43
44
|
|
44
45
|
def self.default_message
|
@@ -46,8 +47,8 @@ module Authlete
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def to_s
|
49
|
-
"#{self.class.default_message} => {
|
50
|
-
"
|
50
|
+
"#{self.class.default_message} => { message:'#{@message}', status_code:'#{@statusCode}', " +
|
51
|
+
"result_code:'#{@result.resultCode}', result_message:'#{@result.resultMessage}' }"
|
51
52
|
end
|
52
53
|
end
|
53
54
|
end
|
@@ -38,9 +38,7 @@ module Authlete
|
|
38
38
|
|
39
39
|
# The constructor which takes a hash that represents a JSON request to
|
40
40
|
# Authlete's /api/auth/authorization/fail API.
|
41
|
-
def initialize(hash =
|
42
|
-
super
|
43
|
-
|
41
|
+
def initialize(hash = nil)
|
44
42
|
# Set default values to string attributes.
|
45
43
|
STRING_ATTRIBUTES.each do |attr|
|
46
44
|
send("#{attr}=", nil)
|
@@ -54,9 +54,7 @@ module Authlete
|
|
54
54
|
|
55
55
|
# The constructor which takes a hash that represents a JSON request to
|
56
56
|
# Authlete's /api/auth/authorization/issue API.
|
57
|
-
def initialize(hash =
|
58
|
-
super
|
59
|
-
|
57
|
+
def initialize(hash = nil)
|
60
58
|
# Set default values to integer attributes.
|
61
59
|
INTEGER_ATTRIBUTES.each do |attr|
|
62
60
|
send("#{attr}=", 0)
|
@@ -35,9 +35,7 @@ module Authlete
|
|
35
35
|
|
36
36
|
# The constructor which takes a hash that represents a JSON request to
|
37
37
|
# Authlete's /api/auth/authorization API.
|
38
|
-
def initialize(hash =
|
39
|
-
super
|
40
|
-
|
38
|
+
def initialize(hash = nil)
|
41
39
|
# Set default values to string attributes.
|
42
40
|
STRING_ATTRIBUTES.each do |attr|
|
43
41
|
send("#{attr}=", nil)
|
@@ -25,7 +25,7 @@ module Authlete
|
|
25
25
|
include Authlete::Utility
|
26
26
|
# The constructor which takes a hash that represents a JSON request
|
27
27
|
# to Authlete's /api/auth/introspection API.
|
28
|
-
def initialize(hash =
|
28
|
+
def initialize(hash = nil)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Parse a JSON string which represents a request to
|
@@ -35,9 +35,7 @@ module Authlete
|
|
35
35
|
|
36
36
|
# The constructor which takes a hash that represents a JSON request to
|
37
37
|
# Authlete's /api/auth/token/fail API.
|
38
|
-
def initialize(hash =
|
39
|
-
super
|
40
|
-
|
38
|
+
def initialize(hash = nil)
|
41
39
|
# Set default values to string attributes.
|
42
40
|
STRING_ATTRIBUTES.each do |attr|
|
43
41
|
send("#{attr}=", nil)
|
@@ -35,9 +35,7 @@ module Authlete
|
|
35
35
|
|
36
36
|
# The constructor which takes a hash that represents a JSON request to
|
37
37
|
# Authlete's /api/auth/token/issue API.
|
38
|
-
def initialize(hash =
|
39
|
-
super
|
40
|
-
|
38
|
+
def initialize(hash = nil)
|
41
39
|
# Set default values to string attributes.
|
42
40
|
STRING_ATTRIBUTES.each do |attr|
|
43
41
|
send("#{attr}=", nil)
|
@@ -48,9 +48,7 @@ module Authlete
|
|
48
48
|
|
49
49
|
# The constructor which takes a hash that represents a JSON request
|
50
50
|
# to Authlete's /api/auth/token API.
|
51
|
-
def initialize(hash =
|
52
|
-
super
|
53
|
-
|
51
|
+
def initialize(hash = nil)
|
54
52
|
# Set default values to string attributes.
|
55
53
|
STRING_ATTRIBUTES.each do |attr|
|
56
54
|
send("#{attr}=", nil)
|
@@ -21,7 +21,7 @@ module Authlete
|
|
21
21
|
# == Authlete::Model::Response::AuthorizationFailResponse class
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/authorization/fail API.
|
24
|
-
class AuthorizationFailResponse < Authlete::Model::
|
24
|
+
class AuthorizationFailResponse < Authlete::Model::Result
|
25
25
|
# The next action that the service implementation should take.
|
26
26
|
# (String)
|
27
27
|
attr_accessor :action
|
@@ -29,7 +29,9 @@ module Authlete
|
|
29
29
|
# The response content which can be used to generate a response
|
30
30
|
# to the client application. The format of the value varies
|
31
31
|
# depending on the value of "action". (String)
|
32
|
-
attr_accessor :
|
32
|
+
attr_accessor :responseContent
|
33
|
+
alias_method :response_content, :responseContent
|
34
|
+
alias_method :response_content=, :responseContent=
|
33
35
|
|
34
36
|
private
|
35
37
|
|
@@ -38,8 +40,8 @@ module Authlete
|
|
38
40
|
def initialize(hash = {})
|
39
41
|
super(hash)
|
40
42
|
|
41
|
-
@action
|
42
|
-
@
|
43
|
+
@action = extract_value(hash, :action)
|
44
|
+
@responseContent = extract_value(hash, :responseContent)
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
@@ -21,7 +21,7 @@ module Authlete
|
|
21
21
|
# == Authlete::Model::Response::AuthorizationIssueResponse class
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/authorization/issue API.
|
24
|
-
class AuthorizationIssueResponse < Authlete::Model::
|
24
|
+
class AuthorizationIssueResponse < Authlete::Model::Result
|
25
25
|
# The next action that the service implementation should take.
|
26
26
|
# (String)
|
27
27
|
attr_accessor :action
|
@@ -29,7 +29,9 @@ module Authlete
|
|
29
29
|
# The response content which can be used to generate a response
|
30
30
|
# to the client application. The format of the value varies
|
31
31
|
# depending on the value of "action". (String)
|
32
|
-
attr_accessor :
|
32
|
+
attr_accessor :responseContent
|
33
|
+
alias_method :response_content, :responseContent
|
34
|
+
alias_method :response_content=, :responseContent=
|
33
35
|
|
34
36
|
private
|
35
37
|
|
@@ -38,8 +40,8 @@ module Authlete
|
|
38
40
|
def initialize(hash = {})
|
39
41
|
super(hash)
|
40
42
|
|
41
|
-
@action
|
42
|
-
@
|
43
|
+
@action = extract_value(hash, :action)
|
44
|
+
@responseContent = extract_value(hash, :responseContent)
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
@@ -21,10 +21,12 @@ module Authlete
|
|
21
21
|
# == Authlete::Model::Response::AuthorizationResponse class
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/authorization API.
|
24
|
-
class AuthorizationResponse < Authlete::Model::
|
24
|
+
class AuthorizationResponse < Authlete::Model::Result
|
25
25
|
# The flag which indicates whether the end-user authentication
|
26
26
|
# must satisfy one of the requested ACRs. (BOOLEAN)
|
27
|
-
attr_accessor :
|
27
|
+
attr_accessor :acrEssential
|
28
|
+
alias_method :acr_essential, :acrEssential
|
29
|
+
alias_method :acr_essential=, :acrEssential=
|
28
30
|
|
29
31
|
# The list of ACRs (Authentication Context Class References)
|
30
32
|
# requested by the client application.
|
@@ -41,7 +43,9 @@ module Authlete
|
|
41
43
|
# The list of preferred languages and scripts for claim
|
42
44
|
# values contained in the ID token. The value comes from
|
43
45
|
# "claims_locales" request parameter. (String array)
|
44
|
-
attr_accessor :
|
46
|
+
attr_accessor :claimLocales
|
47
|
+
alias_method :claim_locales, :claimLocales
|
48
|
+
alias_method :claim_locales=, :claimLocales=
|
45
49
|
|
46
50
|
# The list of claims that the client application requests
|
47
51
|
# to be embedded in the ID token. The value comes from
|
@@ -63,14 +67,18 @@ module Authlete
|
|
63
67
|
# The value of login hint, which is specified by the client
|
64
68
|
# application using "login_hint" request parameter.
|
65
69
|
# (String)
|
66
|
-
attr_accessor :
|
70
|
+
attr_accessor :loginHint
|
71
|
+
alias_method :login_hint, :loginHint
|
72
|
+
alias_method :login_hint=, :loginHint=
|
67
73
|
|
68
74
|
# The prompt that the UI displayed to the end-user must satisfy
|
69
75
|
# at least. The value comes from "prompt" request parameter.
|
70
76
|
# When the authorization request does not contain "prompt"
|
71
77
|
# parameter, this method returns "CONSENT CONSENT" as
|
72
78
|
# the default value. (String)
|
73
|
-
attr_accessor :
|
79
|
+
attr_accessor :lowestPrompt
|
80
|
+
alias_method :lowest_prompt, :lowestPrompt
|
81
|
+
alias_method :lowest_prompt=, :lowestPrompt=
|
74
82
|
|
75
83
|
# The maximum authentication age which is the allowable
|
76
84
|
# elapsed time in seconds since the last time the end-user
|
@@ -80,12 +88,20 @@ module Authlete
|
|
80
88
|
# the client application. 0 may be returned which means
|
81
89
|
# that the max age constraint does not have to be imposed.
|
82
90
|
# (Integer)
|
83
|
-
attr_accessor :
|
91
|
+
attr_accessor :maxAge
|
92
|
+
alias_method :max_age, :maxAge
|
93
|
+
alias_method :max_age=, :maxAge=
|
84
94
|
|
85
95
|
# The response content which can be used to generate a response
|
86
96
|
# to the client application. The format of the value varies
|
87
97
|
# depending on the value of "action". (String)
|
88
|
-
attr_accessor :
|
98
|
+
attr_accessor :responseContent
|
99
|
+
alias_method :response_content, :responseContent
|
100
|
+
alias_method :response_content=, :responseContent=
|
101
|
+
|
102
|
+
# The information about the service to which the authorization request
|
103
|
+
# has been made. (Service)
|
104
|
+
attr_accessor :service
|
89
105
|
|
90
106
|
# The scopes which the client application requests by "scope"
|
91
107
|
# request parameter. When the authorization request does
|
@@ -113,7 +129,9 @@ module Authlete
|
|
113
129
|
# The list of preferred languages and scripts for the user
|
114
130
|
# interface. The value comes from "ui_locales" request
|
115
131
|
# parameter. (String array)
|
116
|
-
attr_accessor :
|
132
|
+
attr_accessor :uiLocales
|
133
|
+
alias_method :ui_locales, :uiLocales
|
134
|
+
alias_method :ui_locales=, :uiLocales=
|
117
135
|
|
118
136
|
private
|
119
137
|
|
@@ -122,23 +140,24 @@ module Authlete
|
|
122
140
|
def initialize(hash = {})
|
123
141
|
super(hash)
|
124
142
|
|
125
|
-
@
|
126
|
-
@acrs
|
127
|
-
@action
|
128
|
-
@
|
129
|
-
@claims
|
130
|
-
@client
|
131
|
-
@display
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
@
|
136
|
-
@
|
143
|
+
@acrEssential = extract_value(hash, :acrEssential)
|
144
|
+
@acrs = extract_value(hash, :acrs)
|
145
|
+
@action = extract_value(hash, :action)
|
146
|
+
@claimLocales = extract_value(hash, :claimLocales)
|
147
|
+
@claims = extract_value(hash, :claims)
|
148
|
+
@client = Authlete::Model::Client.new(extract_value(hash, :client))
|
149
|
+
@display = extract_value(hash, :display)
|
150
|
+
@loginHint = extract_value(hash, :loginHint)
|
151
|
+
@lowestPrompt = extract_value(hash, :lowestPrompt)
|
152
|
+
@maxAge = extract_value(hash, :maxAge)
|
153
|
+
@responseContent = extract_value(hash, :responseContent)
|
154
|
+
@service = Authlete::Model::Service.new(extract_value(hash, :service))
|
155
|
+
@scopes = extract_array_value(hash, :scopes) do |element|
|
137
156
|
Authlete::Model::Scope.parse(element)
|
138
157
|
end
|
139
|
-
@subject
|
140
|
-
@ticket
|
141
|
-
@
|
158
|
+
@subject = extract_value(hash, :subject)
|
159
|
+
@ticket = extract_value(hash, :ticket)
|
160
|
+
@uiLocales = extract_value(hash, :uiLocales)
|
142
161
|
end
|
143
162
|
end
|
144
163
|
end
|
@@ -22,13 +22,15 @@ module Authlete
|
|
22
22
|
#
|
23
23
|
# A class that represents a response from Authlete's
|
24
24
|
# /api/auth/introspection API.
|
25
|
-
class IntrospectionResponse < Authlete::Model::
|
25
|
+
class IntrospectionResponse < Authlete::Model::Result
|
26
26
|
# The next action which the caller of the API should take next.
|
27
27
|
attr_accessor :action
|
28
28
|
|
29
29
|
# The ID of the client application which is associated with
|
30
30
|
# the access token.
|
31
|
-
attr_accessor :
|
31
|
+
attr_accessor :clientId
|
32
|
+
alias_method :client_id, :clientId
|
33
|
+
alias_method :client_id=, :clientId=
|
32
34
|
|
33
35
|
# The subject which is associated with the access token.
|
34
36
|
# This is <tt>nil</tt> if the access token was created
|
@@ -54,21 +56,23 @@ module Authlete
|
|
54
56
|
# The content of the error response that the service implementation
|
55
57
|
# should return to the client application.
|
56
58
|
attr_accessor :response_content
|
59
|
+
alias_method :response_content, :responseContent
|
60
|
+
alias_method :response_content=, :responseContent=
|
57
61
|
|
58
62
|
# The constructor which takes a hash that represents a JSON response
|
59
63
|
# from /api/auth/introspection API.
|
60
64
|
def initialize(hash = {})
|
61
65
|
super(hash)
|
62
66
|
|
63
|
-
@action
|
64
|
-
@
|
65
|
-
@subject
|
66
|
-
@scopes
|
67
|
-
@existent
|
68
|
-
@usable
|
69
|
-
@sufficient
|
70
|
-
@refreshable
|
71
|
-
@
|
67
|
+
@action = extract_value(hash, :action)
|
68
|
+
@clientId = extract_value(hash, :clientId)
|
69
|
+
@subject = extract_value(hash, :subject)
|
70
|
+
@scopes = extract_value(hash, :scopes)
|
71
|
+
@existent = extract_boolean_value(hash, :existent)
|
72
|
+
@usable = extract_boolean_value(hash, :usable)
|
73
|
+
@sufficient = extract_boolean_value(hash, :sufficient)
|
74
|
+
@refreshable = extract_boolean_value(hash, :refreshable)
|
75
|
+
@responseContent = extract_value(hash, :responseContent)
|
72
76
|
end
|
73
77
|
|
74
78
|
alias_method :existent?, :existent
|
@@ -39,9 +39,9 @@ module Authlete
|
|
39
39
|
# response from /api/service/creatable API.
|
40
40
|
def initialize(hash = {})
|
41
41
|
@creatable = extract_boolean_value(hash, :creatable)
|
42
|
-
@count = extract_value(hash, :count)
|
43
|
-
@limit = extract_value(hash, :limit)
|
44
|
-
@plan = extract_value(hash, :plan)
|
42
|
+
@count = extract_value(hash, :count)
|
43
|
+
@limit = extract_value(hash, :limit)
|
44
|
+
@plan = extract_value(hash, :plan)
|
45
45
|
end
|
46
46
|
|
47
47
|
alias_method :creatable?, :creatable
|
@@ -22,7 +22,7 @@ module Authlete
|
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/token API.
|
24
24
|
class TokenFailRequest
|
25
|
-
include Authlete::Utility < Authlete::Model::
|
25
|
+
include Authlete::Utility < Authlete::Model::Result
|
26
26
|
# The next action that the service implementation should take.
|
27
27
|
# (String)
|
28
28
|
attr_accessor :action
|
@@ -30,7 +30,9 @@ module Authlete
|
|
30
30
|
# The response content which can be used to generate a response
|
31
31
|
# to the client application. The format of the value varies
|
32
32
|
# depending on the value of "action". (String)
|
33
|
-
attr_accessor :
|
33
|
+
attr_accessor :responseContent
|
34
|
+
alias_method :response_content, :responseContent
|
35
|
+
alias_method :response_content=, :responseContent=
|
34
36
|
|
35
37
|
private
|
36
38
|
|
@@ -39,8 +41,8 @@ module Authlete
|
|
39
41
|
def initialize(hash = {})
|
40
42
|
super(hash)
|
41
43
|
|
42
|
-
@action
|
43
|
-
@
|
44
|
+
@action = extract_value(hash, :action)
|
45
|
+
@responseContent = extract_value(hash, :responseContent)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -21,7 +21,7 @@ module Authlete
|
|
21
21
|
# == Authlete::Model::Response::TokenIssueResponse class
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/token/issue API.
|
24
|
-
class TokenIssueResponse < Authlete::Model::
|
24
|
+
class TokenIssueResponse < Authlete::Model::Result
|
25
25
|
include Authlete::Utility
|
26
26
|
# The next action that the service implementation should take.
|
27
27
|
# (String)
|
@@ -30,7 +30,9 @@ module Authlete
|
|
30
30
|
# The response content which can be used to generate a response
|
31
31
|
# to the client application. The format of the value varies
|
32
32
|
# depending on the value of "action". (String)
|
33
|
-
attr_accessor :
|
33
|
+
attr_accessor :responseContent
|
34
|
+
alias_method :response_content, :responseContent
|
35
|
+
alias_method :response_content=, :responseContent=
|
34
36
|
|
35
37
|
private
|
36
38
|
|
@@ -40,7 +42,7 @@ module Authlete
|
|
40
42
|
super(hash)
|
41
43
|
|
42
44
|
@action = extract_value(hash, :action)
|
43
|
-
@
|
45
|
+
@responseContent = extract_value(hash, :responseContent)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -21,7 +21,7 @@ module Authlete
|
|
21
21
|
# == Authlete::Model::Response::TokenResponse class
|
22
22
|
#
|
23
23
|
# This class represents a response from Authlete's /api/auth/token API.
|
24
|
-
class TokenResponse < Authlete::Model::
|
24
|
+
class TokenResponse < Authlete::Model::Result
|
25
25
|
include Authlete::Utility
|
26
26
|
# The next action that the service implementation should take.
|
27
27
|
# (String)
|
@@ -36,7 +36,9 @@ module Authlete
|
|
36
36
|
# The response content which can be used to generate a response
|
37
37
|
# to the client application. The format of the value varies
|
38
38
|
# depending on the value of "action". (String)
|
39
|
-
attr_accessor :
|
39
|
+
attr_accessor :responseContent
|
40
|
+
alias_method :response_content, :responseContent
|
41
|
+
alias_method :response_content=, :responseContent=
|
40
42
|
|
41
43
|
# The ticket issued from Authlete's /api/auth/token endpoint.
|
42
44
|
# This parameter is to be used as "ticket" request parameter
|
@@ -57,11 +59,11 @@ module Authlete
|
|
57
59
|
def initialize(hash = {})
|
58
60
|
super(hash)
|
59
61
|
|
60
|
-
@action
|
61
|
-
@
|
62
|
-
@password
|
63
|
-
@ticket
|
64
|
-
@username
|
62
|
+
@action = extract_value(hash, :action)
|
63
|
+
@responseContent = extract_value(hash, :responseContent)
|
64
|
+
@password = extract_value(hash, :password)
|
65
|
+
@ticket = extract_value(hash, :ticket)
|
66
|
+
@username = extract_value(hash, :username)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# :nodoc:
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014-2015 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
|
+
# == Authlete::Model::Result
|
21
|
+
#
|
22
|
+
# The base class of responses from Authlete Web APIs.
|
23
|
+
class Result
|
24
|
+
include Authlete::Utility
|
25
|
+
# The code assigned to the result of the API call.
|
26
|
+
# (String)
|
27
|
+
attr_accessor :resultCode
|
28
|
+
alias_method :result_code, :resultCode
|
29
|
+
alias_method :result_code=, :resultCode=
|
30
|
+
|
31
|
+
# The message about the result of the API call.
|
32
|
+
# (String)
|
33
|
+
attr_accessor :resultMessage
|
34
|
+
alias_method :result_message, :resultMessage
|
35
|
+
alias_method :result_message=, :resultMessage=
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def initialize(hash = {})
|
40
|
+
@resultCode = extract_value(hash, :resultCode)
|
41
|
+
@resultMessage = extract_value(hash, :resultMessage)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/authlete/model/scope.rb
CHANGED
@@ -45,7 +45,7 @@ module Authlete
|
|
45
45
|
SNAKE_TO_CAMEL = { :default_entry => :defaultEntry }
|
46
46
|
|
47
47
|
# The constructor
|
48
|
-
def initialize(hash =
|
48
|
+
def initialize(hash = nil)
|
49
49
|
# Set default values to boolean attributes.
|
50
50
|
BOOLEAN_ATTRIBUTES.each do |attr|
|
51
51
|
send("#{attr}=", false)
|
data/lib/authlete/utility.rb
CHANGED
@@ -56,7 +56,7 @@ module Authlete
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def get_parsed_array(array)
|
59
|
-
if array.nil? or (array.kind_of?(Array) == false) or (array.
|
59
|
+
if array.nil? or (array.kind_of?(Array) == false) or (array.empty?)
|
60
60
|
return nil
|
61
61
|
end
|
62
62
|
|
@@ -67,7 +67,7 @@ module Authlete
|
|
67
67
|
elements.push(parsed_element) unless parsed_element.nil?
|
68
68
|
end
|
69
69
|
|
70
|
-
elements.
|
70
|
+
elements.empty? ? nil : elements
|
71
71
|
end
|
72
72
|
|
73
73
|
def to_rack_response_json(status_code, content)
|
@@ -96,4 +96,4 @@ module Authlete
|
|
96
96
|
]
|
97
97
|
end
|
98
98
|
end
|
99
|
-
end
|
99
|
+
end
|
data/lib/authlete/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authlete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiko Kawasaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -89,11 +89,11 @@ files:
|
|
89
89
|
- lib/authlete/model/response/authorization-response.rb
|
90
90
|
- lib/authlete/model/response/developer-authentication-callback-response.rb
|
91
91
|
- lib/authlete/model/response/introspection-response.rb
|
92
|
-
- lib/authlete/model/response/result.rb
|
93
92
|
- lib/authlete/model/response/service-creatable-response.rb
|
94
93
|
- lib/authlete/model/response/token-fail-response.rb
|
95
94
|
- lib/authlete/model/response/token-issue-response.rb
|
96
95
|
- lib/authlete/model/response/token-response.rb
|
96
|
+
- lib/authlete/model/result.rb
|
97
97
|
- lib/authlete/model/scope.rb
|
98
98
|
- lib/authlete/model/service-list.rb
|
99
99
|
- lib/authlete/model/service-owner.rb
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2015 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::BaseResponse
|
22
|
-
#
|
23
|
-
# The base class of responses from Authlete Web APIs.
|
24
|
-
class Result
|
25
|
-
include Authlete::Utility
|
26
|
-
# The code assigned to the result of the API call.
|
27
|
-
# (String)
|
28
|
-
attr_accessor :result_code
|
29
|
-
|
30
|
-
# The message about the result of the API call.
|
31
|
-
# (String)
|
32
|
-
attr_accessor :result_message
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
# The constructor which takes a hash that represents a JSON response
|
37
|
-
# from /api/auth/introspection API.
|
38
|
-
def initialize(hash = {})
|
39
|
-
@result_code = extract_value(hash, :resultCode)
|
40
|
-
@response_content = extract_value(hash, :responseContent)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|