Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwahler committed Feb 21, 2012
1 parent dd95c30 commit b6d2bf8
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 13 deletions.
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2012 GearheadForHire, LLC

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
57 changes: 47 additions & 10 deletions README.markdown
@@ -1,24 +1,54 @@
RailsApp
========
Two Factor Authentication Example
=================================

An example application for the AuthlogicTwoFactor Gem
A bare bones example Rails 3.2 application demonstrating the use of the
[Authlogic](https://github.com/binarylogic/authlogic) gem and custom
[two-factor authentication](http://en.wikipedia.org/wiki/Two-factor_authentication>)
with [Google authenticator](http://code.google.com/p/google-authenticator/) support.

Dependencies
------------

Example Usage
-------------
### Runtime

* Authlogic for authentication <http://github.com/binarylogic/authlogic>
* ROTP for one time passwords <http://github.com/mdp/rotp>
* RQRCode for QR codes <http://github.com/whomwah/rqrcode>

### Development

* Rspec for unit testing <http://github.com/rspec/rspec>
* Cucumber for functional testing <http://github.com/cucumber/cucumber>


Usage
-----
git clone http://github.com/robertwahler/two_factor_authentication_example
cd two_factor_authentication_example

bundle install
rake db:seed
rails s

login: admin
password: admin
Google Authenticator time based two_factor_secret (spaces are optional): v6na sf4k fe45 qxbq

firefox http://localhost:3000

run the RSpec test suite

rspec

Example Generation
------------------

Additional References
---------------------

* <https://github.com/moomerman/two_factor_auth_rails>


Initial Example Application Generation
--------------------------------------

rails version

Expand All @@ -28,11 +58,13 @@ rails version

generate basic rails application

rails new rails_app --skip-bundle -T
rails new two_factor_authentication_example --skip-bundle -T

Gemfile

gem "authlogic", "~> 3.1.0"
gem "rotp", "~> 1.3.2"
gem "rqrcode", "~> 0.4.2"

group :test, :development do
gem "ruby-debug"
Expand Down Expand Up @@ -61,7 +93,12 @@ add admin user seed

rake db:seed

Example Updating
-----------------
Updating
--------

rails new .

Copyright
---------

Copyright (c) 2012 GearheadForHire, LLC. See [LICENSE](LICENSE) for details.
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -50,7 +50,7 @@

<p>
<b>Two factor secret:</b>
<%=h @user.two_factor_secret %>
<%=h @user.two_factor_secret.scan(/.{4}/).join(' ') if @user.two_factor_secret %>
</p>

<% if @qr -%>
Expand Down
9 changes: 7 additions & 2 deletions db/seeds.rb
Expand Up @@ -15,8 +15,13 @@
:password_confirmation => 'admin'
)

# overwrite with a known secret
user.two_factor_secret = 'v6nasf4kfe45qxbq'
user.save!

puts "demo application seed login details:"
puts "login: #{user.login}"
puts "password: #{user.password}"
puts "two_factor_secret: #{user.two_factor_secret}"

puts
puts "Google Authenticator time based two_factor_secret (spaces optional): #{user.two_factor_secret.scan(/.{4}/).join(' ')}"
puts

0 comments on commit b6d2bf8

Please sign in to comment.