├── config.ru
├── env-example
├── Gemfile
├── README.md
├── .gitignore
├── Rakefile
├── LICENSE
├── views
└── auth.erb
├── Gemfile.lock
└── app.rb
/config.ru:
--------------------------------------------------------------------------------
1 | env = ENV['RACK_ENV'].to_sym
2 |
3 | require "bundler/setup"
4 | Bundler.require(:default, env)
5 |
6 | Dotenv.load unless env == :production
7 |
8 | require './app'
9 | run Sinatra::Application
10 |
--------------------------------------------------------------------------------
/env-example:
--------------------------------------------------------------------------------
1 | # rename to .env when developing locally
2 |
3 | GITHUB_KEY=
4 | GITHUB_SECRET=
5 | GITHUB_USERNAME=barryf
6 |
7 | REDIS_URL=redis://127.0.0.1:6379
8 |
9 | COOKIE_SECRET=choose_a_strong_password_or_phrase
10 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | ruby '2.7.3'
4 |
5 | gem 'sinatra'
6 | gem 'thin'
7 | gem 'rack-ssl'
8 | gem 'redis'
9 | gem 'omniauth'
10 | gem 'omniauth-github'
11 | gem 'foreman'
12 |
13 | group :development do
14 | gem 'shotgun'
15 | gem 'dotenv'
16 | end
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Acquiescence
2 |
3 | Acquiescence is a very simple [IndieAuth](https://indieweb.org/indieauth) authorization and token endpoint.
4 |
5 | It requires a [Redis](https://redis.io/) server.
6 |
7 | It's currently only set up to authorize using GitHub because that's my preferred provider, but adding in additional [OmniAuth](https://github.com/omniauth/omniauth)-compatible providers should be reasonably simple.
8 |
9 | ---
10 |
11 | [Barry Frost](https://barryfrost.com/)
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.rbc
3 | /.config
4 | /coverage/
5 | /InstalledFiles
6 | /pkg/
7 | /spec/reports/
8 | /spec/examples.txt
9 | /test/tmp/
10 | /test/version_tmp/
11 | /tmp/
12 |
13 | # Used by dotenv library to load environment variables.
14 | .env
15 |
16 | ## Environment normalization:
17 | /.bundle/
18 | /vendor/bundle
19 | /lib/bundler/man/
20 |
21 | # for a library or gem, you might want to ignore these files since the code is
22 | # intended to run in multiple environments; otherwise, check them in:
23 | # Gemfile.lock
24 | # .ruby-version
25 | # .ruby-gemset
26 |
27 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
28 | .rvmrc
29 | .rubocop.yml
30 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | env = (ENV['RACK_ENV'] || 'development').to_sym
2 |
3 | require "bundler/setup"
4 | Bundler.require(:default, env)
5 |
6 | Dotenv.load unless env == :production
7 |
8 | REDIS = Redis.new(url: ENV['REDIS_URL'])
9 |
10 | desc "List all keys in the Redis store."
11 | task :keys do
12 | keys = REDIS.scan(0)[1]
13 | keys.each do |key|
14 | puts key
15 | end
16 | end
17 |
18 | desc "Get a key from the Redis store and display its value."
19 | task :key, :key do |t, args|
20 | key = args[:key]
21 | v = REDIS.get(key)
22 | if v
23 | puts v
24 | else
25 | puts "Key was not found."
26 | end
27 | end
28 |
29 | desc "Flush the Redis store."
30 | task :flush do
31 | REDIS.flushall
32 | puts "Flushed."
33 | end
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Barry Frost
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/views/auth.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |