dumb_auth 0.0.1

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
+ SHA1:
3
+ metadata.gz: e948647d38b9c11c69d271dd5124e6c475efb8cb
4
+ data.tar.gz: 1d0b3932a26a2b4c826fe48d63f9624c45cb9ae3
5
+ SHA512:
6
+ metadata.gz: a27938584ea2b7bee522f070a3229a413f9bfc5e4549acd05089d43e9a86b4863f7180cda487e4d443febdcf2f58883c6f1530ef6de00138a8d1b849b2ad8777
7
+ data.tar.gz: 34866cf59813b86eb600aaeebf2e7d24d77d6f5d33dbf33d85a90e617ce6bf8de695234c98b74e3394badc489defa732d2abde651cdbb29c276d1296a8c058ab
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 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/README.md ADDED
@@ -0,0 +1,31 @@
1
+ What is DumbAuth
2
+ ==================
3
+
4
+ The dumbest authentication gem ever! It works like this ([as specified in the tests](test/controllers/sessions_controller_test.rb)):
5
+
6
+ * POST to the `login_path` and `logged_in?` will return `true` for the rest of the session
7
+ * DELETE to the `logout_path` and `logged_in?` will return `false` for the rest of the session
8
+
9
+ How to install
10
+ ==============
11
+
12
+ Just add the `dumb_auth` gem to your `Gemfile`, bundle, and you will get access to the `login` (POST) route, `logout` (DELETE) route and `logged_in?` method, accessible both in your controllers and helpers.
13
+
14
+ Note that DumbAuth requires `ApplicationController` to exist in the app where it is installed.
15
+
16
+ Why is it useful
17
+ ================
18
+
19
+ Deciding which (smart) authentication gem to use in a Rails project takes time.
20
+ Often, you do not want/need to spend this time at the *beginning* of the project: you simply want to show different pages when the user is logged in or out.
21
+ If you start with `DumbAuth`, you get exactly this, without wasting precious time at the beginning of a project.
22
+
23
+ How to contribute
24
+ =================
25
+
26
+ Fork the project, edit the code, make sure the tests pass by running `rake`, commit and submit a Github pull request.
27
+ Thanks! :)
28
+
29
+ License
30
+ =======
31
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
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
+ Bundler::GemHelper.install_tasks
10
+
11
+ require 'rake/testtask'
12
+
13
+ Rake::TestTask.new(:test) do |t|
14
+ t.libs << 'lib'
15
+ t.libs << 'test'
16
+ t.pattern = 'test/**/*_test.rb'
17
+ t.verbose = false
18
+ end
19
+
20
+ task default: :test
@@ -0,0 +1,11 @@
1
+ class SessionsController < ApplicationController
2
+ def create
3
+ session[:logged_in] = true
4
+ redirect_to :back, notice: 'Logged in!'
5
+ end
6
+
7
+ def destroy
8
+ session[:logged_in] = false
9
+ redirect_to :back, notice: 'Logged out!'
10
+ end
11
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ post 'auth/sessions', to: 'sessions#create', as: :login
3
+ delete 'auth/sessions', to: 'sessions#destroy', as: :logout
4
+ end
data/lib/dumb_auth.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "dumb_auth/engine"
2
+
3
+ module DumbAuth
4
+ end
@@ -0,0 +1,16 @@
1
+ module DumbAuth
2
+ module ApplicationControllerExtensions
3
+ def logged_in?
4
+ session[:logged_in]
5
+ end
6
+ end
7
+
8
+ class Engine < ::Rails::Engine
9
+ initializer 'dumb_auth.app_controller' do
10
+ ActiveSupport.on_load(:action_controller) do
11
+ include ApplicationControllerExtensions
12
+ helper_method 'logged_in?'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module DumbAuth
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dumb_auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - claudiob
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0.rc1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0.rc1
27
+ description: Provides two routes (POST login, DELETE logout) and a controller method/helper
28
+ logged_in?
29
+ email:
30
+ - claudiob@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - app/controllers/sessions_controller.rb
36
+ - config/routes.rb
37
+ - lib/dumb_auth/engine.rb
38
+ - lib/dumb_auth/version.rb
39
+ - lib/dumb_auth.rb
40
+ - MIT-LICENSE
41
+ - Rakefile
42
+ - README.md
43
+ homepage: http://github.com/claudiob/dumb_auth
44
+ licenses: []
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.0.0
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: The dumbest authentication gem ever!
66
+ test_files: []