zaikio-oauth_client 0.3.3 → 0.3.4
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 +4 -4
- data/README.md +23 -16
- data/app/controllers/zaikio/oauth_client/connections_controller.rb +1 -1
- data/config/routes.rb +10 -5
- data/lib/zaikio/oauth_client/authenticatable.rb +1 -1
- data/lib/zaikio/oauth_client/configuration.rb +12 -1
- data/lib/zaikio/oauth_client/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87237aefe3118d60dbfd8180ef1616274bbd581374bd6e7585e0e2666c5cd72b
|
4
|
+
data.tar.gz: cab7004abd9c478b79dfa78053cd3e731d0413ae3e909d3791dc7077a4bf811d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e23d82d5ce5497a4ea1b5a8846b3cd1092b288ecc6de3d34d29aa781b978e99c9a524beb126918474894a6a05f3f6b94378fefce9b8f9a7149b3e06780d67d
|
7
|
+
data.tar.gz: 2fdc1505620138dd80e4ee1caf8f5d9d0ab0d3d5fb7cf6a6af36a6fbb485a6c8a085702c6c47fcdec5aac5a690cb210d8f067ca7cbe458bb2d5a4c3713f6eee9
|
data/README.md
CHANGED
@@ -5,27 +5,13 @@ This Gem enables you to easily connect to the Zaikio Directory and use the OAuth
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
To fetch it from the GitHub Package Registry follow these steps:
|
11
|
-
|
12
|
-
1. You must use a personal access token with the `read:packages` and `write:packages` scopes to publish and delete public packages in the GitHub Package Registry with RubyGems. Your personal access token must also have the `repo` scope when the repository is private. For more information, see "[Creating a personal access token for the command line](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)."
|
13
|
-
|
14
|
-
2. Set an ENV variable that will be used for both gem and npm. *This will also work on Heroku or your CI App if you set the ENV variable there.*
|
15
|
-
```bash
|
16
|
-
export BUNDLE_RUBYGEMS__PKG__GITHUB__COM=#Your-Token-Here#
|
17
|
-
```
|
18
|
-
|
19
|
-
3. Add the following in your Gemfile
|
8
|
+
Simply add the following in your Gemfile:
|
20
9
|
|
21
10
|
```ruby
|
22
|
-
|
23
|
-
gem "zaikio-oauth_client"
|
24
|
-
end
|
11
|
+
gem "zaikio-oauth_client"
|
25
12
|
```
|
26
13
|
Then run `bundle install`.
|
27
14
|
|
28
|
-
|
29
15
|
## Setup & Configuration
|
30
16
|
|
31
17
|
### 1. Copy & run Migrations
|
@@ -136,6 +122,27 @@ class ApplicationController < ActionController::Base
|
|
136
122
|
end
|
137
123
|
```
|
138
124
|
|
125
|
+
#### Custom behavior
|
126
|
+
|
127
|
+
Since the built in `SessionsController` and `ConnectionsController` are inheriting from the main app's `ApplicationController` all behaviour will be added there, too. In some cases you might want to explicitly skip a `before_action` or add custom `before_action` callbacks.
|
128
|
+
|
129
|
+
You can achieve this by adding a custom controller name to your configuration:
|
130
|
+
|
131
|
+
```rb
|
132
|
+
# app/controllers/sessions_controller.rb
|
133
|
+
class SessionsController < Zaikio::OAuthClient::SessionsController
|
134
|
+
skip_before_action :redirect_unless_authenticated
|
135
|
+
end
|
136
|
+
|
137
|
+
# config/initializers/zaikio_oauth_client.rb
|
138
|
+
Zaikio::OAuthClient.configure do |config|
|
139
|
+
# ...
|
140
|
+
config.sessions_controller_name = "sessions"
|
141
|
+
# config.connections_controller_name = "connections"
|
142
|
+
# ...
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
139
146
|
#### Testing
|
140
147
|
|
141
148
|
You can use our test helper to login different users:
|
data/config/routes.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
Zaikio::OAuthClient::Engine.routes.draw do
|
2
|
+
sessions_controller = Zaikio::OAuthClient.configuration.sessions_controller_name
|
3
|
+
connections_controller = Zaikio::OAuthClient.configuration.connections_controller_name
|
4
|
+
|
2
5
|
# People
|
3
|
-
get "(/:client_name)/sessions/new",
|
4
|
-
get "(/:client_name)/sessions/approve",
|
5
|
-
delete "(/:client_name)/session",
|
6
|
+
get "(/:client_name)/sessions/new", action: :new, controller: sessions_controller, as: :new_session
|
7
|
+
get "(/:client_name)/sessions/approve", action: :approve, controller: sessions_controller, as: :approve_session
|
8
|
+
delete "(/:client_name)/session", action: :destroy, controller: sessions_controller, as: :session
|
6
9
|
|
7
10
|
# Organizations
|
8
|
-
get "(/:client_name)/connections/new",
|
9
|
-
|
11
|
+
get "(/:client_name)/connections/new", action: :new,
|
12
|
+
controller: connections_controller, as: :new_connection
|
13
|
+
get "(/:client_name)/connections/approve", action: :approve,
|
14
|
+
controller: connections_controller, as: :approve_connection
|
10
15
|
end
|
@@ -14,11 +14,14 @@ module Zaikio
|
|
14
14
|
|
15
15
|
attr_accessor :host
|
16
16
|
attr_writer :logger
|
17
|
-
attr_reader :client_configurations, :environment, :around_auth_block
|
17
|
+
attr_reader :client_configurations, :environment, :around_auth_block,
|
18
|
+
:sessions_controller_name, :connections_controller_name
|
18
19
|
|
19
20
|
def initialize
|
20
21
|
@client_configurations = {}
|
21
22
|
@around_auth_block = nil
|
23
|
+
@sessions_controller_name = "sessions"
|
24
|
+
@connections_controller_name = "connections"
|
22
25
|
end
|
23
26
|
|
24
27
|
def logger
|
@@ -47,6 +50,14 @@ module Zaikio
|
|
47
50
|
@around_auth_block = block
|
48
51
|
end
|
49
52
|
|
53
|
+
def sessions_controller_name=(name)
|
54
|
+
@sessions_controller_name = "/#{name}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def connections_controller_name=(name)
|
58
|
+
@connections_controller_name = "/#{name}"
|
59
|
+
end
|
60
|
+
|
50
61
|
private
|
51
62
|
|
52
63
|
def host_for(environment)
|
metadata
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zaikio-oauth_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Christian Weyer
|
9
|
-
- Matthias Prinz
|
7
|
+
- Zaikio GmbH
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
@@ -85,9 +83,10 @@ dependencies:
|
|
85
83
|
description: This gem provides a mountable Rails engine that provides single sign
|
86
84
|
on, directory access and further Zaikio platform connectivity.
|
87
85
|
email:
|
88
|
-
- sb@
|
89
|
-
- cw@
|
90
|
-
- mp@
|
86
|
+
- sb@zaikio.com
|
87
|
+
- cw@zaikio.com
|
88
|
+
- mp@zaikio.com
|
89
|
+
- js@zaikio.com
|
91
90
|
executables: []
|
92
91
|
extensions: []
|
93
92
|
extra_rdoc_files: []
|