authlete 0.1.7 → 0.1.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTFhYmMxZjUyM2ExYjdkOGI5MzY1NDAyMDA5YjE4NGNlMGQ2M2U0ZA==
4
+ YzFlNzMwMjg5NmRlNDkzNzMyZmEwNGNiNTVmNTYzNTZkZGYxZmE1Nw==
5
5
  data.tar.gz: !binary |-
6
- NDM4YzkzMGM1ZWIzYjNhMTEwZjc5MTQ5MzhhZGY5YzFkOGQ1MDdmZg==
6
+ Nzk3N2FkNTZlZWI1NDQ5NDkxMTA1Y2FlZmE4NTE1YjY1ZDc0NmQ5NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmIzMWQxNTNhNmVlYTI4ZGEzYjBjZWQ2YTkyMTliMzA4YjA5ZjlkODg2ZWQ3
10
- MTBmMzkyMzJiNTM2ZmZkNzJhOGE3ZWNhY2RhZWQzM2QzNTMzYTE5NjAwODg1
11
- OGIyMzZjYmE2ZjViYzZiMzkzNzI3YWQzOTA2MmZjZDgxY2I4ZDA=
9
+ ZmVmNjE0YzI3YjdjNWZjZGY2N2QyMWYwMDk4NGY0ODY5NTUxMjNiYjQ3ZGU1
10
+ NTdmYTVkOGE2YmMxZTNmZmM2Zjc0MmIzNzQ4OGM1NTQzMGYwMDc4ZjY2Zjlm
11
+ NDMwNzAwZGE3MTA0YWQ2ZDFmN2MzNjgyZDllZDkxODhjNzkyM2Y=
12
12
  data.tar.gz: !binary |-
13
- ODAwZTk1OWMwZjBjNGJiZGZjMWFmNDhmMGVjZGRjYmRiNjcwODY3YjYxNjk1
14
- NmNmMmQ4ZmRjOTA1ZDNiNmU3NjcxODM5YzFkMjM0MGFmMjUzYTc2MjM3OWI0
15
- ZjM0ODk5MzMyYTJhNDM2ZDNjNjVjYWVkODdkMDRiYTViNzIzMjU=
13
+ ZGY3NmE1YmMwZmY4YzhmMmI3YWI4YmIyNjUxOTc4OGZiZTVjYWJkMTIxODNi
14
+ OWM2NmFkZGUwMjc4ODJlNWQyZjc1ZDI5ODdkZWRlNzc2ZjUwZDQ1NGNlYTQy
15
+ Y2ExYTk0ZjY1MTM0ZTVlMzJlMTFlODU5YjJiYWFiYTcwMTU1ZjQ=
data/lib/authlete.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014 Authlete, Inc.
3
+ # Copyright (C) 2014-2015 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.
@@ -41,11 +41,13 @@ module Authlete
41
41
 
42
42
  module Request
43
43
  autoload :AuthenticationCallbackRequest, 'authlete/request/authentication-callback-request'
44
+ autoload :DeveloperAuthenticationCallbackRequest, 'authlete/request/developer-authentication-callback-request'
44
45
  end
45
46
 
46
47
  module Response
47
48
  autoload :AuthenticationCallbackResponse, 'authlete/response/authentication-callback-response'
48
49
  autoload :BaseResponse, 'authlete/response/base-response'
50
+ autoload :DeveloperAuthenticationCallbackResponse, 'authlete/response/developer-authentication-callback-response'
49
51
  autoload :IntrospectionResponse, 'authlete/response/introspection-response'
50
52
  end
51
53
  end
@@ -0,0 +1,84 @@
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 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
+ require 'json'
19
+
20
+
21
+ module Authlete
22
+ module Request
23
+ # == Authlete::Request::DeveloperAuthenticationCallbackRequest class
24
+ #
25
+ # This class represents a request to a developer authentication callback endpoint.
26
+ class AuthenticationCallbackRequest
27
+ include Authlete::Utility
28
+
29
+ # The API key of the service.
30
+ attr_accessor :service_api_key
31
+
32
+ # The login ID that the developer input to the login ID field.
33
+ # When 'sns' attribute is not nil, this attribute holds the
34
+ # subject (= unique identifier) of the developer in the SNS.
35
+ attr_accessor :id
36
+
37
+ # The password that the developer input to the password field.
38
+ # If 'sns' property is nil, it is ensured that this attribute
39
+ # is not nil. In such a case, authentication should be performed
40
+ # on the pair of 'id' attribute and this 'password' attribute.
41
+ # On the other hand, if 'sns' attribute is not nil, this attribute
42
+ # has no meaning, because authentication has performed by the SNS.
43
+ attr_accessor :password
44
+
45
+ # The SNS which the developer used for social login.
46
+ # For example, 'FACEBOOK'.
47
+ attr_accessor :sns
48
+
49
+ # The access token issued at the token endpoint of the SNS.
50
+ attr_accessor :access_token
51
+
52
+ # The refresh token issued along with the access token.
53
+ attr_accessor :refresh_token
54
+
55
+ # The duration of the access token.
56
+ attr_accessor :expires_in
57
+
58
+ # The raw content of the response from the token endpoint of the SNS.
59
+ # Correct OAuth 2.0 implementations return 'application/json', but
60
+ # Facebook returns 'application/x-www-form-url-encoded'.
61
+ attr_accessor :raw_token_response
62
+
63
+ # The constructor which takes a hash that represents a JSON request
64
+ # to a developer authentication callback endpoint.
65
+ def initialize(hash = {})
66
+ @service_api_key = extract_value(hash, :serviceApiKey)
67
+ @id = extract_value(hash, :id)
68
+ @password = extract_value(hash, :password)
69
+ @sns = extract_value(hash, :sns)
70
+ @access_token = extract_value(hash, :accessToken)
71
+ @refresh_token = extract_value(hash, :refreshToken)
72
+ @expires_in = extract_integer_value(hash, :expiresIn)
73
+ @raw_token_response = extract_value(hash, :rawTokenResponse)
74
+ end
75
+
76
+ # Parse a JSON string which represents a request to a developer
77
+ # authentication callback endpoint and generate an instance of
78
+ # DeveloperAuthenticationCallbackRequest.
79
+ def self.parse(json)
80
+ DeveloperAuthenticationCallbackRequest.new(JSON.parse(json))
81
+ end
82
+ end
83
+ end
84
+ end
@@ -1,3 +1,3 @@
1
1
  module Authlete
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
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.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiko Kawasaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-23 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -79,6 +79,7 @@ files:
79
79
  - lib/authlete/model/sns-credentials.rb
80
80
  - lib/authlete/model/tagged-value.rb
81
81
  - lib/authlete/request/authentication-callback-request.rb
82
+ - lib/authlete/request/developer-authentication-callback-request.rb
82
83
  - lib/authlete/response/authentication-callback-response.rb
83
84
  - lib/authlete/response/base-response.rb
84
85
  - lib/authlete/response/developer-authentication-callback-response.rb