omniauth-zeuswpi 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f85d928de8aa7f50169f211a5e0d7274b953fd52f2659968028346ce41339d46
4
- data.tar.gz: df0ac1cb065f9be81d7f097c1bbb64075adbb2b7d8ec939e77e2ff2f532eab67
3
+ metadata.gz: f5eb66f8bc8167c32055a23ab48ef1cd21265373b5b56b92e3adafb5157fc722
4
+ data.tar.gz: a3412cc3633f7dc193ad2d35b1b67c28e56e9a3bb04c6aebf3bbd3483cd17f4b
5
5
  SHA512:
6
- metadata.gz: 2c1606e92208e7529748e6f4f804e8dae9ad1a7fad8d1b147fd9467ef6e6b4ea1feb1b9face4022cacb29c71c92cbd000df5332b22e3225a4d05eb0a19b57479
7
- data.tar.gz: 37ed560d4ec48400fd9502c7dc3b3e4a9ab63935871dbc52567b2cbdcd85db8db1a5d4258fc1c80a7468ab2e84c775593472ae2ee15c7920fac9fc8b7ddbfe1c
6
+ metadata.gz: 11c71863ed4aac88099157671fae11f2362dd41557a763e97f8a402f01ee6dc107da62390cb5850b5279d95037e442a9a9b6788d091b68359ec81f7f49ce76a9
7
+ data.tar.gz: dc8d0bb46269b878377c499ba70f96a660e5e575575c794da9350b7b9a4158aa8f6c6c180744788009fc3731c4745fab751cd545839cc92cfb8445a832a451e3
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-zeuswpi (1.0.0)
5
+ omniauth-oauth2 (~> 1.7.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ faraday (2.3.0)
11
+ faraday-net_http (~> 2.0)
12
+ ruby2_keywords (>= 0.0.4)
13
+ faraday-net_http (2.0.3)
14
+ hashie (5.0.0)
15
+ jwt (2.3.0)
16
+ multi_json (1.15.0)
17
+ multi_xml (0.6.0)
18
+ oauth2 (1.4.9)
19
+ faraday (>= 0.17.3, < 3.0)
20
+ jwt (>= 1.0, < 3.0)
21
+ multi_json (~> 1.3)
22
+ multi_xml (~> 0.5)
23
+ rack (>= 1.2, < 3)
24
+ omniauth (2.1.0)
25
+ hashie (>= 3.4.6)
26
+ rack (>= 2.2.3)
27
+ rack-protection
28
+ omniauth-oauth2 (1.7.2)
29
+ oauth2 (~> 1.4)
30
+ omniauth (>= 1.9, < 3)
31
+ rack (2.2.3)
32
+ rack-protection (2.2.0)
33
+ rack
34
+ ruby2_keywords (0.0.5)
35
+
36
+ PLATFORMS
37
+ x86_64-darwin-21
38
+
39
+ DEPENDENCIES
40
+ omniauth-zeuswpi!
41
+
42
+ BUNDLED WITH
43
+ 2.3.13
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ [![Gem Version](https://badge.fury.io/rb/omniauth-zeuswpi.svg)](https://badge.fury.io/rb/omniauth-zeuswpi)
2
+
3
+ # OmniAuth ZeusWPI Zauth Strategy
4
+
5
+ Strategy to authenticate with [Zeus WPI](https://zeus.gent) via OAuth2 in OmniAuth, powered by [Zauth](https://github.com/ZeusWPI/zauth).
6
+
7
+ ## Installation
8
+
9
+ Add to your `Gemfile`
10
+ ```ruby
11
+ gem 'omniauth-oauth2'
12
+ gem 'omniauth-zeuswpi'
13
+ gem 'omniauth-rails_csrf_protection'
14
+ ```
15
+
16
+ And run `bundle install`
17
+
18
+ ## Usage
19
+
20
+ _Note: Change `User` to your specific User model_
21
+
22
+ 1. Add the strategy to the omniauth config:
23
+
24
+ ```ruby
25
+ config.omniauth :zeuswpi,
26
+ Rails.application.credentials.omniauth_client_id,
27
+ Rails.application.credentials.omniauth_client_secret,
28
+ token_params: { parse: :json }
29
+ ```
30
+
31
+ 2. Add a callbacks controller:
32
+ ```ruby
33
+ class CallbacksController < Devise::OmniauthCallbacksController
34
+ # See https://github.com/omniauth/omniauth/wiki/FAQ#rails-session-is-clobbered-after-callback-on-developer-strategy
35
+ skip_before_action :verify_authenticity_token, only: :zeuswpi
36
+
37
+ def zeuswpi
38
+ @user = User.from_omniauth(request.env["omniauth.auth"])
39
+ sign_in_and_redirect @user, event: :authentication
40
+ end
41
+
42
+ def after_omniauth_failure_path_for(scope)
43
+ root_path
44
+ end
45
+ end
46
+ ```
47
+
48
+ 3. Add the Devise Omniauth routes:
49
+ ```ruby
50
+ devise_for :users, controllers: {
51
+ omniauth_callbacks: 'callbacks'
52
+ }
53
+ ```
54
+
55
+ 4. Make your User model omniauthable:
56
+ ```ruby
57
+ devise :omniauthable, omniauth_providers: %i[zeuswpi]
58
+ ```
59
+
60
+ 5. Add the `from_omniauth` helper to your `User` model:
61
+ ```ruby
62
+ def self.from_omniauth(auth)
63
+ where(name: auth.uid).first_or_create do |user|
64
+ user.name = auth.uid
65
+ user.generate_key!
66
+ end
67
+ end
68
+
69
+ ```
70
+ 6. Add a button to your website:
71
+ ```
72
+ <%= button_to "Log in with Zeus WPI",
73
+ user_zeuswpi_omniauth_authorize_path %>
74
+ ```
75
+
76
+
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module ZeusWPI
5
- VERSION = '0.0.1'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-zeuswpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Naessens, Zeus WPI
@@ -34,7 +34,9 @@ extra_rdoc_files: []
34
34
  files:
35
35
  - ".gitignore"
36
36
  - Gemfile
37
+ - Gemfile.lock
37
38
  - LICENSE
39
+ - README.md
38
40
  - lib/omniauth-zeuswpi.rb
39
41
  - lib/omniauth/strategies/zeuswpi.rb
40
42
  - lib/omniauth/zeuswpi.rb