devise-browserid 0.4.6

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in devise-browserid.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Devise::BrowserId
2
+
3
+ Authenticate your Warden/Devise-enabled Rails app using BrowserID from Mozilla
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'devise-browserid'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install devise-browserid
18
+
19
+ ## Usage
20
+
21
+ devise-browserid depends on warden-browserid and lives in the Rails
22
+ asset pipeline.
23
+
24
+ I use the devise-browserid strategy with warden, configured like this in
25
+ config/initializers/devise.rb in Rails:
26
+
27
+ ```ruby
28
+ config.warden do |manager|
29
+ manager.default_strategies(:scope => :user).unshift :browserid
30
+ manager.browserid_url = "dev.diresworb.org"
31
+ end
32
+ ```
33
+
34
+ Then you add the javascripts at the bottom of your application layout:
35
+ ```erb
36
+ <%= browserid_include_tag %>
37
+ ```
38
+
39
+ And the login button wherever you want to:
40
+ ```erb
41
+ <%= browserid_login_tag %>
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "devise-browserid/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "devise-browserid"
7
+ s.version = Devise::Browserid::VERSION
8
+ s.authors = ["ringe"]
9
+ s.email = ["runar@rin.no"]
10
+ s.homepage = "http://rin.no"
11
+ s.description = %q{BrowserID helpers for Devise}
12
+ s.summary = %q{Authenticate your Devise/Warden-enabled Rails app using BrowserID from Mozilla}
13
+
14
+ s.rubyforge_project = "devise-browserid"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "warden-browserid"
22
+ s.add_dependency "devise"
23
+ end
@@ -0,0 +1,6 @@
1
+ module BrowserId
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'devise-browserid/view_helpers'
2
+ module BrowserId
3
+ class Railtie < Rails::Railtie
4
+ initializer "my_gem.view_helpers" do
5
+ ActionView::Base.send :include, ViewHelpers
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Devise
2
+ module Browserid
3
+ VERSION = "0.4.6"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module BrowserId
2
+ module ViewHelpers
3
+ def browserid_include_tag
4
+ raw %{<script src="https://#{ request.env['warden'].config.browserid_url }/include.js" type="text/javascript"></script>}
5
+ end
6
+
7
+ def browserid_login_tag
8
+ image_tag("sign_in_blue.png", :onclick => "browserIdLogin();")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require "devise-browserid/version"
2
+ require 'devise-browserid/railtie'
3
+ require 'devise-browserid/assets'
@@ -0,0 +1,43 @@
1
+ function gotAssertion(assertion) {
2
+ // got an assertion, now send it up to the server for verification
3
+ if (assertion !== null) {
4
+ $.ajax({
5
+ type: 'POST',
6
+ url: '/d/users/sign_in',
7
+ data: { assertion: assertion },
8
+ success: function(res, status, xhr) {
9
+ if (res === null) {}//loggedOut();
10
+ else alert(res);
11
+ },
12
+ error: function(res, status, xhr) {
13
+ console.log("login failure" + res);
14
+ }
15
+ });
16
+ } else {
17
+ //loggedOut();
18
+ }
19
+ }
20
+
21
+ function browserIdLogin() {
22
+ navigator.id.get(function(assertion) {
23
+ if (assertion) {
24
+ // This code will be invoked once the user has successfully
25
+ // selected an email address they control to sign in with.
26
+ $.ajax({
27
+ url:"/d/users/sign_in/",
28
+ type: "POST",
29
+ data: {"assertion": assertion},
30
+ cache:false,
31
+ success:function(data,status){
32
+ window.location.href = '/';
33
+ },
34
+ error:function(data,status){
35
+ alert(data.statusText + ": " + data.responseText);
36
+ }
37
+ })
38
+ } else {
39
+ // something went wrong! the user isn't logged in.
40
+ alert("Could not log you in!");
41
+ }
42
+ });
43
+ }
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-browserid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - ringe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-13 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: warden-browserid
16
+ requirement: &18319640 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *18319640
25
+ - !ruby/object:Gem::Dependency
26
+ name: devise
27
+ requirement: &18319220 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *18319220
36
+ description: BrowserID helpers for Devise
37
+ email:
38
+ - runar@rin.no
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README.md
46
+ - Rakefile
47
+ - devise-browserid.gemspec
48
+ - lib/devise-browserid.rb
49
+ - lib/devise-browserid/assets.rb
50
+ - lib/devise-browserid/railtie.rb
51
+ - lib/devise-browserid/version.rb
52
+ - lib/devise-browserid/view_helpers.rb
53
+ - vendor/assets/images/sign_in_blue.png
54
+ - vendor/assets/images/sign_in_green.png
55
+ - vendor/assets/images/sign_in_grey.png
56
+ - vendor/assets/images/sign_in_orange.png
57
+ - vendor/assets/images/sign_in_red.png
58
+ - vendor/assets/javascripts/browserid.js
59
+ homepage: http://rin.no
60
+ licenses: []
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project: devise-browserid
79
+ rubygems_version: 1.8.15
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Authenticate your Devise/Warden-enabled Rails app using BrowserID from Mozilla
83
+ test_files: []