google_auth 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,18 +2,24 @@
2
2
 
3
3
  ## What
4
4
 
5
- GoogleAuth is a convenience wrapper around `omniauth-google-apps` that
6
- makes a lot of assumptions, and requires less setup.
5
+ GoogleAuth is a very, very trivial convenience wrapper around `omniauth-google-apps` that
6
+ makes a lot of assumptions, and requires much less setup.
7
7
 
8
8
  ## How
9
9
 
10
- # Gemfile
10
+ #### 1. Your user model must have the string fields `name`, `email`, and `uid`.
11
+
12
+ #### 2. Add to your Gemfile:
13
+
11
14
  gem 'google_auth'
12
15
 
16
+ #### 3. Create an initializer:
17
+
13
18
  # config/initializers/google_auth.rb
14
19
  Rails.application.config.google_auth.domain = 'yourgoogleappsdomain.com'
15
20
  # other options: 'user_class', 'path'. See source for details.
16
21
 
17
- # Whichever controller you want behind the login-wall
22
+ #### 4. Set up whichever controller(s) you want protected:
23
+
18
24
  include GoogleAuth::Controller
19
25
 
@@ -13,7 +13,7 @@ class SessionsController < ApplicationController
13
13
  user.save!
14
14
 
15
15
  session[:user_id] = user.id
16
- redirect_to session[:redirect] || root_url
16
+ redirect_to session[:redirect] || GoogleAuth.default_redirect_path
17
17
  else
18
18
  render '/auth/failure'
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleAuth
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/google_auth.rb CHANGED
@@ -14,8 +14,12 @@ module GoogleAuth
14
14
  'g'
15
15
  end
16
16
 
17
+ def self.default_redirect_path
18
+ Rails.application.config.google_auth.default_redirect_path || "/"
19
+ end
20
+
17
21
  def self.user_class
18
- klass = Rails.application.config.google_auth.path
22
+ klass = Rails.application.config.google_auth.user_class
19
23
  return klass if klass
20
24
 
21
25
  begin
@@ -25,4 +29,4 @@ module GoogleAuth
25
29
  end
26
30
  end
27
31
 
28
- end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-10 00:00:00.000000000 Z
12
+ date: 2012-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-google-apps
16
- requirement: &70187256837100 !ruby/object:Gem::Requirement
16
+ requirement: &70304295909800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70187256837100
24
+ version_requirements: *70304295909800
25
25
  description: ! 'Convenience wrapper for omniauth-google-apps: Makes a lot of assumptions,
26
26
  requires less configuration.'
27
27
  email:
@@ -66,3 +66,4 @@ signing_key:
66
66
  specification_version: 3
67
67
  summary: Convenience wrapper of omniauth-google-apps
68
68
  test_files: []
69
+ has_rdoc: