omniauth-kitt 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +24 -0
- data/.gitignore +8 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +10 -0
- data/lib/omniauth/kitt.rb +2 -0
- data/lib/omniauth/kitt/version.rb +5 -0
- data/lib/omniauth/strategies/kitt.rb +26 -0
- data/omniauth-kitt.gemspec +24 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f6c1d5b9fc0440b6c30d82cb18fb28cf4298f70246241f5e560fda83529fc8d
|
4
|
+
data.tar.gz: 95642dc0b6e4a35eb022aaf652b490a6b770041652e7a947fe653ba238118ab4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c193160d7721bb44867a6fc28127f0e92caedd3e56f767b6f4b6f73b091d10de79b62dc812ec47b3f1b9fdf4ff3d2232232cf4743fd06593ed5356ea4242fa00
|
7
|
+
data.tar.gz: 2247c55676b86f361e2a15795c5586184b728bca5cc9dece76e3d696b0c2ca5555d204f7cf82a3aa784365826a93e7d6acb8ca38b16d149d3d804578a4c97c84
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.6
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.6.x
|
20
|
+
- name: Build and test with Rake
|
21
|
+
run: |
|
22
|
+
gem install bundler
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-kitt (0.1.0)
|
5
|
+
omniauth-oauth2
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
faraday (1.0.0)
|
11
|
+
multipart-post (>= 1.2, < 3)
|
12
|
+
hashie (3.6.0)
|
13
|
+
jwt (2.2.1)
|
14
|
+
minitest (5.14.0)
|
15
|
+
multi_json (1.14.1)
|
16
|
+
multi_xml (0.6.0)
|
17
|
+
multipart-post (2.1.1)
|
18
|
+
oauth2 (1.4.4)
|
19
|
+
faraday (>= 0.8, < 2.0)
|
20
|
+
jwt (>= 1.0, < 3.0)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
multi_xml (~> 0.5)
|
23
|
+
rack (>= 1.2, < 3)
|
24
|
+
omniauth (1.9.0)
|
25
|
+
hashie (>= 3.4.6, < 3.7.0)
|
26
|
+
rack (>= 1.6.2, < 3)
|
27
|
+
omniauth-oauth2 (1.6.0)
|
28
|
+
oauth2 (~> 1.1)
|
29
|
+
omniauth (~> 1.9)
|
30
|
+
rack (2.2.2)
|
31
|
+
rake (12.3.3)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
minitest (~> 5.0)
|
38
|
+
omniauth-kitt!
|
39
|
+
rake (~> 12.0)
|
40
|
+
|
41
|
+
BUNDLED WITH
|
42
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Sébastien Saunier
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# OmniAuth::Kitt
|
2
|
+
|
3
|
+
Provides an OAuth connection for Le Wagon alumni.
|
4
|
+
|
5
|
+
## Usage with Devise
|
6
|
+
|
7
|
+
Add this line to your application's `Gemfile`, then `bundle install`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-kitt'
|
11
|
+
```
|
12
|
+
|
13
|
+
Go to [kitt.lewagon.com/oauth/applications](https://kitt.lewagon.com/oauth/applications) and create a new application.
|
14
|
+
|
15
|
+
Callback URL will be `http(s)://HOST/users/auth/kitt/callback`
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Devise.setup do |config|
|
19
|
+
config.omniauth :kitt, APP_ID, SECRET
|
20
|
+
|
21
|
+
# [...]
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
Your `User` model needs this line:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
class User < ApplicationRecord
|
29
|
+
devise :omniauthable, omniauth_providers: [ :kitt ]
|
30
|
+
|
31
|
+
# [...]
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
And your controller:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
39
|
+
def kitt
|
40
|
+
auth = request.env["omniauth.auth"]
|
41
|
+
# [...]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
`auth` has the following keys:
|
47
|
+
|
48
|
+
- `id` as an integer
|
49
|
+
- `github_nickname` as a string
|
50
|
+
- `email`, `first_name`, `last_name` & `avatar_url` as strings
|
51
|
+
- `admin` as a boolean
|
52
|
+
- `cities` as an array of _slugs_ (City managers)
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Kitt < ::OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, :kitt
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => "https://kitt.lewagon.com",
|
10
|
+
:authorize_url => "/oauth/authorize"
|
11
|
+
}
|
12
|
+
|
13
|
+
uid do
|
14
|
+
raw_info[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
info do
|
18
|
+
raw_info
|
19
|
+
end
|
20
|
+
|
21
|
+
def raw_info
|
22
|
+
@raw_info ||= access_token.get('/api/v1/me.json').parsed.symbolize_keys
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'lib/omniauth/kitt/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "omniauth-kitt"
|
5
|
+
spec.version = OmniAuth::Kitt::VERSION
|
6
|
+
spec.authors = ["Sébastien Saunier"]
|
7
|
+
spec.email = ["seb@saunier.me"]
|
8
|
+
|
9
|
+
spec.summary = %q{OmniAuth strategy for Kitt}
|
10
|
+
spec.description = %q{Le Wagon's alumni platform provides OAuth capabilities for the ecosystem}
|
11
|
+
spec.homepage = "https://github.com/lewagon/omniauth-kitt"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/lewagon/omniauth-kitt"
|
17
|
+
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
spec.add_dependency "omniauth-oauth2"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-kitt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sébastien Saunier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Le Wagon's alumni platform provides OAuth capabilities for the ecosystem
|
28
|
+
email:
|
29
|
+
- seb@saunier.me
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".github/workflows/ruby.yml"
|
35
|
+
- ".gitignore"
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- lib/omniauth/kitt.rb
|
42
|
+
- lib/omniauth/kitt/version.rb
|
43
|
+
- lib/omniauth/strategies/kitt.rb
|
44
|
+
- omniauth-kitt.gemspec
|
45
|
+
homepage: https://github.com/lewagon/omniauth-kitt
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata:
|
49
|
+
homepage_uri: https://github.com/lewagon/omniauth-kitt
|
50
|
+
source_code_uri: https://github.com/lewagon/omniauth-kitt
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.3.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: OmniAuth strategy for Kitt
|
70
|
+
test_files: []
|