dailycred 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: d30d1990094894f411a6a1592ef5a027bd1ac0de
4
+ data.tar.gz: 360389f4feb4cc5efa5019e1f8d8d472709c233b
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: ef9ef43149fca1efc8244c60931cbfa14c528a9b14cc25e805cb1cef6fa4bde7fa278b0c03b2cf7718d40ff6d986cc77732a56d75a89b378b46621cad04e964d
7
+ data.tar.gz: 775fac987c79ef919a16a14738251604ceea7b0fefdd62406d58dc81a277b2bd39ef3da47391e12fdbab3eda562e89e142b085dcd7965e04812364857df90e11
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'rspec'
6
- gem 'rails'
6
+ gem 'rails', '~> 3.2.12'
7
7
  gem 'simplecov'
8
8
  gem 'ruby_gntp'
9
9
  gem 'growl'
data/README.md CHANGED
@@ -181,6 +181,31 @@ Where opts is an optional hash for passing options. After initializing your clie
181
181
  @dailycred.untag(current_user.uid, "Failed Checkout") # user_id, key
182
182
 
183
183
 
184
+ #### Persona Login
185
+
186
+ 1. Set your `persona audience` in your [dailycred identity provider settings](https://www.dailycred.com/admin/settings/identity-providers). This will be `http://{your-url}/auth/dailycred/callback`.
187
+ 2. Make sure you have configured your `callback url` in your [dailycred app settings](https://www.dailycred.com/admin/settings)
188
+ 3. In `config/omniauth.rb`, configure your middleware options to include your persona audience:
189
+
190
+ Rails.configuration.DAILYCRED_OPTIONS = {
191
+ middleware: {
192
+ persona_audience = "http://{your-url}/auth/dailycred/callback"
193
+ }
194
+ }
195
+
196
+ 4. In your javascript, call `personaLogin()`.
197
+
198
+ $(document).ready(function(){
199
+ $('.persona-login').click(function(){
200
+ personaLogin();
201
+ })
202
+ })
203
+
204
+ 5. Your user will be redirected to your [persona.org](https://persona.org) to login. If successful, your user will be redirected to your OAuth callback URL and be logged in.
205
+
206
+ For more details, visit our [persona documentation](https://www.dailycred.com/docs/persona)
207
+
208
+
184
209
  #### Configuration
185
210
 
186
211
  To specify where users should be redirected after authentication actions, setup configure an `after_auth` property on a `Rails.configuration.DAILYCRED_OPTIONS` variable. Example:
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ task :docs do
27
27
  require 'fileutils'
28
28
  require 'maruku'
29
29
  Rocco::make 'docs/'
30
- FileUtils.cp_r "docs/lib/", "/Users/hank/rails/dailycred/public/docs/ruby/", :verbose => true
30
+ FileUtils.cp_r "docs/lib/", "/Users/hank/java/dailycred/public/docs/ruby/", :verbose => true
31
31
  md = ""
32
32
  File.open("README.md", "r") do |infile|
33
33
  while (line = infile.gets)
@@ -35,7 +35,7 @@ task :docs do
35
35
  end
36
36
  end
37
37
  doc = Maruku.new(md)
38
- File.open("/Users/hank/rails/dailycred/app/views/tags/docs/rubyonrails.html", 'w') {|f| f.write doc.to_html}
38
+ File.open("/Users/hank/java/dailycred/app/views/tags/docs/rubyonrails.html", 'w') {|f| f.write doc.to_html}
39
39
  rescue LoadError
40
40
  warn "#$! -- rocco tasks not loaded."
41
41
  task :rocco
@@ -37,8 +37,8 @@ module Dailycred
37
37
  Rails.application.config.middleware.use OmniAuth::Builder do
38
38
  provider :dailycred, id, secret, opts
39
39
  end
40
-
41
- Rails.application.config.middleware.use "Dailycred::Middleware", id
40
+ opts[:middleware] ||= {}
41
+ Rails.application.config.middleware.use "Dailycred::Middleware", id, opts[:middleware]
42
42
 
43
43
  ActiveSupport.on_load(:action_controller) do
44
44
  include Dailycred::Helpers
@@ -25,7 +25,7 @@ module Dailycred
25
25
  @response = [body]
26
26
  end
27
27
  end
28
-
28
+ @env['rack.session']['omniauth.state'] ||= SecureRandom.hex(24)
29
29
  [@status, @headers, @response]
30
30
  end
31
31
 
@@ -34,13 +34,16 @@ module Dailycred
34
34
  def render_dailycred_scripts
35
35
  str =<<-EOT
36
36
  <!-- dailycred -->
37
+ #{'<script src="https://login.persona.org/include.js"></script>' if @opts[:persona_audience]}
37
38
  <script type="text/javascript">
38
39
  (function() {
39
40
  var dc, url;
40
41
  window.dc_opts = {
41
42
  clientId: "#{@client_id}",
42
- home: "#{@opts[:url]}"
43
+ home: "#{@opts[:url]}",
44
+ state: "#{@env['rack.session']['omniauth.state']}"
43
45
  #{", type: \"#{@status.to_s}\"" if @status == 500 || @status == 400}
46
+ #{", personaAudience: \"#{@opts[:persona_audience]}\"" if @opts[:persona_audience]}
44
47
  };
45
48
  dc = document.createElement("script");
46
49
  url = dc_opts.home + "/public/js/cred.coffee";
@@ -1,3 +1,3 @@
1
1
  module Dailycred
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/spec/helper_spec.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'simplecov'
4
4
  SimpleCov.start
5
5
  require 'rspec'
6
- require 'rack/test'
6
+ # require 'rack/test'
7
7
  require 'omniauth'
8
8
  require 'dailycred'
9
9
 
@@ -70,9 +70,6 @@ class GeneratorTest < Rails::Generators::TestCase
70
70
  end
71
71
 
72
72
  assert_migration "db/migrate/create_users.rb" do |migration|
73
- assert migration.include? ":twitter"
74
- assert migration.include? ":github"
75
- assert migration.include? ":google"
76
73
  end
77
74
  end
78
75
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dailycred
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.1.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Hank Stoever
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
11
+ date: 2013-03-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: omniauth-oauth2
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -178,33 +173,26 @@ files:
178
173
  - test/test_helper.rb
179
174
  homepage: https://www.dailycred.com
180
175
  licenses: []
176
+ metadata: {}
181
177
  post_install_message:
182
178
  rdoc_options: []
183
179
  require_paths:
184
180
  - lib
185
181
  required_ruby_version: !ruby/object:Gem::Requirement
186
- none: false
187
182
  requirements:
188
183
  - - ! '>='
189
184
  - !ruby/object:Gem::Version
190
185
  version: '0'
191
- segments:
192
- - 0
193
- hash: 3809456229440668056
194
186
  required_rubygems_version: !ruby/object:Gem::Requirement
195
- none: false
196
187
  requirements:
197
188
  - - ! '>='
198
189
  - !ruby/object:Gem::Version
199
190
  version: '0'
200
- segments:
201
- - 0
202
- hash: 3809456229440668056
203
191
  requirements: []
204
192
  rubyforge_project:
205
- rubygems_version: 1.8.24
193
+ rubygems_version: 2.0.0
206
194
  signing_key:
207
- specification_version: 3
195
+ specification_version: 4
208
196
  summary: ''
209
197
  test_files:
210
198
  - spec/helper_spec.rb