alterego 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/.travis.yml +1 -0
  2. data/Gemfile +3 -3
  3. data/README.rdoc +40 -24
  4. data/Rakefile +2 -10
  5. data/VERSION +1 -1
  6. data/alterego.gemspec +14 -13
  7. metadata +23 -22
@@ -0,0 +1 @@
1
+ rvm: 1.9.2
data/Gemfile CHANGED
@@ -5,10 +5,10 @@ gem 'json'
5
5
 
6
6
  # Add dependencies to develop your gem here.
7
7
  group :development do
8
- gem 'bundler', '~> 1.0.0'
8
+ gem 'bundler', '> 1.0.0'
9
9
  gem 'fakeweb'
10
10
  gem 'guard-rspec'
11
- gem 'jeweler', '~> 1.6.4'
12
- gem 'rcov'
11
+ gem 'jeweler', '> 1.6.4'
12
+ gem 'simplecov'
13
13
  gem 'rspec'
14
14
  end
@@ -1,4 +1,4 @@
1
- = AlterEgo
1
+ = AlterEgo {<img src="http://travis-ci.org/terra-firma/alterego.png" />}[http://travis-ci.org/terra-firma/alterego] {<img src="https://gemnasium.com/terra-firma/alterego.png" alt="Dependency Status" />}[https://gemnasium.com/terra-firma/alterego]
2
2
 
3
3
  AlterEgo is a Ruby gem for integrating {AlterEgo}[https://alteregoapp.com] two-factor authentication into your web application. You'll need an {AlterEgo account}[https://alteregoapp.com/#signupfree] in order to register your {register your app}[https://alteregoapp.com/app/register] and get your "App Authentication ID".
4
4
 
@@ -6,9 +6,17 @@ AlterEgo is a Ruby gem for integrating {AlterEgo}[https://alteregoapp.com] two-f
6
6
 
7
7
  (sudo) gem install alterego
8
8
 
9
- == Authorizing Your Application
9
+ == Usage
10
10
 
11
- In order to use AlterEgo, users of your application will need to sign up for their own {AlterEgo account}[https://alteregoapp.com/#signupfree]. You will need your users to authorize the connection between your application and {AlterEgo}[https://alteregoapp.com] by simply redirecting them:
11
+ To start with, you will need an {AlterEgo account}[https://alteregoapp.com/#signup] as a developer so that you can register your app. People that want to use your application will also need to {signup for an AlterEgo account}[https://alteregoapp.com/#signup] (obviously) as well.
12
+
13
+ === Register Your App
14
+
15
+ {Login to your AlterEgo account}[https://alteregoapp.com/app/] and click "{register a new app}[https://alteregoapp.com/app/register]" on the "Developer" page. Once your app is registered, you will get an "App Authentication ID", which we refer to in this document at the "App ID". You're now ready to get started.
16
+
17
+ === Connect Your App
18
+
19
+ The first thing you will need to do is prompt your users to authorize the connection between your application and {AlterEgo}[https://alteregoapp.com]. Once they are logged in, simply redirect them:
12
20
 
13
21
  redirect_to AlterEgo.authorization_url("your_app_id", "https://yourapp.com/alterego/callback")
14
22
 
@@ -19,28 +27,37 @@ In order to use AlterEgo, users of your application will need to sign up for the
19
27
 
20
28
  Once authorized successfully, a POST request will be sent to the +redirect_url+ with a "key" parameter containing the API key for that user's {AlterEgo}[https://alteregoapp.com] account. Be sure to store this key somewhere, as you will need it to run API requests later. If authorization fails for some reason, an "error" parameter will be present in the POST request, containing an error message.
21
29
 
22
- if params[:key]
23
- current_user.alter_ego_key = params[:key]
24
- elsif params[:error]
25
- flash[:alert] = params[:error]
30
+ def callback
31
+ # POST /alterego/callback
32
+ if params[:key]
33
+ current_user.alter_ego_key = params[:key]
34
+ current_user.save
35
+ ...
36
+ elsif params[:error]
37
+ flash[:alert] = params[:error]
38
+ ...
39
+ end
26
40
  end
27
41
 
28
- == Authenticating With AlterEgo
42
+ As you can see, we are saving the key that AlterEgo returns for the currently logged in user, and we have successfully connected this user account to AlterEgo.
43
+
44
+ === Authenticating With AlterEgo
29
45
 
30
- Once your users have authorized your application and you have retrieved an API key for their account, you can easily integrate two-factor authentication. To authenticate using {AlterEgo}[https://alteregoapp.com] (either as part of an existing login process, or as a stand-alone authentication system) simply prompt the user to input a valid {AlterEgo}[https://alteregoapp.com] passcode and verify it:
46
+ Once the user account has been connected, you can easily integrate two-factor authentication into your app, either as part of an existing login process, or as a stand-alone authentication system. In most cases, {AlterEgo}[https://alteregoapp.com] is integrated into an existing authentication system such that once the user has provided the correct username/password combination, they are then asked to provide a valid {AlterEgo}[https://alteregoapp.com] passcode to finalize the login process:
31
47
 
32
- passcode = params[:alter_ego_passcode]
33
- if AlterEgo.password(current_user.alter_ego_key, passcode)
34
- # Passcode is valid.
35
- ...
36
- else
37
- # Passcode is not valid.
38
- ...
48
+ def verify
49
+ # POST /alterego/verify
50
+ passcode = params[:alter_ego_passcode]
51
+ if AlterEgo.password(current_user.alter_ego_key, passcode)
52
+ # Passcode is valid, log this user in...
53
+ else
54
+ # Passcode is not valid.
55
+ end
39
56
  end
40
57
 
41
58
  {AlterEgo}[https://alteregoapp.com] does not provide any kind of error message or explanation as to why a passcode is not valid, so you will want to be sure and keep your error messages appropriately generic.
42
59
 
43
- == Pinging The API
60
+ === Pinging The API
44
61
 
45
62
  The {AlterEgo}[https://alteregoapp.com] API also has a method for pinging the API, in case you want to periodically check to ensure that your user's API keys are still valid. A successful ping to the API will always return "PONG!" as a response.
46
63
 
@@ -48,16 +65,15 @@ The {AlterEgo}[https://alteregoapp.com] API also has a method for pinging the AP
48
65
 
49
66
  == Contributing to AlterEgo
50
67
 
51
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
52
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
53
- * Fork the project
54
- * Start a feature/bugfix branch
55
- * Commit and push until you are happy with your contribution
68
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
69
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
70
+ * Fork the project.
71
+ * Start a feature/bugfix branch.
72
+ * Commit and push until you are happy with your contribution.
56
73
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
57
74
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
58
75
 
59
76
  == Copyright
60
77
 
61
- Copyright (c) 2011 Brian Getting. See LICENSE.txt for
62
- further details.
78
+ Copyright (c) 2011 Terra Firma Design & Consulting. See LICENSE.txt for further details.
63
79
 
data/Rakefile CHANGED
@@ -15,11 +15,11 @@ require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "alterego"
18
- gem.homepage = "http://github.com/terra-firma/alterego"
18
+ gem.homepage = "http://github.com/tatemae-consultancy/alterego"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{Ruby gem for interacting with the AlterEgo API.}
21
21
  gem.description = %Q{AlterEgo is a Ruby gem for integrating two-factor authentication into your web application.}
22
- gem.email = "brian@terra-firma-design.com"
22
+ gem.email = "brian@tatem.ae"
23
23
  gem.authors = ["Brian Getting"]
24
24
  # dependencies defined in Gemfile
25
25
  end
@@ -32,14 +32,6 @@ Rake::TestTask.new(:test) do |test|
32
32
  test.verbose = true
33
33
  end
34
34
 
35
- require 'rcov/rcovtask'
36
- Rcov::RcovTask.new do |test|
37
- test.libs << 'test'
38
- test.pattern = 'test/**/test_*.rb'
39
- test.verbose = true
40
- test.rcov_opts << '--exclude "gems/*"'
41
- end
42
-
43
35
  task :default => :test
44
36
 
45
37
  require 'rdoc/task'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -5,19 +5,20 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{alterego}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Brian Getting}]
12
- s.date = %q{2011-10-17}
12
+ s.date = %q{2012-08-02}
13
13
  s.description = %q{AlterEgo is a Ruby gem for integrating two-factor authentication into your web application.}
14
- s.email = %q{brian@terra-firma-design.com}
14
+ s.email = %q{brian@tatem.ae}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".travis.yml",
21
22
  "Gemfile",
22
23
  "Guardfile",
23
24
  "LICENSE.txt",
@@ -30,7 +31,7 @@ Gem::Specification.new do |s|
30
31
  "spec/alterego/fixtures/error.json",
31
32
  "spec/spec_helper.rb"
32
33
  ]
33
- s.homepage = %q{http://github.com/terra-firma/alterego}
34
+ s.homepage = %q{http://github.com/tatemae-consultancy/alterego}
34
35
  s.licenses = [%q{MIT}]
35
36
  s.require_paths = [%q{lib}]
36
37
  s.rubygems_version = %q{1.8.8}
@@ -41,28 +42,28 @@ Gem::Specification.new do |s|
41
42
 
42
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
44
  s.add_runtime_dependency(%q<json>, [">= 0"])
44
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
+ s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
45
46
  s.add_development_dependency(%q<fakeweb>, [">= 0"])
46
47
  s.add_development_dependency(%q<guard-rspec>, [">= 0"])
47
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
48
- s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ s.add_development_dependency(%q<jeweler>, ["> 1.6.4"])
49
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
49
50
  s.add_development_dependency(%q<rspec>, [">= 0"])
50
51
  else
51
52
  s.add_dependency(%q<json>, [">= 0"])
52
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
53
54
  s.add_dependency(%q<fakeweb>, [">= 0"])
54
55
  s.add_dependency(%q<guard-rspec>, [">= 0"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
56
- s.add_dependency(%q<rcov>, [">= 0"])
56
+ s.add_dependency(%q<jeweler>, ["> 1.6.4"])
57
+ s.add_dependency(%q<simplecov>, [">= 0"])
57
58
  s.add_dependency(%q<rspec>, [">= 0"])
58
59
  end
59
60
  else
60
61
  s.add_dependency(%q<json>, [">= 0"])
61
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
62
63
  s.add_dependency(%q<fakeweb>, [">= 0"])
63
64
  s.add_dependency(%q<guard-rspec>, [">= 0"])
64
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
65
- s.add_dependency(%q<rcov>, [">= 0"])
65
+ s.add_dependency(%q<jeweler>, ["> 1.6.4"])
66
+ s.add_dependency(%q<simplecov>, [">= 0"])
66
67
  s.add_dependency(%q<rspec>, [">= 0"])
67
68
  end
68
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alterego
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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: 2011-10-17 00:00:00.000000000Z
12
+ date: 2012-08-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &2153522520 !ruby/object:Gem::Requirement
16
+ requirement: &2153238280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153522520
24
+ version_requirements: *2153238280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &2153520800 !ruby/object:Gem::Requirement
27
+ requirement: &2153237180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ~>
30
+ - - ! '>'
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153520800
35
+ version_requirements: *2153237180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fakeweb
38
- requirement: &2153518960 !ruby/object:Gem::Requirement
38
+ requirement: &2153235820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153518960
46
+ version_requirements: *2153235820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard-rspec
49
- requirement: &2153517220 !ruby/object:Gem::Requirement
49
+ requirement: &2153234600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,21 +54,21 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153517220
57
+ version_requirements: *2153234600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &2153515440 !ruby/object:Gem::Requirement
60
+ requirement: &2153232340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - ! '>'
64
64
  - !ruby/object:Gem::Version
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153515440
68
+ version_requirements: *2153232340
69
69
  - !ruby/object:Gem::Dependency
70
- name: rcov
71
- requirement: &2153512980 !ruby/object:Gem::Requirement
70
+ name: simplecov
71
+ requirement: &2153231140 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153512980
79
+ version_requirements: *2153231140
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2153510180 !ruby/object:Gem::Requirement
82
+ requirement: &2153230140 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153510180
90
+ version_requirements: *2153230140
91
91
  description: AlterEgo is a Ruby gem for integrating two-factor authentication into
92
92
  your web application.
93
- email: brian@terra-firma-design.com
93
+ email: brian@tatem.ae
94
94
  executables: []
95
95
  extensions: []
96
96
  extra_rdoc_files:
@@ -98,6 +98,7 @@ extra_rdoc_files:
98
98
  - README.rdoc
99
99
  files:
100
100
  - .document
101
+ - .travis.yml
101
102
  - Gemfile
102
103
  - Guardfile
103
104
  - LICENSE.txt
@@ -109,7 +110,7 @@ files:
109
110
  - spec/alterego/alterego_spec.rb
110
111
  - spec/alterego/fixtures/error.json
111
112
  - spec/spec_helper.rb
112
- homepage: http://github.com/terra-firma/alterego
113
+ homepage: http://github.com/tatemae-consultancy/alterego
113
114
  licenses:
114
115
  - MIT
115
116
  post_install_message:
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
125
  version: '0'
125
126
  segments:
126
127
  - 0
127
- hash: -3242706057364793623
128
+ hash: -803280784846671092
128
129
  required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  none: false
130
131
  requirements: