forked from binarylogic/authlogic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae1d3bb
commit 35f14ba
Showing
24 changed files
with
624 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
require "digest/sha2" | ||
require "authgasm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Authgasm | ||
module ControllerAdapters # :nodoc: | ||
# = Abstract Adapter | ||
# Allows you to use Authgasm in any framework you want, not just rails. See tha RailsAdapter for an example of how to adapter Authgasm to work with your framework. | ||
class AbstractAdapter | ||
attr_accessor :controller | ||
|
||
def initialize(controller) | ||
self.controller = controller | ||
end | ||
|
||
def authenticate_with_http_basic(*args, &block) | ||
end | ||
|
||
def cookies | ||
end | ||
|
||
def request | ||
end | ||
|
||
def session | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Authgasm | ||
module ControllerAdapters | ||
# = Rails Adapter | ||
# Adapts authgasm to work with rails. The point is to close the gap between what authgasm expects and what the rails controller object | ||
# provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc. | ||
class RailsAdapter < AbstractAdapter | ||
def authenticate_with_http_basic(*args, &block) | ||
controller.authenticate_with_http_basic(*args, &block) | ||
end | ||
|
||
def cookies | ||
controller.send(:cookies) | ||
end | ||
|
||
def request | ||
controller.request | ||
end | ||
|
||
def session | ||
controller.session | ||
end | ||
end | ||
|
||
# = Rails Implementation | ||
# Lets Authgasm know about the controller object, AKA "activates" authgasm. | ||
module RailsImplementation | ||
def self.included(klass) # :nodoc: | ||
klass.prepend_before_filter :set_controller | ||
end | ||
|
||
private | ||
def set_controller | ||
Authgasm::Session::Base.controller = RailsAdapter.new(self) | ||
end | ||
end | ||
end | ||
end | ||
|
||
ActionController::Base.send(:include, Authgasm::ControllerAdapters::RailsImplementation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.