sinatra-simple-auth 0.5 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -1
- data/README.md +59 -51
- data/sinatra-simple-auth.gemspec +3 -2
- metadata +15 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6909f7b96985b8f7fcf47a4f614d9089de73eb98
|
4
|
+
data.tar.gz: 063b632e0753eb3284096541370310959ba0017e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ac25c33bffa9b51d9280bce7a78dedb6baae5b11f1574eafae4016dd5c057ae6aff75ba1c3f6fc42bec930ead7ab7062375f69f7a9058e2edc5beac23f337037
|
7
|
+
data.tar.gz: 91efdad8a508f8b55825ab4433d6b1749ea046eb0d26e3e30d837f2b7c9f31ed2d7cde0d227d0b2fafa6abdbcd1b8378050d84d277bd1d9a692e680a319fee2f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,67 +4,75 @@ Sinatra extension with methods and routes for dealing with simple, single-passwo
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
```console
|
8
|
+
gem install sinatra-simple-auth
|
9
|
+
```
|
8
10
|
|
9
11
|
Or via bundler:
|
10
12
|
|
11
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'sinatra-simple-auth'
|
15
|
+
```
|
12
16
|
|
13
17
|
## Usage (classic style applications)
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
```ruby
|
20
|
+
# classic_app.rb
|
21
|
+
require 'rubygems'
|
22
|
+
require 'sinatra'
|
23
|
+
require 'sinatra/simple_auth'
|
24
|
+
|
25
|
+
enable :sessions
|
26
|
+
set :password, 'my_cool_password' # set the password
|
27
|
+
set :home, '/secure/' # where user should be redirected after successful authentication
|
28
|
+
|
29
|
+
get '/login/?' do
|
30
|
+
erb :login # page with auth form
|
31
|
+
end
|
32
|
+
|
33
|
+
get '/secure/' do
|
34
|
+
protected! # protected route, requires auth
|
35
|
+
erb :secure
|
36
|
+
end
|
37
|
+
|
38
|
+
get '/' do
|
39
|
+
if authorized? # helper method
|
40
|
+
"Hello, %username%"
|
41
|
+
else
|
42
|
+
"Not authorized"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
```
|
19
46
|
|
20
|
-
|
21
|
-
set :password, 'my_cool_password' # set the password
|
22
|
-
set :home, '/secure/' # where user should be redirected after successful authentication
|
47
|
+
## Usage (modular style applications)
|
23
48
|
|
24
|
-
|
25
|
-
|
26
|
-
|
49
|
+
```ruby
|
50
|
+
# modular_app.rb
|
51
|
+
require 'sinatra/base'
|
52
|
+
require 'sinatra/simple_auth'
|
27
53
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
54
|
+
class SinatraModularApp < Sinatra::Base
|
55
|
+
enable :sessions
|
56
|
+
register Sinatra::SimpleAuth
|
32
57
|
|
33
|
-
|
34
|
-
|
35
|
-
"Hello, %username%"
|
36
|
-
else
|
37
|
-
"Not authorized"
|
38
|
-
end
|
39
|
-
end
|
58
|
+
set :password, 'hello' # set the password
|
59
|
+
set :home, '/' # where user should be redirected after successful authentication
|
40
60
|
|
41
|
-
|
61
|
+
get '/login/?' do
|
62
|
+
erb :login # page with auth form
|
63
|
+
end
|
64
|
+
|
65
|
+
get '/secure/' do
|
66
|
+
protected! # protected route, requires auth
|
67
|
+
erb :secure
|
68
|
+
end
|
42
69
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
enable :sessions
|
49
|
-
register Sinatra::SimpleAuth
|
50
|
-
|
51
|
-
set :password, 'hello' # set the password
|
52
|
-
set :home, '/' # where user should be redirected after successful authentication
|
53
|
-
|
54
|
-
get '/login/?' do
|
55
|
-
erb :login # page with auth form
|
56
|
-
end
|
57
|
-
|
58
|
-
get '/secure/' do
|
59
|
-
protected! # protected route, requires auth
|
60
|
-
erb :secure
|
61
|
-
end
|
62
|
-
|
63
|
-
get '/' do
|
64
|
-
if authorized? # helper method
|
65
|
-
"Hello, %username%"
|
66
|
-
else
|
67
|
-
"Not authorized"
|
68
|
-
end
|
69
|
-
end
|
70
|
+
get '/' do
|
71
|
+
if authorized? # helper method
|
72
|
+
"Hello, %username%"
|
73
|
+
else
|
74
|
+
"Not authorized"
|
70
75
|
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
```
|
data/sinatra-simple-auth.gemspec
CHANGED
@@ -3,11 +3,12 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "sinatra-simple-auth"
|
6
|
-
s.version = '0.5'
|
6
|
+
s.version = '0.5.1'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Vasily Polovnyov"]
|
9
9
|
s.email = ["vasily@polovnyov.ru"]
|
10
10
|
s.homepage = "http://github.com/vast/sinatra-simple-auth/"
|
11
|
+
s.license = 'MIT'
|
11
12
|
s.summary = %q{super simple auth extension for Sinatra}
|
12
13
|
s.description = %q[super simple auth extension for Sinatra]
|
13
14
|
|
@@ -19,4 +20,4 @@ Gem::Specification.new do |s|
|
|
19
20
|
s.add_dependency('sinatra', '>=1.1.0')
|
20
21
|
s.add_development_dependency('rack-test')
|
21
22
|
s.add_development_dependency('turn')
|
22
|
-
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-simple-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Vasily Polovnyov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sinatra
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.1.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.1.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rack-test
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: turn
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: super simple auth extension for Sinatra
|
@@ -76,34 +69,28 @@ files:
|
|
76
69
|
- test/sinatra_modular_app.rb
|
77
70
|
- test/sinatra_simple_auth_test.rb
|
78
71
|
homepage: http://github.com/vast/sinatra-simple-auth/
|
79
|
-
licenses:
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
80
75
|
post_install_message:
|
81
76
|
rdoc_options: []
|
82
77
|
require_paths:
|
83
78
|
- lib
|
84
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
80
|
requirements:
|
87
|
-
- -
|
81
|
+
- - '>='
|
88
82
|
- !ruby/object:Gem::Version
|
89
83
|
version: '0'
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
hash: 4494792989292088615
|
93
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
85
|
requirements:
|
96
|
-
- -
|
86
|
+
- - '>='
|
97
87
|
- !ruby/object:Gem::Version
|
98
88
|
version: '0'
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
hash: 4494792989292088615
|
102
89
|
requirements: []
|
103
90
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.8
|
91
|
+
rubygems_version: 2.1.8
|
105
92
|
signing_key:
|
106
|
-
specification_version:
|
93
|
+
specification_version: 4
|
107
94
|
summary: super simple auth extension for Sinatra
|
108
95
|
test_files:
|
109
96
|
- test/sinatra_modular_app.rb
|