jekyll-auth 2.1.0 → 2.1.1
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/config.yml +20 -0
- data/.github/no-response.yml +13 -0
- data/.github/settings.yml +31 -0
- data/.github/stale.yml +27 -0
- data/.rubocop.yml +8 -1
- data/Gemfile +3 -1
- data/Rakefile +13 -11
- data/bin/jekyll-auth +3 -1
- data/docs/CODE_OF_CONDUCT.md +46 -0
- data/docs/CONTRIBUTING.md +88 -0
- data/docs/README.md +33 -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 +28 -25
- data/lib/jekyll-auth.rb +3 -0
- data/lib/jekyll_auth/auth_site.rb +2 -0
- data/lib/jekyll_auth/commands.rb +3 -1
- data/lib/jekyll_auth/config.rb +15 -8
- data/lib/jekyll_auth/config_error.rb +2 -0
- data/lib/jekyll_auth/helpers.rb +2 -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 +2 -0
- data/spec/jekyll_auth_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/templates/.gitignore +0 -1
- data/templates/Rakefile +3 -1
- data/templates/config.ru +3 -1
- metadata +81 -43
- data/README.md +0 -179
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c136d94831d0eeebe7d76abafa627651c9e4cf1fd62b6a3ad52e29504790d1e6
|
4
|
+
data.tar.gz: 6044ef25f707107669ae9611ae92b4cf6683ffdbe7c104533dcebf0e84f4b4e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e3f69f15ad1e609bcc6ad7533b7e1ce776c6357885fdd1cd8aefd9d028f5534329777fe236da3b236a1ace64ecdc74a30f8fa0e44ea0d6478c4d075190039f7
|
7
|
+
data.tar.gz: f3a380a463ca7529350e95c41eef356cf50a1041874d3e3f538b50d1cbe11ab80d0ec747aaecbd57fe6ba842ffbbbc79596823f240c7779ed5e0c4f656ea46d6
|
data/.github/CODEOWNERS
ADDED
data/.github/config.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Behaviorbot config. See https://github.com/behaviorbot/ for more information.
|
2
|
+
# Note: Please Don't edit this file directly.
|
3
|
+
# Edit https://github.com/benbalter/behaviorbot-config instead.
|
4
|
+
|
5
|
+
# Configuration for update-docs - https://github.com/behaviorbot/update-docs
|
6
|
+
updateDocsComment: "Thanks for the pull request! If you are making any changes to the user-facing functionality, please be sure to update the documentation in the `README` or `docs/` folder alongside your change. :heart:"
|
7
|
+
|
8
|
+
# Configuration for request-info - https://github.com/behaviorbot/request-info
|
9
|
+
requestInfoReplyComment: Thanks for this. Do you mind providing a bit more information about what problem you're trying to solve?
|
10
|
+
requestInfoLabelToAdd: more-information-needed
|
11
|
+
|
12
|
+
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
|
13
|
+
#newIssueWelcomeComment: >
|
14
|
+
# Welcome!
|
15
|
+
|
16
|
+
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
|
17
|
+
newPRWelcomeComment: Welcome! Congrats on your first pull request to Jekyll Auth. If you haven't already, please be sure to check out [the contributing guidelines](https://github.com/benbalter/jekyll-auth/blob/master/docs/CONTRIBUTING.md).
|
18
|
+
|
19
|
+
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
|
20
|
+
firstPRMergeComment: "Congrats on getting your first pull request to Jekyll Auth merged! Without amazing humans like you submitting pull requests, we couldn’t run this project. You rock! :tada:<br /><br />If you're interested in tackling another bug or feature, take a look at [the open issues](https://github.com/benbalter/jekyll-auth/issues), especially those [labeled `help wanted`](https://github.com/benbalter/jekyll-auth/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)."
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Configuration for probot-no-response - https://github.com/probot/no-response
|
2
|
+
|
3
|
+
# Number of days of inactivity before an Issue is closed for lack of response
|
4
|
+
daysUntilClose: 14
|
5
|
+
# Label requiring a response
|
6
|
+
responseRequiredLabel: more-information-needed
|
7
|
+
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
8
|
+
closeComment: >
|
9
|
+
This issue has been automatically closed because there has been no response
|
10
|
+
to our request for more information from the original author. With only the
|
11
|
+
information that is currently in the issue, we don't have enough information
|
12
|
+
to take action. Please reach out if you have or find the answers we need so
|
13
|
+
that we can investigate further.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Repository settings set via https://github.com/probot/settings
|
2
|
+
|
3
|
+
repository:
|
4
|
+
has_issues: true
|
5
|
+
has_wiki: false
|
6
|
+
has_projects: false
|
7
|
+
has_downloads: false
|
8
|
+
|
9
|
+
labels:
|
10
|
+
- name: help wanted
|
11
|
+
oldname: help-wanted
|
12
|
+
color: 0e8a16
|
13
|
+
- name: more-information-needed
|
14
|
+
color: d93f0b
|
15
|
+
- name: bug
|
16
|
+
color: b60205
|
17
|
+
- name: feature
|
18
|
+
color: 1d76db
|
19
|
+
- name: good first issue
|
20
|
+
color: "5319e7"
|
21
|
+
|
22
|
+
# Not currently implemented by probot/settings, but manually implemented in script/deploy
|
23
|
+
branch_protection:
|
24
|
+
restrictions: null
|
25
|
+
enforce_admins: false
|
26
|
+
required_status_checks:
|
27
|
+
strict: true
|
28
|
+
contexts:
|
29
|
+
- "continuous-integration/travis-ci"
|
30
|
+
required_pull_request_reviews:
|
31
|
+
require_code_owner_reviews: true
|
data/.github/stale.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Configuration for probot-stale - https://github.com/probot/stale
|
2
|
+
|
3
|
+
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
4
|
+
daysUntilStale: 60
|
5
|
+
|
6
|
+
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
7
|
+
daysUntilClose: 7
|
8
|
+
|
9
|
+
# Issues or Pull Requests with these labels will never be considered stale
|
10
|
+
exemptLabels:
|
11
|
+
- pinned
|
12
|
+
- security
|
13
|
+
|
14
|
+
# Label to use when marking as stale
|
15
|
+
staleLabel: wontfix
|
16
|
+
|
17
|
+
# Comment to post when marking as stale. Set to `false` to disable
|
18
|
+
markComment: >
|
19
|
+
This issue has been automatically marked as stale because it has not had
|
20
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
21
|
+
for your contributions.
|
22
|
+
|
23
|
+
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
24
|
+
closeComment: false
|
25
|
+
|
26
|
+
# Limit to only `issues` or `pulls`
|
27
|
+
# only: issues
|
data/.rubocop.yml
CHANGED
@@ -12,9 +12,16 @@ Metrics/LineLength:
|
|
12
12
|
|
13
13
|
Style/FileName:
|
14
14
|
Enabled: false
|
15
|
-
|
15
|
+
|
16
16
|
Metrics/BlockLength:
|
17
17
|
Enabled: false
|
18
18
|
|
19
19
|
Style/DoubleNegation:
|
20
20
|
Enabled: false
|
21
|
+
|
22
|
+
AllCops:
|
23
|
+
Exclude:
|
24
|
+
- vendor/**/*
|
25
|
+
|
26
|
+
Jekyll/NoPutsAllowed:
|
27
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
require 'rubygems/specification'
|
3
|
-
require 'bundler'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'dotenv'
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
3
|
+
require "rubygems/package_task"
|
4
|
+
require "rubygems/specification"
|
5
|
+
require "bundler"
|
6
|
+
require "fileutils"
|
7
|
+
require "dotenv"
|
8
|
+
|
9
|
+
task :default => [:spec]
|
8
10
|
|
9
11
|
task :site do
|
10
12
|
Dotenv.load
|
11
|
-
FileUtils.chdir
|
13
|
+
FileUtils.chdir "templates"
|
12
14
|
`bundle exec jekyll-auth`
|
13
15
|
end
|
14
16
|
|
15
|
-
require
|
16
|
-
desc
|
17
|
+
require "rspec/core/rake_task"
|
18
|
+
desc "Run specs"
|
17
19
|
RSpec::Core::RakeTask.new do |t|
|
18
|
-
t.pattern =
|
19
|
-
t.rspec_opts = [
|
20
|
+
t.pattern = "spec/**/*_spec.rb"
|
21
|
+
t.rspec_opts = ["--order", "rand", "--color"]
|
20
22
|
end
|
data/bin/jekyll-auth
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# Command-line interface for jekyll-auth
|
3
5
|
|
4
6
|
require "mercenary"
|
@@ -105,7 +107,7 @@ Mercenary.program("jekyll-auth") do |p|
|
|
105
107
|
c.option "org_name", "--org_name", "An organization to authenticate against"
|
106
108
|
c.action do |_args, options|
|
107
109
|
if find_executable("heroku").nil?
|
108
|
-
|
110
|
+
puts "Looks like we're missing the Heroku client. Let's see if we can't install it..."
|
109
111
|
JekyllAuth::Commands.execute_command "wget", "-qO-", "https://toolbelt.heroku.com/install.sh", "|", "sh"
|
110
112
|
end
|
111
113
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ben@balter.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Contributing to Jekyll Auth
|
2
|
+
|
3
|
+
Hi there! We're thrilled that you'd like to contribute to Jekyll Auth. Your help is essential for keeping it great.
|
4
|
+
|
5
|
+
Jekyll Auth is an open source project supported by the efforts of an entire community and built one contribution at a time by users like you. We'd love for you to get involved. Whatever your level of skill or however much time you can give, your contribution is greatly appreciated. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, helping other users by commenting on issues, or writing code which can be incorporated into Jekyll Auth itself.
|
6
|
+
|
7
|
+
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.
|
8
|
+
|
9
|
+
## Troubleshooting
|
10
|
+
|
11
|
+
Having trouble with Jekyll Auth? Check out [the troubleshooting guidelines](troubleshooting.md) for solutions to common problems.
|
12
|
+
|
13
|
+
|
14
|
+
## How to report a bug
|
15
|
+
|
16
|
+
Think you found a bug? Please check [the list of open issues](https://github.com/benbalter/jekyll-auth/issues) to see if your bug has already been reported. If it hasn't please [submit a new issue](https://github.com/benbalter/jekyll-auth/issues/new).
|
17
|
+
|
18
|
+
Here are a few tips for writing *great* bug reports:
|
19
|
+
|
20
|
+
* Describe the specific problem (e.g., "widget doesn't turn clockwise" versus "getting an error")
|
21
|
+
* Include the steps to reproduce the bug, what you expected to happen, and what happened instead
|
22
|
+
* Check that you are using the latest version of the project and its dependencies
|
23
|
+
* Include what version of the project your using, as well as any relevant dependencies
|
24
|
+
* Only include one bug per issue. If you have discovered two bugs, please file two issues
|
25
|
+
* Include screenshots or screencasts whenever possible
|
26
|
+
* Even if you don't know how to fix the bug, including a failing test may help others track it down
|
27
|
+
|
28
|
+
**If you find a security vulnerability, do not open an issue. Please email ben@balter.com instead.**
|
29
|
+
|
30
|
+
## How to suggest a feature or enhancement
|
31
|
+
|
32
|
+
If you find yourself wishing for a feature that doesn't exist in Jekyll Auth, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that Jekyll Auth has today have been added because our users saw the need.
|
33
|
+
|
34
|
+
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and goals of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible, including describing the problem you're trying to solve.
|
35
|
+
|
36
|
+
[Open an issue](https://github.com/benbalter/jekyll-auth/issues/new) which describes the feature you would like to see, why you want it, how it should work, etc.
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
## Your first contribution
|
41
|
+
|
42
|
+
We'd love for you to contribute to the project. Unsure where to begin contributing to Jekyll Auth? You can start by looking through these "good first issue" and "help wanted" issues:
|
43
|
+
|
44
|
+
* [Good first issues](https://github.com/benbalter/jekyll-auth/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - issues which should only require a few lines of code and a test or two
|
45
|
+
* [Help wanted issues](https://github.com/benbalter/jekyll-auth/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) - issues which may be a bit more involved, but are specifically seeking community contributions
|
46
|
+
|
47
|
+
*p.s. Feel free to ask for help; everyone is a beginner at first* :smiley_cat:
|
48
|
+
|
49
|
+
## How to propose changes
|
50
|
+
|
51
|
+
Here's a few general guidelines for proposing changes:
|
52
|
+
|
53
|
+
* If you are changing any user-facing functionality, please be sure to update the documentation
|
54
|
+
* If you are adding a new behavior or changing an existing behavior, please be sure to update the corresponding test(s)
|
55
|
+
* Each pull request should implement **one** feature or bug fix. If you want to add or fix more than one thing, submit more than one pull request
|
56
|
+
* Do not commit changes to files that are irrelevant to your feature or bug fix
|
57
|
+
* Don't bump the version number in your pull request (it will be bumped prior to release)
|
58
|
+
* Write [a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
59
|
+
|
60
|
+
At a high level, [the process for proposing changes](https://guides.github.com/introduction/flow/) is:
|
61
|
+
|
62
|
+
1. [Fork](https://github.com/benbalter/jekyll-auth/fork) and clone the project
|
63
|
+
2. Configure and install the dependencies: `script/bootstrap`
|
64
|
+
3. Make sure the tests pass on your machine: `script/cibuild`
|
65
|
+
4. Create a descriptively named branch: `git checkout -b my-branch-name`
|
66
|
+
5. Make your change, add tests and documentation, and make sure the tests still pass
|
67
|
+
6. Push to your fork and [submit a pull request](https://github.com/benbalter/jekyll-auth/compare) describing your change
|
68
|
+
7. Pat your self on the back and wait for your pull request to be reviewed and merged
|
69
|
+
|
70
|
+
**Interesting in submitting your first Pull Request?** It's easy! You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
|
71
|
+
|
72
|
+
## Bootstrapping your local development environment
|
73
|
+
|
74
|
+
`script/bootstrap`
|
75
|
+
|
76
|
+
## Running tests
|
77
|
+
|
78
|
+
`script/cibuild`
|
79
|
+
|
80
|
+
## Code of conduct
|
81
|
+
|
82
|
+
This project is governed by [the Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
83
|
+
|
84
|
+
## Additional Resources
|
85
|
+
|
86
|
+
* [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
|
87
|
+
* [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
|
88
|
+
* [GitHub Help](https://help.github.com)
|
data/docs/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
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) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
|
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
|
+
## Under the hood
|
21
|
+
|
22
|
+
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.
|
23
|
+
|
24
|
+
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).
|
25
|
+
|
26
|
+
If they're in the org, they get the page. Otherwise, all they ever get is [the bouncer](http://octodex.github.com/bouncer/).
|
27
|
+
|
28
|
+
## Further reading
|
29
|
+
|
30
|
+
* [Configuring](configuring.md)
|
31
|
+
* [Getting started](getting-started.md)
|
32
|
+
* [Running locally](running-locally.md)
|
33
|
+
* [Troubleshooting](troubleshooting.md)
|
data/docs/_config.yml
ADDED
data/docs/configuring.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
## Configuration
|
2
|
+
|
3
|
+
### Whitelisting
|
4
|
+
|
5
|
+
Don't want to require authentication for every part of your site? Fine! Add a whitelist to your Jekyll's **config.yml** file:
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
jekyll_auth:
|
9
|
+
whitelist:
|
10
|
+
- drafts?
|
11
|
+
```
|
12
|
+
|
13
|
+
`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.
|
14
|
+
|
15
|
+
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:
|
16
|
+
|
17
|
+
```yaml
|
18
|
+
jekyll_auth:
|
19
|
+
whitelist:
|
20
|
+
- "^((?!draft).)*$"
|
21
|
+
```
|
22
|
+
|
23
|
+
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/).
|
24
|
+
|
25
|
+
### Requiring SSL
|
26
|
+
|
27
|
+
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.
|
28
|
+
|
29
|
+
```yaml
|
30
|
+
jekyll_auth:
|
31
|
+
ssl: true
|
32
|
+
```
|
33
|
+
|
34
|
+
### Using a custom 404
|
35
|
+
|
36
|
+
Just like GitHub Pages, Jekyll Auth will honor a custom 404 page, if it's generated as `/404.html` in the built site.
|
@@ -0,0 +1,63 @@
|
|
1
|
+
## Getting Started
|
2
|
+
|
3
|
+
### Create a GitHub Application
|
4
|
+
|
5
|
+
1. Navigate to [the GitHub app registration page](https://github.com/settings/applications/new)
|
6
|
+
2. Give your app a name
|
7
|
+
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>
|
8
|
+
4. Specify the callback URL; should be like this: <https://my-site.herokuapp.com/auth/github/callback>; note that this is **https**, not http.
|
9
|
+
5. Hit Save, but leave the page open, you'll need some of the information in a moment
|
10
|
+
|
11
|
+
Remember the 'my-site' part for later on when using `heroku create`. Also, my-site is often called 'app-name' in Heroku documentation.
|
12
|
+
|
13
|
+
### Add Jekyll Auth to your site
|
14
|
+
|
15
|
+
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:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
source "https://rubygems.org"
|
19
|
+
|
20
|
+
gem 'jekyll-auth'
|
21
|
+
```
|
22
|
+
|
23
|
+
2. `cd` into your project's directory and run `bundle install`. If you get an error using `bundle install`, see Troubleshooting below.
|
24
|
+
|
25
|
+
3. Run `bundle exec jekyll-auth new` which will copy the necessary files to set up the server
|
26
|
+
|
27
|
+
|
28
|
+
### Setting up hosting with Heroku
|
29
|
+
|
30
|
+
#### Automatically
|
31
|
+
|
32
|
+
Run `bundle exec jekyll-auth setup --client_id XXX --client_secret XXX --org_name XXX`
|
33
|
+
|
34
|
+
(or `--team_id XXX`)
|
35
|
+
|
36
|
+
#### Manually
|
37
|
+
|
38
|
+
1. You may need to add and commit the files generated by `jekyll-auth new` to Git before continuing
|
39
|
+
2. Make sure you have [the Heroku toolbelt](https://toolbelt.heroku.com/) installed
|
40
|
+
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.
|
41
|
+
4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_NAME=XXX` (or `GITHUB_TEAM_ID`)
|
42
|
+
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`
|
43
|
+
6. `heroku open` to open the site in your browser
|
44
|
+
|
45
|
+
#### Find the Organization ID (needed to find Team ID)
|
46
|
+
|
47
|
+
If you need to find an organization's ID, you can use the following cURL command:
|
48
|
+
|
49
|
+
```
|
50
|
+
curl https://api.github.com/orgs/{org_name}
|
51
|
+
```
|
52
|
+
|
53
|
+
#### Finding the Team ID
|
54
|
+
|
55
|
+
If you need help finding a team's numeric ID, you can use the `jekyll-auth team_id` command.
|
56
|
+
|
57
|
+
For example, to find the team ID for @jekyll/maintainers you'd run the command:
|
58
|
+
|
59
|
+
```
|
60
|
+
jekyll-auth team_id --org jekyll --team maintainers
|
61
|
+
```
|
62
|
+
|
63
|
+
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.
|