social_stream-oauth2_server 2.0.0.beta1

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/Gemfile +5 -0
  4. data/README.rdoc +3 -0
  5. data/Rakefile +26 -0
  6. data/app/assets/images/logos/small/site.png +0 -0
  7. data/app/assets/javascripts/social_stream-oauth2_server.js +6 -0
  8. data/app/assets/javascripts/social_stream/site_client.js +15 -0
  9. data/app/assets/stylesheets/social_stream-oauth2_server.css.sass +24 -0
  10. data/app/assets/stylesheets/social_stream/oauth2_server/applications/_applications-oauth2server.css.sass +45 -0
  11. data/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +51 -0
  12. data/app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-1200px-min.css.sass +7 -0
  13. data/app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-767px-max.css.sass +35 -0
  14. data/app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-768px-979px.css.sass +8 -0
  15. data/app/assets/stylesheets/social_stream/oauth2_server/create/_create-oauth2server.css.sass +11 -0
  16. data/app/assets/stylesheets/social_stream/oauth2_server/create/_error_create-oauth2server.css.sass +13 -0
  17. data/app/assets/stylesheets/social_stream/oauth2_server/create/layout/_create-oauth2server.css.sass +19 -0
  18. data/app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-1200px-min.css.sass +7 -0
  19. data/app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-767px-max.css.sass +16 -0
  20. data/app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-768px-979px.css.sass +8 -0
  21. data/app/assets/stylesheets/social_stream/oauth2_server/show/_show-oauth2server.css.sass +42 -0
  22. data/app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass +71 -0
  23. data/app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-1200px-min.css.sass +7 -0
  24. data/app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-767px-max.css.sass +16 -0
  25. data/app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-768px-979px.css.sass +8 -0
  26. data/app/controllers/authorizations_controller.rb +67 -0
  27. data/app/controllers/site/clients_controller.rb +39 -0
  28. data/app/decorators/social_stream/base/actor_decorator.rb +3 -0
  29. data/app/decorators/social_stream/base/user_decorator.rb +3 -0
  30. data/app/helpers/site_client_helper.rb +17 -0
  31. data/app/models/oauth2_token.rb +33 -0
  32. data/app/models/oauth2_token/access_token.rb +32 -0
  33. data/app/models/oauth2_token/authorization_code.rb +5 -0
  34. data/app/models/oauth2_token/refresh_token.rb +7 -0
  35. data/app/models/relation/admin.rb +9 -0
  36. data/app/models/relation/auth.rb +8 -0
  37. data/app/models/site/client.rb +38 -0
  38. data/app/overrides/frontpage/_presentation/client_site_presentation.html.erb.deface +8 -0
  39. data/app/overrides/layouts/_header_dropdown_menu/applications_entry.html.erb.deface +4 -0
  40. data/app/views/authorizations/error.html.erb +4 -0
  41. data/app/views/authorizations/new.html.erb +27 -0
  42. data/app/views/site/clients/_form.html.erb +39 -0
  43. data/app/views/site/clients/_new.modal.html.erb +9 -0
  44. data/app/views/site/clients/_presentation.html.erb +13 -0
  45. data/app/views/site/clients/index.html.erb +42 -0
  46. data/app/views/site/clients/new.html.erb +10 -0
  47. data/app/views/site/clients/show.html.erb +44 -0
  48. data/config/locales/en.yml +29 -0
  49. data/config/locales/es.yml +29 -0
  50. data/config/routes.rb +10 -0
  51. data/db/migrate/20130115102300_create_social_stream_oauth2_server.rb +25 -0
  52. data/lib/generators/social_stream/oauth2_server/install_generator.rb +23 -0
  53. data/lib/social_stream-oauth2_server.rb +19 -0
  54. data/lib/social_stream/migrations/oauth2_server.rb +8 -0
  55. data/lib/social_stream/oauth2_server.rb +5 -0
  56. data/lib/social_stream/oauth2_server/controllers/helpers.rb +41 -0
  57. data/lib/social_stream/oauth2_server/engine.rb +21 -0
  58. data/lib/social_stream/oauth2_server/models/actor.rb +11 -0
  59. data/lib/social_stream/oauth2_server/models/user.rb +35 -0
  60. data/lib/social_stream/oauth2_server/token_endpoint.rb +41 -0
  61. data/lib/social_stream/oauth2_server/version.rb +5 -0
  62. data/lib/tasks/db/populate.rake +37 -0
  63. data/social_stream-oauth2_server.gemspec +19 -0
  64. data/spec/controllers/authorizations_controller_spec.rb +179 -0
  65. data/spec/controllers/dummy_controller_spec.rb +43 -0
  66. data/spec/factories/site_client.rb +6 -0
  67. data/spec/models/relation/auth_spec.rb +15 -0
  68. data/spec/models/site/client_spec.rb +22 -0
  69. metadata +156 -0
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe DummyController do
4
+ DummyController.class_eval do
5
+ before_filter :current_subject
6
+ end
7
+
8
+ let(:client) { double :client }
9
+ let(:user) { double :user, language: :en }
10
+
11
+ let(:token) { stub :token, client: client }
12
+ let(:find) { stub :find, { find_by_token: token } }
13
+
14
+ before do
15
+ controller.request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] = token
16
+ end
17
+
18
+ describe "with user token" do
19
+ before do
20
+ token.stub(:user).and_return(user)
21
+ end
22
+
23
+ it "should have user as current_subject" do
24
+ get :index
25
+
26
+ assigns(:current_subject).should be_present
27
+ assigns(:current_subject).should eq(user)
28
+ end
29
+ end
30
+
31
+ describe "with client token" do
32
+ before do
33
+ token.stub(:user).and_return(nil)
34
+ end
35
+
36
+ it "should have client as current_subject" do
37
+ get :index
38
+
39
+ assigns(:current_subject).should be_present
40
+ assigns(:current_subject).should eq(client)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,6 @@
1
+ Factory.define(:site_client, :class => Site::Client) do |c|
2
+ c.sequence(:name) { |n| "Site client #{ n }" }
3
+ c.url { 'https://test.com' }
4
+ c.callback_url { 'https://test.com/callback' }
5
+ c.actor { Factory(:user).actor }
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe User do
4
+ let(:user) { Factory(:user) }
5
+ let(:client) { Factory(:site_client) }
6
+
7
+ describe "client_authorize!" do
8
+ it "should create tie" do
9
+ user.client_authorize!(client)
10
+
11
+ user.reload.sent_ties.count.should be > 0
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Site::Client do
4
+ before do
5
+ @user = Factory(:user)
6
+
7
+ @client = Site::Client.create name: "Test",
8
+ url: "http://test.com",
9
+ callback_url: "http://test.com/callback",
10
+ author: @user
11
+
12
+
13
+ end
14
+
15
+ it "should be created with url" do
16
+ @client.should be_valid
17
+ end
18
+
19
+ it "should establish tie to author" do
20
+ @client.contact_to!(@user).relation_ids.should eq([Relation::Admin.instance.id])
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: social_stream-oauth2_server
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - Antonio Tapiador
8
+ - GING - DIT - UPM
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: social_stream-base
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 2.0.0.beta1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 2.0.0.beta1
28
+ - !ruby/object:Gem::Dependency
29
+ name: rack-oauth2
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 1.0.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 2.8.0
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 2.8.0
56
+ description: |-
57
+ Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.
58
+
59
+ This gem supplies with OAuth2 server support
60
+ email: social-stream@dit.upm.es
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - Gemfile
67
+ - README.rdoc
68
+ - Rakefile
69
+ - app/assets/images/logos/small/site.png
70
+ - app/assets/javascripts/social_stream-oauth2_server.js
71
+ - app/assets/javascripts/social_stream/site_client.js
72
+ - app/assets/stylesheets/social_stream-oauth2_server.css.sass
73
+ - app/assets/stylesheets/social_stream/oauth2_server/applications/_applications-oauth2server.css.sass
74
+ - app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass
75
+ - app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-1200px-min.css.sass
76
+ - app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-767px-max.css.sass
77
+ - app/assets/stylesheets/social_stream/oauth2_server/applications/responsive/_responsive-768px-979px.css.sass
78
+ - app/assets/stylesheets/social_stream/oauth2_server/create/_create-oauth2server.css.sass
79
+ - app/assets/stylesheets/social_stream/oauth2_server/create/_error_create-oauth2server.css.sass
80
+ - app/assets/stylesheets/social_stream/oauth2_server/create/layout/_create-oauth2server.css.sass
81
+ - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-1200px-min.css.sass
82
+ - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-767px-max.css.sass
83
+ - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-768px-979px.css.sass
84
+ - app/assets/stylesheets/social_stream/oauth2_server/show/_show-oauth2server.css.sass
85
+ - app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass
86
+ - app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-1200px-min.css.sass
87
+ - app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-767px-max.css.sass
88
+ - app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-768px-979px.css.sass
89
+ - app/controllers/authorizations_controller.rb
90
+ - app/controllers/site/clients_controller.rb
91
+ - app/decorators/social_stream/base/actor_decorator.rb
92
+ - app/decorators/social_stream/base/user_decorator.rb
93
+ - app/helpers/site_client_helper.rb
94
+ - app/models/oauth2_token.rb
95
+ - app/models/oauth2_token/access_token.rb
96
+ - app/models/oauth2_token/authorization_code.rb
97
+ - app/models/oauth2_token/refresh_token.rb
98
+ - app/models/relation/admin.rb
99
+ - app/models/relation/auth.rb
100
+ - app/models/site/client.rb
101
+ - app/overrides/frontpage/_presentation/client_site_presentation.html.erb.deface
102
+ - app/overrides/layouts/_header_dropdown_menu/applications_entry.html.erb.deface
103
+ - app/views/authorizations/error.html.erb
104
+ - app/views/authorizations/new.html.erb
105
+ - app/views/site/clients/_form.html.erb
106
+ - app/views/site/clients/_new.modal.html.erb
107
+ - app/views/site/clients/_presentation.html.erb
108
+ - app/views/site/clients/index.html.erb
109
+ - app/views/site/clients/new.html.erb
110
+ - app/views/site/clients/show.html.erb
111
+ - config/locales/en.yml
112
+ - config/locales/es.yml
113
+ - config/routes.rb
114
+ - db/migrate/20130115102300_create_social_stream_oauth2_server.rb
115
+ - lib/generators/social_stream/oauth2_server/install_generator.rb
116
+ - lib/social_stream-oauth2_server.rb
117
+ - lib/social_stream/migrations/oauth2_server.rb
118
+ - lib/social_stream/oauth2_server.rb
119
+ - lib/social_stream/oauth2_server/controllers/helpers.rb
120
+ - lib/social_stream/oauth2_server/engine.rb
121
+ - lib/social_stream/oauth2_server/models/actor.rb
122
+ - lib/social_stream/oauth2_server/models/user.rb
123
+ - lib/social_stream/oauth2_server/token_endpoint.rb
124
+ - lib/social_stream/oauth2_server/version.rb
125
+ - lib/tasks/db/populate.rake
126
+ - social_stream-oauth2_server.gemspec
127
+ - spec/controllers/authorizations_controller_spec.rb
128
+ - spec/controllers/dummy_controller_spec.rb
129
+ - spec/factories/site_client.rb
130
+ - spec/models/relation/auth_spec.rb
131
+ - spec/models/site/client_spec.rb
132
+ homepage: http://github.com/ging/social_stream-oauth2_server
133
+ licenses: []
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>'
147
+ - !ruby/object:Gem::Version
148
+ version: 1.3.1
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.0.0
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: OAuth2 server support for Social Stream, the framework for building social
155
+ network websites
156
+ test_files: []