https://github.com/sixarm/sixarm_ruby_sign_out
SixArm.com » Ruby » SignOut abstract interface for apps
https://github.com/sixarm/sixarm_ruby_sign_out
authentication gem rails ruby
Last synced: 2 months ago
JSON representation
SixArm.com » Ruby » SignOut abstract interface for apps
- Host: GitHub
- URL: https://github.com/sixarm/sixarm_ruby_sign_out
- Owner: SixArm
- License: other
- Created: 2010-05-25T04:49:22.000Z (about 16 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T09:21:12.000Z (about 1 year ago)
- Last Synced: 2026-01-28T17:42:18.055Z (5 months ago)
- Topics: authentication, gem, rails, ruby
- Language: Ruby
- Homepage: http://sixarm.com
- Size: 363 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# SixArm.com → Ruby →
SignOut abstract interface for apps
[](http://badge.fury.io/rb/sixarm_ruby_sign_out)
[](https://travis-ci.org/SixArm/sixarm_ruby_sign_out)
[](https://codeclimate.com/github/SixArm/sixarm_ruby_sign_out/maintainability)
* Git:
* Doc:
* Gem:
* Contact: Joel Parker Henderson,
* Project: [changes](CHANGES.md), [license](LICENSE.md), [contributing](CONTRIBUTING.md).
## Introduction
SignOut is a simple abstract interface for apps.
You can include this module in a Rails application controller,
then your controller can define any of these concrete methods.
For docs go to
Want to help? We're happy to get pull requests.
## Install
### Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_sign_out
### Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_sign_out'
### Require
To require the gem in your code:
require 'sixarm_ruby_sign_out'
## Details
This provides one top-level method:
sign_out(options=nil) => true for success, false for failure
The top level method will call mid-level methods
that you will define in your own controller.
sign_out calls:
sign_out_attempt(options=nil), e.g. unset the current user
sign_out_success(options=nil), e.g. redirect to a goodbye page
sign_out_failure(options=nil), e.g. flash warning help message
## AuthLogic Example
AuthLogic provides this example:
def destroy
current_user_session.destroy
redirect_to new_user_session_url
end
The same example written using Sign Out to provide better structure and security:
def sign_out_attempt
current_user_session.destroy
current_user_session.frozen? or raise SecurityError, "Problem with sign out ... ", caller
end
def sign_out_success
redirect_to new_user_session_url
end
def sign_out_failure
# The AuthLogic example doesn't handle this case unfortunately;
# we should handle it because it indicates something is amiss.
end