merb-auth-slice-password 1.1.0.rc1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/merb-auth-slice-password.rb +77 -79
- data/lib/merb-auth-slice-password/version.rb +1 -1
- metadata +9 -15
@@ -1,88 +1,86 @@
|
|
1
|
-
|
1
|
+
require "merb-core"
|
2
2
|
|
3
|
-
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Merb::Plugins.add_rakefiles "merb-auth-slice-password/merbtasks", "merb-auth-slice-password/slicetasks", "merb-auth-slice-password/spectasks"
|
5
|
+
require "merb-slices"
|
6
|
+
require "merb-auth-core"
|
7
|
+
require "merb-auth-more"
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# Activation hook - runs after AfterAppLoads BootLoader
|
45
|
-
def self.activate
|
46
|
-
# Load the default strategies
|
47
|
-
end
|
48
|
-
|
49
|
-
# Deactivation hook - triggered by Merb::Slices.deactivate(MerbAuthSlicePassword)
|
50
|
-
def self.deactivate
|
51
|
-
end
|
52
|
-
|
53
|
-
# Setup routes inside the host application
|
54
|
-
#
|
55
|
-
# @param scope<Merb::Router::Behaviour>
|
56
|
-
# Routes will be added within this scope (namespace). In fact, any
|
57
|
-
# router behaviour is a valid namespace, so you can attach
|
58
|
-
# routes at any level of your router setup.
|
59
|
-
#
|
60
|
-
# @note prefix your named routes with :mauth_password_slice_
|
61
|
-
# to avoid potential conflicts with global named routes.
|
62
|
-
def self.setup_router(scope)
|
63
|
-
# example of a named route
|
64
|
-
scope.match("/login", :method => :get ).to(:controller => "/exceptions", :action => "unauthenticated").name(:login)
|
65
|
-
scope.match("/login", :method => :put ).to(:controller => "sessions", :action => "update" ).name(:perform_login)
|
66
|
-
scope.match("/logout" ).to(:controller => "sessions", :action => "destroy" ).name(:logout)
|
9
|
+
Merb::Plugins.add_rakefiles "merb-auth-slice-password/merbtasks", "merb-auth-slice-password/slicetasks", "merb-auth-slice-password/spectasks"
|
10
|
+
|
11
|
+
# Register the Slice for the current host application
|
12
|
+
Merb::Slices::register(__FILE__)
|
13
|
+
|
14
|
+
# Slice configuration - set this in a before_app_loads callback.
|
15
|
+
# By default a Slice uses its own layout, so you can swicht to
|
16
|
+
# the main application layout or no layout at all if needed.
|
17
|
+
#
|
18
|
+
# Configuration options:
|
19
|
+
# :layout - the layout to use; defaults to :mauth_password_slice
|
20
|
+
# :mirror - which path component types to use on copy operations; defaults to all
|
21
|
+
Merb::Slices::config[:"merb-auth-slice-password"][:layout] ||= :application
|
22
|
+
|
23
|
+
# All Slice code is expected to be namespaced inside a module
|
24
|
+
module MerbAuthSlicePassword
|
25
|
+
|
26
|
+
# Slice metadata
|
27
|
+
self.description = "MerbAuthSlicePassword is a merb slice that provides basic password based logins"
|
28
|
+
Gem.loaded_specs["merb-auth-slice-password"].version.version rescue Merb::VERSION
|
29
|
+
self.author = "Daniel Neighman"
|
30
|
+
|
31
|
+
# Stub classes loaded hook - runs before LoadClasses BootLoader
|
32
|
+
# right after a slice's classes have been loaded internally.
|
33
|
+
def self.loaded
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initialization hook - runs before AfterAppLoads BootLoader
|
37
|
+
def self.init
|
38
|
+
require "merb-auth-more/mixins/redirect_back"
|
39
|
+
unless ::Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies]
|
40
|
+
::Merb::Authentication.activate!(:default_password_form)
|
67
41
|
end
|
68
|
-
|
69
42
|
end
|
70
|
-
|
71
|
-
#
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
#
|
77
|
-
|
78
|
-
|
43
|
+
|
44
|
+
# Activation hook - runs after AfterAppLoads BootLoader
|
45
|
+
def self.activate
|
46
|
+
# Load the default strategies
|
47
|
+
end
|
48
|
+
|
49
|
+
# Deactivation hook - triggered by Merb::Slices.deactivate(MerbAuthSlicePassword)
|
50
|
+
def self.deactivate
|
51
|
+
end
|
52
|
+
|
53
|
+
# Setup routes inside the host application
|
79
54
|
#
|
80
|
-
#
|
55
|
+
# @param scope<Merb::Router::Behaviour>
|
56
|
+
# Routes will be added within this scope (namespace). In fact, any
|
57
|
+
# router behaviour is a valid namespace, so you can attach
|
58
|
+
# routes at any level of your router setup.
|
81
59
|
#
|
82
|
-
#
|
83
|
-
|
60
|
+
# @note prefix your named routes with :mauth_password_slice_
|
61
|
+
# to avoid potential conflicts with global named routes.
|
62
|
+
def self.setup_router(scope)
|
63
|
+
# example of a named route
|
64
|
+
scope.match("/login", :method => :get ).to(:controller => "/exceptions", :action => "unauthenticated").name(:login)
|
65
|
+
scope.match("/login", :method => :put ).to(:controller => "sessions", :action => "update" ).name(:perform_login)
|
66
|
+
scope.match("/logout" ).to(:controller => "sessions", :action => "destroy" ).name(:logout)
|
67
|
+
end
|
84
68
|
|
85
|
-
# Add dependencies for other MerbAuthSlicePassword classes below. Example:
|
86
|
-
# dependency "mauth_password_slice/other"
|
87
|
-
|
88
69
|
end
|
70
|
+
|
71
|
+
# Setup the slice layout for MerbAuthSlicePassword
|
72
|
+
#
|
73
|
+
# Use MerbAuthSlicePassword.push_path and MerbAuthSlicePassword.push_app_path
|
74
|
+
# to set paths to mauth_password_slice-level and app-level paths. Example:
|
75
|
+
#
|
76
|
+
# MerbAuthSlicePassword.push_path(:application, MerbAuthSlicePassword.root)
|
77
|
+
# MerbAuthSlicePassword.push_app_path(:application, Merb.root / 'slices' / 'mauth_password_slice')
|
78
|
+
# ...
|
79
|
+
#
|
80
|
+
# Any component path that hasn't been set will default to MerbAuthSlicePassword.root
|
81
|
+
#
|
82
|
+
# Or just call setup_default_structure! to setup a basic Merb MVC structure.
|
83
|
+
MerbAuthSlicePassword.setup_default_structure!
|
84
|
+
|
85
|
+
# Add dependencies for other MerbAuthSlicePassword classes below. Example:
|
86
|
+
# dependency "mauth_password_slice/other"
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-auth-slice-password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 1.1.0.rc1
|
9
|
+
version: 1.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Daniel Neighman
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-22 00:00:00 +00:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -29,8 +28,7 @@ dependencies:
|
|
29
28
|
- 1
|
30
29
|
- 1
|
31
30
|
- 0
|
32
|
-
|
33
|
-
version: 1.1.0.pre
|
31
|
+
version: 1.1.0
|
34
32
|
type: :runtime
|
35
33
|
version_requirements: *id001
|
36
34
|
- !ruby/object:Gem::Dependency
|
@@ -44,8 +42,7 @@ dependencies:
|
|
44
42
|
- 1
|
45
43
|
- 1
|
46
44
|
- 0
|
47
|
-
|
48
|
-
version: 1.1.0.rc1
|
45
|
+
version: 1.1.0
|
49
46
|
type: :runtime
|
50
47
|
version_requirements: *id002
|
51
48
|
- !ruby/object:Gem::Dependency
|
@@ -59,8 +56,7 @@ dependencies:
|
|
59
56
|
- 1
|
60
57
|
- 1
|
61
58
|
- 0
|
62
|
-
|
63
|
-
version: 1.1.0.rc1
|
59
|
+
version: 1.1.0
|
64
60
|
type: :runtime
|
65
61
|
version_requirements: *id003
|
66
62
|
- !ruby/object:Gem::Dependency
|
@@ -128,13 +124,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
124
|
version: "0"
|
129
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
126
|
requirements:
|
131
|
-
- - "
|
127
|
+
- - ">="
|
132
128
|
- !ruby/object:Gem::Version
|
133
129
|
segments:
|
134
|
-
-
|
135
|
-
|
136
|
-
- 1
|
137
|
-
version: 1.3.1
|
130
|
+
- 0
|
131
|
+
version: "0"
|
138
132
|
requirements: []
|
139
133
|
|
140
134
|
rubyforge_project:
|