foyer 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7b52e3b4d9a31b491c4b49eb4b6df196df66eba
4
- data.tar.gz: bef81cb0602a6812eb29a53d113ed2a9c524dd49
3
+ metadata.gz: af5cb236dc4e724cfcc0e93c0b595257dbd3209d
4
+ data.tar.gz: 14bf2bfdc8a8c2a7cc0f3fc3f7024a3d312b2da3
5
5
  SHA512:
6
- metadata.gz: 91440e9420e1ac33b39c437a1468a94abd0031fb12a306b56defe59ab9cbe416efd61dabbc162f29c23d44879315a48035cba13421d55b902c886a94139934ca
7
- data.tar.gz: 46ae76bee314261f51fe6dc7a7f22eeebeb901a7d6aac83943620a9741ecc690eb5e1727b9b669fc43de313e855a7030b36165c0f8df8d9959f1ece73c2452b6
6
+ metadata.gz: c40bfe2653f1a3d675be903bb880ddae30d1cd3bd707c0f6c101c294ddaeac2d1e26a4106de5c7690a303e2cc11e689e4bf4347f0a2267a6a2892f427e8fdaee
7
+ data.tar.gz: 304fcf02a5b52432cd7bd9b64273586e1570f9b1c01f94f69031c87e8dc087ea573e1188b25f6a828089fd45a244e6d98f8e356918774e4fcf84783c11204b5a
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  spec/dummy/log/
19
+ .ruby-version
data/README.md CHANGED
@@ -14,7 +14,8 @@ implementating controller action that will call the `sign_in` method:
14
14
 
15
15
  ```ruby
16
16
  Rails.application.routes.draw do
17
- get '/auth/:provider/callback', to: 'omniauth_callbacks#callback'
17
+ match '/auth/:provider/callback', to: 'omniauth_callbacks#callback', via: [:get, :post]
18
+ match '/auth/failure', to: 'omniauth_callbacks#failure', via: :get
18
19
  end
19
20
  ```
20
21
 
@@ -27,6 +28,9 @@ Then in your ApplicationController:
27
28
  class ApplicationController < ActionController::Base
28
29
  include Foyer::Controller::Helpers
29
30
 
31
+ # Require authentication for all routes.
32
+ before_action authenticate_user!
33
+
30
34
  set_user_finder do |user_id|
31
35
  # Code for retrieving a user from your database here
32
36
  # e.g.:
@@ -117,6 +121,10 @@ You can inherit from it in your application.
117
121
  Example:
118
122
  ```ruby
119
123
  class OmniauthCallbacksController < Foyer::OmniauthCallbacksController
124
+ def failure
125
+ redirect_to root_path, notice: 'Authentication failed!'
126
+ end
127
+
120
128
  def callback
121
129
  user = User.find_or_initialize_by(uid: auth_hash.uid.to_s) do |u|
122
130
  u.email = auth_hash.info.email
@@ -2,6 +2,14 @@ module Foyer
2
2
  class OmniauthCallbacksController < ActionController::Base
3
3
  include Controller::Helpers
4
4
 
5
+ def passthru
6
+ head :not_found
7
+ end
8
+
9
+ def failure
10
+ fail NotImplementedError
11
+ end
12
+
5
13
  def callback
6
14
  fail NotImplementedError
7
15
  end
data/lib/foyer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Foyer
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Nochlin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.2.2
167
+ rubygems_version: 2.2.5
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Authentication layer for OmniAuth