rack-oauth2-server 1.3.1 → 1.4.0

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.
data/test/setup.rb CHANGED
@@ -36,7 +36,7 @@ when "sinatra", nil
36
36
  end
37
37
  end
38
38
 
39
- when "rails2"
39
+ when "rails"
40
40
 
41
41
  require "initializer"
42
42
  require "action_controller"
@@ -5,27 +5,30 @@ class MyApp < Sinatra::Base
5
5
  set :sessions, true
6
6
 
7
7
  register Rack::OAuth2::Sinatra
8
- oauth.scopes = %w{read write}
8
+ oauth.scopes = %w{read write time-travel}
9
9
  oauth.authenticator = lambda do |username, password|
10
- "Superman" if username == "cowbell" && password == "more"
10
+ "Batman" if username == "cowbell" && password == "more"
11
11
  end
12
12
  oauth.host = "example.org"
13
13
  oauth.database = DATABASE
14
14
 
15
15
 
16
16
  # 3. Obtaining End-User Authorization
17
+
18
+ before "/oauth/*" do
19
+ halt oauth.deny! if oauth.scope.include?("time-travel") # Only Superman can do that
20
+ end
17
21
 
18
22
  get "/oauth/authorize" do
19
- session["oauth.authorization"] = oauth.authorization
20
23
  "client: #{oauth.client.display_name}\nscope: #{oauth.scope.join(", ")}\nauthorization: #{oauth.authorization}"
21
24
  end
22
25
 
23
26
  post "/oauth/grant" do
24
- oauth.grant! session["oauth.authorization"], "Superman"
27
+ oauth.grant! "Batman"
25
28
  end
26
29
 
27
30
  post "/oauth/deny" do
28
- oauth.deny! session["oauth.authorization"]
31
+ oauth.deny!
29
32
  end
30
33
 
31
34
 
@@ -61,7 +64,7 @@ class MyApp < Sinatra::Base
61
64
  end
62
65
 
63
66
  get "/list_tokens" do
64
- oauth.list_access_tokens("Superman").map(&:token).join(" ")
67
+ oauth.list_access_tokens("Batman").map(&:token).join(" ")
65
68
  end
66
69
 
67
70
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2-server
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Assaf Arkin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-08 00:00:00 -08:00
18
+ date: 2010-11-09 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,8 +62,8 @@ dependencies:
62
62
  version_requirements: *id003
63
63
  description: Because you don't allow strangers into your app, and OAuth 2.0 is the new awesome.
64
64
  email: assaf@labnotes.org
65
- executables: []
66
-
65
+ executables:
66
+ - oauth2-server
67
67
  extensions: []
68
68
 
69
69
  extra_rdoc_files:
@@ -87,6 +87,7 @@ files:
87
87
  - lib/rack/oauth2/admin/views/clients.tmpl
88
88
  - lib/rack/oauth2/admin/views/edit.tmpl
89
89
  - lib/rack/oauth2/admin/views/index.html
90
+ - lib/rack/oauth2/admin/views/no_access.tmpl
90
91
  - lib/rack/oauth2/models/access_grant.rb
91
92
  - lib/rack/oauth2/models/access_token.rb
92
93
  - lib/rack/oauth2/models/auth_request.rb
@@ -102,7 +103,7 @@ files:
102
103
  - lib/rack-oauth2-server.rb
103
104
  - rails/init.rb
104
105
  - test/admin/api_test.rb
105
- - test/admin_test_.rb
106
+ - test/admin/ui_test.rb
106
107
  - test/oauth/access_grant_test.rb
107
108
  - test/oauth/access_token_test.rb
108
109
  - test/oauth/authorization_test.rb
@@ -129,7 +130,7 @@ licenses: []
129
130
  post_install_message: To get started, run the command oauth2-server
130
131
  rdoc_options:
131
132
  - --title
132
- - rack-oauth2-server 1.3.1
133
+ - rack-oauth2-server 1.4.0
133
134
  - --main
134
135
  - README.rdoc
135
136
  - --webcvs
data/test/admin_test_.rb DELETED
@@ -1,49 +0,0 @@
1
- require File.dirname(__FILE__) + "/setup"
2
- require "v8/jasmine"
3
-
4
- class Reporter
5
-
6
- def reportRunnerResults(runner)
7
- results = runner.results()
8
- say "#{results.totalCount} examples, #{results.failedCount} failures."
9
- end
10
-
11
- def reportSpecResults(spec)
12
- say((spec.results.passed ? "." : "F"), false)
13
- end
14
-
15
- def log(str)
16
- # say str
17
- end
18
-
19
- def say(msg, newline = true)
20
- escaped = ERB::Util.h(msg)
21
- puts(newline ? "<div>#{escaped}</div>" : escaped)
22
- end
23
- end
24
-
25
- start = Time.now
26
- begin
27
- cxt = V8::Jasmine::Context.new
28
- env = cxt['jasmine'].getEnv()
29
- env.addReporter(Reporter.new)
30
- cxt.eval <<-JS
31
- describe("Jasmine", function() {
32
- it("makes testing JavaScript awesome!", function() {
33
- var foo = 0; // set up the world
34
- foo++; // call your application code
35
-
36
- expect(foo).toEqual(1); // passes because foo == 1
37
-
38
- });
39
- });
40
- JS
41
- env.execute()
42
- finish = Time.now
43
- puts "finished in #{finish - start} seconds"
44
- #rescue V8::JavascriptError => e
45
- # $stderr.puts e.javascript_stacktrace
46
- rescue Exception => e
47
- $stderr.puts e.message
48
- end
49
-