HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
binarylogic
authlogic
Ruby2010–2014
binarylogic / authlogic

authlogic

A simple ruby authentication solution.

16Distinct people
16Mentions
0Explicit recommenders
4.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A simple ruby authentication solution.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 6:01:08 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year16 dated mentions

Observed mentions: 2010-05-05 02:40:10 UTC to 2014-12-20 08:02:19 UTC.

0123452010-01-01 00:00:00 UTC to 2011-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20102011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2014

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20102010-01-01 00:00:00 UTC2011-01-01 00:00:00 UTC303
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC514
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC202
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC505
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Authlogic An unobtrusive ruby authentication library based on ActiveRecord. Documentation Version Documentation Unreleased https://github.com/binarylogic/authlogic/blob/master/README.md 6.6.1 https://github.com/binarylogic/authlogic/blob/v6.6.1/README.md 6.5.0 https://github.com/binarylogic/authlogic/blob/v6.5.0/README.md 6.4.3 https://github.com/binarylogic/authlogic/blob/v6.4.3/README.md 5.2.0 https://github.com/binarylogic/authlogic/blob/v5.2.0/README.md 4.5.0 https://github.com/binarylogic/authlogic/blob/v4.5.0/README.md 3.7.0 https://github.com/binarylogic/authlogic/blob/v3.7.0/README.md 2.1.11 https://github.com/binarylogic/authlogic/blob/v2.1.11/README.rdoc 1.4.3 https://github.com/binarylogic/authlogic/blob/v1.4.3/README.rdoc Table of Contents 1. Introduction 1.a. Overview 1.b. Reference Documentation 1.c. Installation 2. Rails 2.a. The users table 2.b. Controller 2.b.1. Helper Methods 2.b.2. Routes 2.b.3. ActionController::API 2.c. View 2.d. CSRF Protection 3. Testing 4. Helpful links 5. Add-ons 6. Internals 7. Extending 90. Compatibility 1. Introduction 1.a. Overview Authlogic introduces a new type of model. You can have as many as you want, and name them whatever you want, just like your other models. In this example, we want to authenticate with our User model, which is inferred from the name: class UserSession < Authlogic::Session::Base # specify configuration here, such as: # logout_on_timeout true # ...many more options in the documentation end In a UserSessionsController, login the user by using it just like your other models: UserSession.create(:login => "bjohnson", :password => "my password", :remember_me => true) session = UserSession.new(:login => "bjohnson", :password => "my password", :remember_me => true) session.save # requires the authlogic-oid "add on" gem UserSession.create(:openid_identifier => "identifier", :remember_me => true) # skip authentication and log the user in directly, the true means "remember me" UserSession.create(my_user_object, true) The above handles the entire authentication process for you by: authenticating (i.e. validating the record) sets up the proper session values and cookies to persist the session (i.e. saving the record). You can also log out (i.e. destroying the session): session.destroy After a session has been created, you can persist it (i.e. finding the record) across requests. Thus keeping the user logged in: session = UserSession.find To get all of the nice authentication functionality in your model just do this: class User < ApplicationRecord acts_as_authentic do |c| c.my_config_option = my_value end # the configuration block is optional end It is also "smart" in the sense that if a login or username field is present it will use that to authenticate, if not it will look for an email field. This is all configurable, but for 99% of cases the above is all you will need to do. You may specify how passwords are cryptographically hashed (or encrypted) by setting the Authlogic::CryptoProvider option: c.crypto_provider = Authlogic::CryptoProviders::BCrypt Also, sessions are automatically maintained. You can switch this on and off with configuration, but the following will automatically log a user in after a successful registration: User.create(params[:user]) You can switch this on and off with the following configuration: class User < ApplicationRecord acts_as_authentic do |c| c.log_in_after_create = false end # the configuration block is optional end Authlogic also updates the session when the user changes his/her password. You can also switch this on and off with the following configuration: class User < ApplicationRecord acts_as_authentic do |c| c.log_in_after_password_change = false end # the configuration block is optional end Authlogic is very flexible, it has a strong public API and a plethora of hooks to allow you to modify behavior and extend it. Check out the helpful links below to dig deeper. 1.b. Reference Documentation This README is just an introduction, but we also have reference documentation. To use the reference documentation, you must understand how Authlogic's code is organized. There are 2 models, your Authlogic model and your ActiveRecord model: Authlogic::Session, your session models that extend Authlogic::Session::Base. Authlogic::ActsAsAuthentic, which adds in functionality to your ActiveRecord model when you call acts_as_authentic. 1.c. Installation To install Authlogic, add this to your Gemfile: gem 'authlogic' And run bundle install. 2. Rails Let's walk through a typical Rails setup. (Compatibility) 2.a.1 The users table If you want to enable all the features of Authlogic, a migration to create a User model might look like this: class CreateUser < ActiveRecord::Migration def change create_table :users do |t| # Authlogic::ActsAsAuthentic::Email t.string :email t.index :email, unique: true # Authlogic::ActsAsAuthentic::Login t.string :login # Authlogic::ActsAsAuthentic::Password t.string :crypted_password t.string :password_salt # Authlogic::ActsAsAuthentic::PersistenceToken t.string :persistence_token t.index :persistence_token, unique: true # Authlogic::ActsAsAuthentic::SingleAccessToken t.string :single_access_token t.index :single_access_token, unique: true # Authlogic::ActsAsAuthentic::PerishableToken t.string :perishable_token t.index :perishable_token, unique: true # See "Magic Columns" in Authlogic::Session::Base t.integer :login_count, default: 0, null: false t.integer :failed_login_count, default: 0, null: false t.datetime :last_request_at t.datetime :current_login_at t.datetime :last_login_at t.string :current_login_ip t.string :last_login_ip # See "Magic States" in Authlogic::Session::Base t.boolea
Read the full README on GitHub

What Hacker News says

2 sources
Unless you're providing an API/external access for your users, you can just use authentication internal to your app. It's pretty easy to roll your own (here's a tutorial for doing it in RoR: http://www.aidanf.net/rails_user_authentication_tutorial), but I would recommend using a popular plugin/middleware if you can find it for your language/framework so you don't have to worry as much about security. For node/Express, passport.js is a good option (but doesn't help you out with the database at all) -- http://passportjs.org/guide/username-password.html Django has basic user authentication built-in, Ruby on Rails has Devise - https://github.com/plataformatec/devise and AuthLogic - https://github.com/binarylogic/authlogic. I'd recommend reading the Ruby on Rails security guide about user management to get an idea of some of the challenges in
Read the rest
building an authentication system: http://guides.rubyonrails.org/security.html#user-management If you want to write an OAuth provider here's a great PHP tutorial: http://djpate.com/2011/01/13/how-to-write-a-complete-oauth-p...
In OAuth & One-Page Apps: Avoiding the Redirect

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.