rack-oauth2-server 1.0.0 → 1.1.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/CHANGELOG +12 -0
- data/README.rdoc +44 -48
- data/lib/rack/oauth2/models.rb +20 -7
- data/lib/rack/oauth2/models/access_grant.rb +9 -8
- data/lib/rack/oauth2/models/access_token.rb +16 -12
- data/lib/rack/oauth2/models/auth_request.rb +10 -7
- data/lib/rack/oauth2/models/client.rb +14 -2
- data/lib/rack/oauth2/rails.rb +2 -13
- data/lib/rack/oauth2/server.rb +35 -30
- data/lib/rack/oauth2/server/helper.rb +13 -13
- data/lib/rack/oauth2/server/version.rb +1 -1
- data/lib/rack/oauth2/sinatra.rb +4 -4
- data/test/rails/app/controllers/api_controller.rb +2 -2
- data/test/rails/app/controllers/application_controller.rb +0 -2
- data/test/rails/config/environment.rb +6 -6
- data/test/rails/log/test.log +22090 -0
- data/test/sinatra/my_app.rb +5 -5
- metadata +4 -4
data/test/sinatra/my_app.rb
CHANGED
@@ -5,11 +5,11 @@ class MyApp < Sinatra::Base
|
|
5
5
|
set :sessions, true
|
6
6
|
|
7
7
|
register Rack::OAuth2::Sinatra
|
8
|
-
oauth
|
9
|
-
oauth
|
8
|
+
oauth.scopes = %w{read write}
|
9
|
+
oauth.authenticator = lambda do |username, password|
|
10
10
|
"Superman" if username == "cowbell" && password == "more"
|
11
11
|
end
|
12
|
-
oauth
|
12
|
+
oauth.database = DATABASE
|
13
13
|
|
14
14
|
|
15
15
|
# 3. Obtaining End-User Authorization
|
@@ -30,11 +30,11 @@ class MyApp < Sinatra::Base
|
|
30
30
|
|
31
31
|
# 5. Accessing a Protected Resource
|
32
32
|
|
33
|
-
before { @user = oauth.
|
33
|
+
before { @user = oauth.identity if oauth.authenticated? }
|
34
34
|
|
35
35
|
get "/public" do
|
36
36
|
if oauth.authenticated?
|
37
|
-
"HAI from #{oauth.
|
37
|
+
"HAI from #{oauth.identity}"
|
38
38
|
else
|
39
39
|
"HAI"
|
40
40
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Assaf Arkin
|
@@ -108,7 +108,7 @@ licenses: []
|
|
108
108
|
post_install_message: ""
|
109
109
|
rdoc_options:
|
110
110
|
- --title
|
111
|
-
- rack-oauth2-server 1.
|
111
|
+
- rack-oauth2-server 1.1.0
|
112
112
|
- --main
|
113
113
|
- README.rdoc
|
114
114
|
- --webcvs
|