rack-oauth2 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.4
1
+ 0.4.5
@@ -33,6 +33,8 @@ module Rack
33
33
  AuthorizationCode
34
34
  when 'password'
35
35
  Password
36
+ when 'client_credentials'
37
+ ClientCredentials
36
38
  when 'refresh_token'
37
39
  RefreshToken
38
40
  when ''
@@ -71,4 +73,5 @@ end
71
73
  require 'rack/oauth2/server/token/error'
72
74
  require 'rack/oauth2/server/token/authorization_code'
73
75
  require 'rack/oauth2/server/token/password'
76
+ require 'rack/oauth2/server/token/client_credentials'
74
77
  require 'rack/oauth2/server/token/refresh_token'
@@ -0,0 +1,23 @@
1
+ module Rack
2
+ module OAuth2
3
+ module Server
4
+ class Token
5
+ class ClientCredentials < Abstract::Handler
6
+ def call(env)
7
+ @request = Request.new(env)
8
+ @response = Response.new(request)
9
+ super
10
+ end
11
+
12
+ class Request < Token::Request
13
+ def initialize(env)
14
+ super
15
+ @grant_type = :client_credentials
16
+ attr_missing!
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper.rb'
2
+
3
+ describe Rack::OAuth2::Server::Token::ClientCredentials do
4
+ let(:request) { Rack::MockRequest.new app }
5
+ let(:app) do
6
+ Rack::OAuth2::Server::Token.new do |request, response|
7
+ response.access_token = 'access_token'
8
+ response.token_type = :bearer
9
+ end
10
+ end
11
+ let(:params) do
12
+ {
13
+ :grant_type => 'client_credentials',
14
+ :client_id => 'client_id',
15
+ :client_secret => 'client_secret'
16
+ }
17
+ end
18
+ subject { request.post('/', :params => params) }
19
+
20
+ its(:status) { should == 200 }
21
+ its(:content_type) { should == 'application/json' }
22
+ its(:body) { should include '"access_token":"access_token"' }
23
+ its(:body) { should include '"token_type":"bearer"' }
24
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-22 00:00:00 +09:00
18
+ date: 2011-03-24 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -207,6 +207,7 @@ files:
207
207
  - lib/rack/oauth2/server/resource/bearer/error.rb
208
208
  - lib/rack/oauth2/server/token.rb
209
209
  - lib/rack/oauth2/server/token/authorization_code.rb
210
+ - lib/rack/oauth2/server/token/client_credentials.rb
210
211
  - lib/rack/oauth2/server/token/error.rb
211
212
  - lib/rack/oauth2/server/token/password.rb
212
213
  - lib/rack/oauth2/server/token/refresh_token.rb
@@ -224,6 +225,7 @@ files:
224
225
  - spec/rack/oauth2/server/resource/bearer/error_spec.rb
225
226
  - spec/rack/oauth2/server/resource/bearer_spec.rb
226
227
  - spec/rack/oauth2/server/token/authorization_code_spec.rb
228
+ - spec/rack/oauth2/server/token/client_credentials_spec.rb
227
229
  - spec/rack/oauth2/server/token/error_spec.rb
228
230
  - spec/rack/oauth2/server/token/password_spec.rb
229
231
  - spec/rack/oauth2/server/token/refresh_token_spec.rb
@@ -279,6 +281,7 @@ test_files:
279
281
  - spec/rack/oauth2/server/resource/bearer/error_spec.rb
280
282
  - spec/rack/oauth2/server/resource/bearer_spec.rb
281
283
  - spec/rack/oauth2/server/token/authorization_code_spec.rb
284
+ - spec/rack/oauth2/server/token/client_credentials_spec.rb
282
285
  - spec/rack/oauth2/server/token/error_spec.rb
283
286
  - spec/rack/oauth2/server/token/password_spec.rb
284
287
  - spec/rack/oauth2/server/token/refresh_token_spec.rb