jekyll-auth 2.1.0 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +3 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- data/.github/config.yml +23 -0
- data/.github/dependabot.yml +10 -0
- data/.github/funding.yml +1 -0
- data/.github/no-response.yml +15 -0
- data/.github/release-drafter.yml +4 -0
- data/.github/settings.yml +33 -0
- data/.github/stale.yml +29 -0
- data/.github/workflows/ci.yml +24 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.rubocop.yml +13 -4
- data/.travis.yml +3 -3
- data/Gemfile +3 -1
- data/Rakefile +13 -11
- data/bin/jekyll-auth +8 -8
- data/docs/CODE_OF_CONDUCT.md +46 -0
- data/docs/CONTRIBUTING.md +88 -0
- data/docs/README.md +37 -0
- data/docs/SECURITY.md +3 -0
- data/docs/_config.yml +2 -0
- data/docs/configuring.md +36 -0
- data/docs/getting-started.md +63 -0
- data/docs/running-locally.md +24 -0
- data/docs/troubleshooting.md +31 -0
- data/jekyll-auth.gemspec +30 -25
- data/lib/jekyll-auth.rb +3 -0
- data/lib/jekyll_auth/auth_site.rb +2 -0
- data/lib/jekyll_auth/commands.rb +5 -1
- data/lib/jekyll_auth/config.rb +15 -8
- data/lib/jekyll_auth/config_error.rb +2 -0
- data/lib/jekyll_auth/helpers.rb +3 -0
- data/lib/jekyll_auth/jekyll_site.rb +4 -2
- data/lib/jekyll_auth/sinatra/auth/github.rb +8 -4
- data/lib/jekyll_auth/version.rb +3 -1
- data/spec/jekyll_auth_auth_site_spec.rb +2 -0
- data/spec/jekyll_auth_bin_spec.rb +2 -0
- data/spec/jekyll_auth_commands_spec.rb +2 -0
- data/spec/jekyll_auth_helpers_spec.rb +2 -0
- data/spec/jekyll_auth_jekyll_site_spec.rb +3 -1
- data/spec/jekyll_auth_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -0
- data/templates/.gitignore +0 -1
- data/templates/Rakefile +3 -1
- data/templates/config.ru +3 -1
- metadata +143 -52
- data/README.md +0 -179
metadata
CHANGED
@@ -1,99 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
34
|
+
name: colorator
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '1.0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '1.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: dotenv
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '2.0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '2.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: jekyll
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '4.0'
|
62
68
|
type: :runtime
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
74
|
+
version: '4.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
76
|
+
name: mercenary
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
79
|
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
81
|
+
version: '0.3'
|
76
82
|
type: :runtime
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
88
|
+
version: '0.3'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: rack
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- - "
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.6'
|
96
|
+
- - "<"
|
88
97
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
98
|
+
version: '3.0'
|
90
99
|
type: :runtime
|
91
100
|
prerelease: false
|
92
101
|
version_requirements: !ruby/object:Gem::Requirement
|
93
102
|
requirements:
|
94
|
-
- - "
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.6'
|
106
|
+
- - "<"
|
95
107
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
108
|
+
version: '3.0'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: rack-protection
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 1.5.5
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '3.0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.5.5
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '3.0'
|
97
129
|
- !ruby/object:Gem::Dependency
|
98
130
|
name: rack-ssl-enforcer
|
99
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,19 +141,19 @@ dependencies:
|
|
109
141
|
- !ruby/object:Gem::Version
|
110
142
|
version: '0.2'
|
111
143
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
144
|
+
name: rake
|
113
145
|
requirement: !ruby/object:Gem::Requirement
|
114
146
|
requirements:
|
115
147
|
- - "~>"
|
116
148
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0
|
149
|
+
version: '13.0'
|
118
150
|
type: :runtime
|
119
151
|
prerelease: false
|
120
152
|
version_requirements: !ruby/object:Gem::Requirement
|
121
153
|
requirements:
|
122
154
|
- - "~>"
|
123
155
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0
|
156
|
+
version: '13.0'
|
125
157
|
- !ruby/object:Gem::Dependency
|
126
158
|
name: safe_yaml
|
127
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,33 +169,67 @@ dependencies:
|
|
137
169
|
- !ruby/object:Gem::Version
|
138
170
|
version: '1.0'
|
139
171
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
172
|
+
name: sinatra-index
|
141
173
|
requirement: !ruby/object:Gem::Requirement
|
142
174
|
requirements:
|
143
175
|
- - "~>"
|
144
176
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
177
|
+
version: '0.0'
|
146
178
|
type: :runtime
|
147
179
|
prerelease: false
|
148
180
|
version_requirements: !ruby/object:Gem::Requirement
|
149
181
|
requirements:
|
150
182
|
- - "~>"
|
151
183
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
184
|
+
version: '0.0'
|
153
185
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
186
|
+
name: sinatra_auth_github
|
155
187
|
requirement: !ruby/object:Gem::Requirement
|
156
188
|
requirements:
|
157
|
-
- - "
|
189
|
+
- - ">="
|
158
190
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
191
|
+
version: '1.1'
|
192
|
+
- - "<"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '3.0'
|
160
195
|
type: :runtime
|
161
196
|
prerelease: false
|
162
197
|
version_requirements: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '1.1'
|
202
|
+
- - "<"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '3.0'
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: pry
|
207
|
+
requirement: !ruby/object:Gem::Requirement
|
163
208
|
requirements:
|
164
209
|
- - "~>"
|
165
210
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
211
|
+
version: '0.10'
|
212
|
+
type: :development
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0.10'
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: rack-test
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '2.0'
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - "~>"
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '2.0'
|
167
233
|
- !ruby/object:Gem::Dependency
|
168
234
|
name: rspec
|
169
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,61 +245,67 @@ dependencies:
|
|
179
245
|
- !ruby/object:Gem::Version
|
180
246
|
version: '3.1'
|
181
247
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
248
|
+
name: rubocop
|
183
249
|
requirement: !ruby/object:Gem::Requirement
|
184
250
|
requirements:
|
185
251
|
- - "~>"
|
186
252
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0.
|
253
|
+
version: '0.49'
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 0.49.0
|
188
257
|
type: :development
|
189
258
|
prerelease: false
|
190
259
|
version_requirements: !ruby/object:Gem::Requirement
|
191
260
|
requirements:
|
192
261
|
- - "~>"
|
193
262
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0.
|
263
|
+
version: '0.49'
|
264
|
+
- - ">="
|
265
|
+
- !ruby/object:Gem::Version
|
266
|
+
version: 0.49.0
|
195
267
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
268
|
+
name: rubocop-jekyll
|
197
269
|
requirement: !ruby/object:Gem::Requirement
|
198
270
|
requirements:
|
199
271
|
- - "~>"
|
200
272
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
273
|
+
version: 0.11.0
|
202
274
|
type: :development
|
203
275
|
prerelease: false
|
204
276
|
version_requirements: !ruby/object:Gem::Requirement
|
205
277
|
requirements:
|
206
278
|
- - "~>"
|
207
279
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
280
|
+
version: 0.11.0
|
209
281
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
282
|
+
name: rubocop-performance
|
211
283
|
requirement: !ruby/object:Gem::Requirement
|
212
284
|
requirements:
|
213
285
|
- - "~>"
|
214
286
|
- !ruby/object:Gem::Version
|
215
|
-
version: '0
|
287
|
+
version: '1.0'
|
216
288
|
type: :development
|
217
289
|
prerelease: false
|
218
290
|
version_requirements: !ruby/object:Gem::Requirement
|
219
291
|
requirements:
|
220
292
|
- - "~>"
|
221
293
|
- !ruby/object:Gem::Version
|
222
|
-
version: '0
|
294
|
+
version: '1.0'
|
223
295
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
296
|
+
name: webmock
|
225
297
|
requirement: !ruby/object:Gem::Requirement
|
226
298
|
requirements:
|
227
299
|
- - "~>"
|
228
300
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
301
|
+
version: '2.3'
|
230
302
|
type: :development
|
231
303
|
prerelease: false
|
232
304
|
version_requirements: !ruby/object:Gem::Requirement
|
233
305
|
requirements:
|
234
306
|
- - "~>"
|
235
307
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
308
|
+
version: '2.3'
|
237
309
|
description: A simple way to use GitHub OAuth to serve a protected jekyll site to
|
238
310
|
your GitHub organization.
|
239
311
|
email: ben@balter.com
|
@@ -242,13 +314,33 @@ executables:
|
|
242
314
|
extensions: []
|
243
315
|
extra_rdoc_files: []
|
244
316
|
files:
|
317
|
+
- ".github/CODEOWNERS"
|
318
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
319
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
320
|
+
- ".github/config.yml"
|
321
|
+
- ".github/dependabot.yml"
|
322
|
+
- ".github/funding.yml"
|
323
|
+
- ".github/no-response.yml"
|
324
|
+
- ".github/release-drafter.yml"
|
325
|
+
- ".github/settings.yml"
|
326
|
+
- ".github/stale.yml"
|
327
|
+
- ".github/workflows/ci.yml"
|
328
|
+
- ".github/workflows/codeql-analysis.yml"
|
245
329
|
- ".gitignore"
|
246
330
|
- ".rubocop.yml"
|
247
331
|
- ".travis.yml"
|
248
332
|
- Gemfile
|
249
|
-
- README.md
|
250
333
|
- Rakefile
|
251
334
|
- bin/jekyll-auth
|
335
|
+
- docs/CODE_OF_CONDUCT.md
|
336
|
+
- docs/CONTRIBUTING.md
|
337
|
+
- docs/README.md
|
338
|
+
- docs/SECURITY.md
|
339
|
+
- docs/_config.yml
|
340
|
+
- docs/configuring.md
|
341
|
+
- docs/getting-started.md
|
342
|
+
- docs/running-locally.md
|
343
|
+
- docs/troubleshooting.md
|
252
344
|
- jekyll-auth.gemspec
|
253
345
|
- lib/jekyll-auth.rb
|
254
346
|
- lib/jekyll_auth/auth_site.rb
|
@@ -281,7 +373,7 @@ homepage: https://github.com/benbalter/jekyll-auth
|
|
281
373
|
licenses:
|
282
374
|
- MIT
|
283
375
|
metadata: {}
|
284
|
-
post_install_message:
|
376
|
+
post_install_message:
|
285
377
|
rdoc_options: []
|
286
378
|
require_paths:
|
287
379
|
- lib
|
@@ -296,9 +388,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
388
|
- !ruby/object:Gem::Version
|
297
389
|
version: '0'
|
298
390
|
requirements: []
|
299
|
-
|
300
|
-
|
301
|
-
signing_key:
|
391
|
+
rubygems_version: 3.2.33
|
392
|
+
signing_key:
|
302
393
|
specification_version: 4
|
303
394
|
summary: A simple way to use GitHub OAuth to serve a protected jekyll site to your
|
304
395
|
GitHub organization
|
data/README.md
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
# Jekyll Auth
|
2
|
-
|
3
|
-
*A simple way to use GitHub OAuth to serve a protected Jekyll site to your GitHub organization*
|
4
|
-
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/jekyll-auth.png)](http://badge.fury.io/rb/jekyll-auth) [![Build Status](https://travis-ci.org/benbalter/jekyll-auth.png?branch=master)](https://travis-ci.org/benbalter/jekyll-auth)
|
6
|
-
|
7
|
-
## The problem
|
8
|
-
|
9
|
-
[Jekyll](http://github.com/mojombo/jekyll) and [GitHub Pages](http://pages.github.com) are awesome, right? Static site, lightning fast, everything versioned in Git. What else could you ask for?
|
10
|
-
|
11
|
-
But what if you only want to share that site with a select number of people? Before, you were SOL. Now, simply host the site on a free, [Heroku](http://heroku.com) Dyno, and whenever someone tries to access it, it will Oauth them against GitHub, and make sure they're a member of your Organization. Pretty cool, huh?
|
12
|
-
|
13
|
-
## Requirements
|
14
|
-
|
15
|
-
1. A GitHub account (one per user)
|
16
|
-
2. A GitHub Organization (of which members will have access to the Jekyll site)
|
17
|
-
3. A GitHub Application (you can [register one](https://github.com/settings/applications/new) for free)
|
18
|
-
4. A Heroku account (you can technically use this elsewhere, but the instructions are for Heroku)
|
19
|
-
|
20
|
-
## Getting Started
|
21
|
-
|
22
|
-
### Create a GitHub Application
|
23
|
-
|
24
|
-
1. Navigate to [the GitHub app registration page](https://github.com/settings/applications/new)
|
25
|
-
2. Give your app a name
|
26
|
-
3. Tell GitHub the URL you want the app to eventually live at. If using a free Heroku account, this will be something like <http://my-site.herokuapp.com>
|
27
|
-
4. Specify the callback URL; should be like this: <https://my-site.herokuapp.com/auth/github/callback>; note that this is **https**, not http.
|
28
|
-
5. Hit Save, but leave the page open, you'll need some of the information in a moment
|
29
|
-
|
30
|
-
Remember the 'my-site' part for later on when using `heroku create`. Also, my-site is often called 'app-name' in Heroku documentation.
|
31
|
-
|
32
|
-
### Add Jekyll Auth to your site
|
33
|
-
|
34
|
-
1. Within your new site repository or orphaned github [branch](https://help.github.com/articles/creating-project-pages-manually/) (the branch could be named anything except 'gh-pages' since this would then be public on GitHub!), add `gem 'jekyll-auth'` to your `Gemfile` or if you don't already have a `Gemfile`, create a file called `Gemfile` in the root of your site's repository with the following content:
|
35
|
-
|
36
|
-
```ruby
|
37
|
-
source "https://rubygems.org"
|
38
|
-
|
39
|
-
gem 'jekyll-auth'
|
40
|
-
```
|
41
|
-
|
42
|
-
2. `cd` into your project's directory and run `bundle install`. If you get an error using `bundle install`, see Troubleshooting below.
|
43
|
-
|
44
|
-
3. Run `bundle exec jekyll-auth new` which will copy the necessary files to set up the server
|
45
|
-
|
46
|
-
### Setting up hosting with Heroku
|
47
|
-
|
48
|
-
#### Automatically
|
49
|
-
|
50
|
-
Run `bundle exec jekyll-auth setup --client_id XXX --client_secret XXX --org_name XXX`
|
51
|
-
|
52
|
-
(or `--team_id XXX`)
|
53
|
-
|
54
|
-
#### Manually
|
55
|
-
|
56
|
-
1. You may need to add and commit the files generated by `jekyll-auth new` to Git before continuing
|
57
|
-
2. Make sure you have [the Heroku toolbelt](https://toolbelt.heroku.com/) installed
|
58
|
-
3. Run `heroku create my-site` from your site's directory; make sure my-site matches what you specified in the GitHub application registration above.
|
59
|
-
4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_NAME=XXX` (or `GITHUB_TEAM_ID`)
|
60
|
-
5. `git push heroku`, or if you are maintaining the site in an orphaned branch of your GitHub repo (say 'heroku-pages'), do `git push heroku heroku-pages:master`
|
61
|
-
6. `heroku open` to open the site in your browser
|
62
|
-
|
63
|
-
#### Find the Organization ID (needed to find Team ID)
|
64
|
-
|
65
|
-
If you need to find an organization's ID, you can use the following cURL command:
|
66
|
-
|
67
|
-
```
|
68
|
-
curl https://api.github.com/orgs/{org_name}
|
69
|
-
```
|
70
|
-
|
71
|
-
#### Finding the Team ID
|
72
|
-
|
73
|
-
If you need help finding a team's numeric ID, you can use the `jekyll-auth team_id` command.
|
74
|
-
|
75
|
-
For example, to find the team ID for @jekyll/maintainers you'd run the command:
|
76
|
-
|
77
|
-
```
|
78
|
-
jekyll-auth team_id --org jekyll --team maintainers
|
79
|
-
```
|
80
|
-
|
81
|
-
You'll want to add a [personal access token](https://github.com/settings/tokens/new) to your `.env` file so that Jekyll-Auth can make the necessary API request, but the command will run you through the process if you do not provide this.
|
82
|
-
|
83
|
-
## Configuration
|
84
|
-
|
85
|
-
### Whitelisting
|
86
|
-
|
87
|
-
Don't want to require authentication for every part of your site? Fine! Add a whitelist to your Jekyll's **config.yml** file:
|
88
|
-
|
89
|
-
```yaml
|
90
|
-
jekyll_auth:
|
91
|
-
whitelist:
|
92
|
-
- drafts?
|
93
|
-
```
|
94
|
-
|
95
|
-
`jekyll_auth.whitelist` takes an array of regular expressions as strings. The default auth behavior checks (and blocks) against root (`/`). Any path defined in the whitelist won't require authentication on your site.
|
96
|
-
|
97
|
-
What if you want to go the other way, and unauthenticate the entire site *except* for certain portions? You can define some regex magic for that:
|
98
|
-
|
99
|
-
```yaml
|
100
|
-
jekyll_auth:
|
101
|
-
whitelist:
|
102
|
-
- "^((?!draft).)*$"
|
103
|
-
```
|
104
|
-
|
105
|
-
There is also a more [extensive article containing installation instructions for Jekyll-Auth](http://fabian-kostadinov.github.io/2014/11/13/installation-of-jekyll-auth/) and a second one on [how to find your GitHub team ID](http://fabian-kostadinov.github.io/2015/01/16/how-to-find-a-github-team-id/).
|
106
|
-
|
107
|
-
### Requiring SSL
|
108
|
-
|
109
|
-
If [you've got SSL set up](https://devcenter.heroku.com/articles/ssl-endpoint), simply add the following your your `_config.yml` file to ensure SSL is enforced.
|
110
|
-
|
111
|
-
```yaml
|
112
|
-
jekyll_auth:
|
113
|
-
ssl: true
|
114
|
-
```
|
115
|
-
|
116
|
-
### Using a custom 404
|
117
|
-
|
118
|
-
Just like GitHub Pages, Jekyll Auth will honor a custom 404 page, if it's generated as `/404.html` in the built site.
|
119
|
-
|
120
|
-
## Running locally
|
121
|
-
|
122
|
-
Want to run it locally?
|
123
|
-
|
124
|
-
### Without authentication
|
125
|
-
|
126
|
-
Just run `jekyll serve` as you would normally.
|
127
|
-
|
128
|
-
### With authentication
|
129
|
-
|
130
|
-
1. `export GITHUB_CLIENT_ID=[your github app client id]`
|
131
|
-
2. `export GITHUB_CLIENT_SECRET=[your github app client secret]`
|
132
|
-
3. `export GITHUB_ORG_NAME=[org name]` or `export GITHUB_TEAM_ID=[team id]` or `export GITHUB_TEAM_IDS=1234,5678`
|
133
|
-
4. `jekyll-auth serve`
|
134
|
-
|
135
|
-
*Pro-tip #1:* For sanity's sake, and to avoid problems with your callback URL, you may want to have two apps, one with a local Oauth callback, and one for production if you're going to be testing auth locally.
|
136
|
-
|
137
|
-
*Pro-tip #2*: Jekyll Auth supports [dotenv](https://github.com/bkeepers/dotenv) out of the box. You can create a `.env` file in the root of site and add your configuration variables there. It's ignored by `.gitignore` if you use `jekyll-auth new`, but be sure not to accidentally commit your `.env` file. Here's what your `.env` file might look like:
|
138
|
-
|
139
|
-
```
|
140
|
-
GITHUB_CLIENT_SECRET=abcdefghijklmnopqrstuvwxyz0123456789
|
141
|
-
GITHUB_CLIENT_ID=qwertyuiop0001
|
142
|
-
GITHUB_TEAM_ID=12345
|
143
|
-
```
|
144
|
-
|
145
|
-
## Under the hood
|
146
|
-
|
147
|
-
Every time you push to Heroku, we take advantage of the fact that Heroku automatically runs the `rake assets:precompile` command (normally used for Rails sites) to build our Jekyll site and store it statically, just like GitHub pages would.
|
148
|
-
|
149
|
-
Anytime a request comes in for a page, we run it through [Sinatra](http://www.sinatrarb.com/) (using the `_site` folder as the static file folder, just as `public` would be normally), and authenticate it using [sinatra\_auth\_github](https://github.com/atmos/sinatra_auth_github).
|
150
|
-
|
151
|
-
If they're in the org, they get the page. Otherwise, all they ever get is [the bouncer](http://octodex.github.com/bouncer/).
|
152
|
-
|
153
|
-
## Upgrading from Jekyll Auth < 0.1.0
|
154
|
-
|
155
|
-
1. `cd` to your project directory
|
156
|
-
2. `rm config.ru`
|
157
|
-
3. `rm Procfile`
|
158
|
-
4. Remove any Jekyll Auth specific requirements from your `Gemfile`
|
159
|
-
5. Follow [the instructions above](https://github.com/benbalter/jekyll-auth#add-jekyll-auth-to-your-site) to get started
|
160
|
-
6. When prompted, select "n" if Heroku is already set up
|
161
|
-
|
162
|
-
## Troubleshooting
|
163
|
-
|
164
|
-
* **ERROR: YOUR SITE COULD NOT BE BUILT** during install, either locally or on Heroku. You likely need to add `exclude: [vendor]` to `_config.yml` in your branch's root directory (create the file if it does not exist already). If you still have problems on the *local* install, you may have better luck using `bundle install --deployment`, but be sure to add the resulting 'vendor' directory to .gitignore. For completeness, the full error may look something like this:
|
165
|
-
|
166
|
-
|
167
|
-
```
|
168
|
-
remote: Configuration file: none
|
169
|
-
remote: ERROR: YOUR SITE COULD NOT BE BUILT:
|
170
|
-
remote: ------------------------------------
|
171
|
-
remote: Invalid date '0000-00-00': Post '/vendor/bundle/ruby/2.0.0/gems/jekyll-2.5.3/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the filename.
|
172
|
-
```
|
173
|
-
|
174
|
-
* **Pushing to heroku**. If you are working from a new GitHub-cloned repo (where you have not run `heroku create`), you may also want to push to Heroku. Instead of adding the remote in the standard way with Git, do this:
|
175
|
-
|
176
|
-
|
177
|
-
```
|
178
|
-
heroku git:remote -a my-site
|
179
|
-
```
|