ember_devise_simple_auth 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f7249151c2a00fc17d2274363206100811cbed53
4
+ data.tar.gz: e8fb7e9e706df1b3f5e8ea124792af635c2815fc
5
+ SHA512:
6
+ metadata.gz: e3b7c9748c58ca2f72f2e124661b69608b7005fdb06c80be13423520da08d8420e73173af47791b50e5417882b34b39b9b8fad6ae83af66da27873b96f2bdab1
7
+ data.tar.gz: eb15a2b2bac5b19ba8ae33f5a9e40feaa8e8acc8ff08a2648c0714e1bedde2d0b08dbd5686cdf7c8bc8c2045418a8ab2f426235a488ef12f20c7e71b9a6646b5
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'EmberDeviseSimpleAuth'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ Bundler::GemHelper.install_tasks
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'lib'
23
+ t.libs << 'test'
24
+ t.pattern = 'test/**/*_test.rb'
25
+ t.verbose = false
26
+ end
27
+
28
+
29
+ task default: :test
@@ -0,0 +1,25 @@
1
+ class EmberDeviseSimpleAuth::SessionsController < Devise::SessionsController
2
+ respond_to :html, :json
3
+
4
+ after_action :set_csrf_headers, only: [:create, :destroy]
5
+
6
+ before_filter :authenticate_user!, only: [:show]
7
+
8
+ def show
9
+ authenticate_user! force: true
10
+ render json: current_user
11
+ end
12
+
13
+ protected
14
+
15
+ def set_csrf_headers
16
+ if request.xhr?
17
+ response.headers['X-CSRF-Token'] = "#{form_authenticity_token}"
18
+ response.headers['X-CSRF-Param'] = "#{request_forgery_protection_token}"
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+
25
+
@@ -0,0 +1,5 @@
1
+ module EmberDeviseSimpleAuth
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace EmberDeviseSimpleAuth
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'json'
2
+ module EmberDeviseSimpleAuth
3
+ def self.version_from_package_json
4
+ pkg = File.read(File.expand_path("../../dist/bower.json"))
5
+ JSON.parse(pkg)["version"]
6
+ end
7
+
8
+ VERSION = version_from_package_json
9
+ end
@@ -0,0 +1,4 @@
1
+ require "ember_devise_simple_auth/engine"
2
+
3
+ module EmberDeviseSimpleAuth
4
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate install Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,19 @@
1
+ module EmberDeviseSimpleAuth
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def install_devise_routes
6
+
7
+ route_addition = "devise_scope :user do"
8
+ route_addition << %Q(\n get "/sessions/current" => "ember_devise_simple_auth/sessions#show")
9
+ route_addition << %Q(\n end\n)
10
+ route route_addition
11
+
12
+ gsub_file "config/routes.rb",
13
+ "devise_for :users",
14
+ "devise_for :users, controllers: { sessions: 'ember_devise_simple_auth/sessions' }"
15
+
16
+ end
17
+
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember_devise_simple_auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joe Fiorini
8
+ - Branden Wiegand
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 4.0.2
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 4.0.2
28
+ - !ruby/object:Gem::Dependency
29
+ name: devise
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 3.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: 3.0.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: sqlite3
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: This gem enhances the stock Devise::SessionsController to be slightly
57
+ more ajax friendly.
58
+ email:
59
+ - joe@d-i.co
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - MIT-LICENSE
65
+ - Rakefile
66
+ - app/controllers/ember_devise_simple_auth/sessions_controller.rb
67
+ - lib/ember_devise_simple_auth.rb
68
+ - lib/ember_devise_simple_auth/engine.rb
69
+ - lib/ember_devise_simple_auth/version.rb
70
+ - lib/generators/ember_devise_simple_auth/USAGE
71
+ - lib/generators/ember_devise_simple_auth/install_generator.rb
72
+ homepage: https://www.github.com/d-i/ember_devise_simple_auth
73
+ licenses: []
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.0
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Rails support for ember-devise-simple-auth Ember plugin.
95
+ test_files: []