jekyll-auth 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,3 @@
1
1
  _site
2
2
  *.gem
3
3
  .env
4
- Gemfile.lock
@@ -1,7 +1,16 @@
1
1
  class JekyllAuth
2
2
  class AuthSite < Sinatra::Base
3
3
 
4
- use Rack::Session::Cookie, :secret => ENV['SESSION_SECRET'] || SecureRandom.hex
4
+ # require ssl
5
+ configure :production do
6
+ require 'rack-ssl-enforcer'
7
+ use Rack::SslEnforcer if JekyllAuth.ssl?
8
+ end
9
+
10
+ use Rack::Session::Cookie, {
11
+ :http_only => true,
12
+ :secret => ENV['SESSION_SECRET'] || SecureRandom.hex
13
+ }
5
14
 
6
15
  set :github_options, {
7
16
  :client_id => ENV['GITHUB_CLIENT_ID'],
@@ -1,17 +1,20 @@
1
1
  class JekyllAuth
2
2
  def self.setup_config
3
- config_file_path = File.join(Dir.pwd, "_config.yml")
4
- config_file = YAML.safe_load_file(config_file_path)
5
- config_file
3
+ @config_file ||= YAML.safe_load_file(File.join(Dir.pwd, "_config.yml"))
6
4
  end
7
5
 
8
6
  def self.config
9
- @config ||= JekyllAuth.setup_config
7
+ config_file = JekyllAuth.setup_config
8
+ return {} if config_file.nil? || config_file["jekyll_auth"].nil?
9
+ config_file["jekyll_auth"]
10
10
  end
11
11
 
12
12
  def self.whitelist
13
- jekyll_auth_key = JekyllAuth::config["jekyll_auth"]
14
- return nil if !jekyll_auth_key or !(whitelist = jekyll_auth_key["whitelist"])
15
- Regexp.new(whitelist.join("|"))
13
+ whitelist = JekyllAuth::config["whitelist"]
14
+ Regexp.new(whitelist.join("|")) unless whitelist.nil?
15
+ end
16
+
17
+ def self.ssl?
18
+ !!JekyllAuth::config["ssl"]
16
19
  end
17
20
  end
@@ -1,3 +1,3 @@
1
1
  class JekyllAuth
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,136 +9,152 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-16 00:00:00.000000000 Z
12
+ date: 2013-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: github-pages
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '10.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '10.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: sinatra-index
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 0.0.2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 0.0.2
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: sinatra_auth_github
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: commander
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '4.1'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: '4.1'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: heroku
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: '3.0'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '3.0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: git
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ! '>='
99
+ - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: '1.2'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ! '>='
107
+ - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '1.2'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: dotenv
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.9.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - ! '>='
123
+ - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 0.9.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
- - - ! '>='
131
+ - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: '0'
133
+ version: '10.1'
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
139
- - - ! '>='
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '10.1'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rack-ssl-enforcer
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 0.2.6
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
140
156
  - !ruby/object:Gem::Version
141
- version: '0'
157
+ version: 0.2.6
142
158
  - !ruby/object:Gem::Dependency
143
159
  name: safe_yaml
144
160
  requirement: !ruby/object:Gem::Requirement