heedley-merb-auth-with-account 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
= heedley-merb-auth-with-account
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{merb-auth-with-account}
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.date = %q{2008-12-23}
|
5
|
+
s.summary = %q{strategy to authenticate users on per account basis}
|
6
|
+
s.email = "hedley.robertson@gmail.com"
|
7
|
+
s.homepage = %q{http://github.com/heedley/merb-pagination/tree/master}
|
8
|
+
s.require_paths = ["lib"]
|
9
|
+
s.description = %q{strategy to authenticate users on per account basis}
|
10
|
+
s.has_rdoc = true
|
11
|
+
s.authors = ["Hedley Robertson"]
|
12
|
+
s.files = ["heedley-merb-auth-with-account.gemspec",
|
13
|
+
"lib/heedley-merb-auth-with-account.rb",
|
14
|
+
"lib/heedley-merb-auth-with-account/strategies/password_form_with_account.rb",
|
15
|
+
"README.txt"
|
16
|
+
]
|
17
|
+
s.rdoc_options = ["--main", "README.txt"]
|
18
|
+
s.extra_rdoc_files = ["README.txt"]
|
19
|
+
s.add_dependency(%q<merb-core>, [">= 0.9"])
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
# make sure we're running inside Merb
|
5
|
+
if defined?(Merb::Plugins)
|
6
|
+
Merb.logger.info "heedley-merb-auth-with-account online"
|
7
|
+
|
8
|
+
# Register the strategies so that plugins and apps may utilize them
|
9
|
+
basic_path = File.expand_path(File.dirname(__FILE__)) / "heedley-merb-auth-with-account" / "strategies"
|
10
|
+
|
11
|
+
Merb::Authentication.register(:password_form_with_account, basic_path / "password_form_with_account.rb")
|
12
|
+
|
13
|
+
Merb::BootLoader.before_app_loads do
|
14
|
+
Merb.logger.info "before_app_loads for heedley-merb-auth-with-account"
|
15
|
+
# require code that must be loaded before the application
|
16
|
+
end
|
17
|
+
|
18
|
+
Merb::BootLoader.after_app_loads do
|
19
|
+
Merb.logger.info "after_app_loads for heedley-merb-auth-with-account"
|
20
|
+
# code that can be required after the application loads
|
21
|
+
end
|
22
|
+
|
23
|
+
# Merb::Plugins.add_rakefiles "merb-auth-more/merbtasks"
|
24
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
p "REQUIRED password_form_with_account.rb"
|
2
|
+
|
3
|
+
# This strategy uses a login and password parameter on per account basis.
|
4
|
+
|
5
|
+
# Overwrite the :password_param, and :login_param
|
6
|
+
# to return the name of the field (on the form) that you're using the
|
7
|
+
# login with. These can be strings or symbols
|
8
|
+
#
|
9
|
+
# == Required
|
10
|
+
#
|
11
|
+
# === Methods
|
12
|
+
# <User>.authenticate(login_param, password_param)
|
13
|
+
#
|
14
|
+
#
|
15
|
+
#module Merb::Authentication::Strategies
|
16
|
+
# class FormWithAccount < Merb::Authentication::Strategy
|
17
|
+
# def run!
|
18
|
+
# if params[:login]
|
19
|
+
# User.authenticate(request.params[:login], request.params[:password])
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#end
|
24
|
+
module Merb::Authentication::Strategies
|
25
|
+
class FormWithAccount < Merb::Authentication::Strategy
|
26
|
+
def run!
|
27
|
+
if params[:account_subdomain]
|
28
|
+
User.authenticate(request.params[:login], request.params[:password], params[:account_subdomain])
|
29
|
+
else
|
30
|
+
raise "missing :account_subdomain route param #{params.inspect}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
#
|
36
|
+
#class Merb::Authentication
|
37
|
+
# module Strategies
|
38
|
+
# module Basic
|
39
|
+
# class FormWithAccount < Base
|
40
|
+
#
|
41
|
+
# def run!
|
42
|
+
# raise request.params.inspect
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
#end
|
49
|
+
##class Merb::Authentication
|
50
|
+
## module Strategies
|
51
|
+
## module Basic
|
52
|
+
## class Form < Base
|
53
|
+
##
|
54
|
+
## def run!
|
55
|
+
## raise request.params.inspect
|
56
|
+
## if request.params[login_param] && request.params[password_param]
|
57
|
+
## user = user_class.authenticate(request.params[login_param], request.params[password_param])
|
58
|
+
## if !user
|
59
|
+
## request.session.authentication.errors.clear!
|
60
|
+
## request.session.authentication.errors.add(login_param, strategy_error_message)
|
61
|
+
## end
|
62
|
+
## user
|
63
|
+
## end
|
64
|
+
## end # run!
|
65
|
+
##
|
66
|
+
## def strategy_error_message
|
67
|
+
## "#{login_param.to_s.capitalize} or #{password_param.to_s.capitalize} were incorrect"
|
68
|
+
## end
|
69
|
+
##
|
70
|
+
## end # Form
|
71
|
+
## end # Password
|
72
|
+
## end # Strategies
|
73
|
+
#end # Authentication
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heedley-merb-auth-with-account
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hedley Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-23 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: merb-core
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0.9"
|
23
|
+
version:
|
24
|
+
description: strategy to authenticate users on per account basis
|
25
|
+
email: hedley.robertson@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- README.txt
|
32
|
+
files:
|
33
|
+
- heedley-merb-auth-with-account.gemspec
|
34
|
+
- lib/heedley-merb-auth-with-account.rb
|
35
|
+
- lib/heedley-merb-auth-with-account/strategies/password_form_with_account.rb
|
36
|
+
- README.txt
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/heedley/merb-pagination/tree/master
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --main
|
42
|
+
- README.txt
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.2.0
|
61
|
+
signing_key:
|
62
|
+
specification_version: 2
|
63
|
+
summary: strategy to authenticate users on per account basis
|
64
|
+
test_files: []
|
65
|
+
|