zaikio-oauth_client 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 331698c5601daa90812282be1d71a0009a7814892725edfadf4c2c74e587fd01
4
- data.tar.gz: ea380a6d82e708c877016d76fdef4b37f1c5eacaff1794f699ee58c333a8ffed
3
+ metadata.gz: 87237aefe3118d60dbfd8180ef1616274bbd581374bd6e7585e0e2666c5cd72b
4
+ data.tar.gz: cab7004abd9c478b79dfa78053cd3e731d0413ae3e909d3791dc7077a4bf811d
5
5
  SHA512:
6
- metadata.gz: d3d5325374e9eab95c6f71fe4685a2b78ea02bfbf397fd924d426e72916a1dc164b36d0e2fd3deff867cff82940d4a85edb59d4942c496b5e7e037d438536c07
7
- data.tar.gz: 3953445f638417b51d1a46f25e85e98fbe706bc5adf221c4aa84e6976290cde61f465c9d9a37d2fe4b6bcbde27c786786352a4ec32ecb858d425bfd18116e4cf
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
- This gem is a **Ruby Gem** and is hosted privately in the **GitHub Package Registry**.
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
- source "https://rubygems.pkg.github.com/crispymtn" do
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:
@@ -6,7 +6,7 @@ module Zaikio
6
6
  private
7
7
 
8
8
  def approve_url(client_name = nil)
9
- approve_connection_url(client_name)
9
+ zaikio_oauth_client.approve_connection_url(client_name)
10
10
  end
11
11
 
12
12
  def use_org_config?
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", to: "sessions#new", as: :new_session
4
- get "(/:client_name)/sessions/approve", to: "sessions#approve", as: :approve_session
5
- delete "(/:client_name)/session", to: "sessions#destroy", as: :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", to: "connections#new", as: :new_connection
9
- get "(/:client_name)/connections/approve", to: "connections#approve", as: :approve_connection
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
@@ -39,7 +39,7 @@ module Zaikio
39
39
  private
40
40
 
41
41
  def approve_url(client_name = nil)
42
- approve_session_url(client_name)
42
+ zaikio_oauth_client.approve_session_url(client_name)
43
43
  end
44
44
 
45
45
  def use_org_config?
@@ -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)
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module OAuthClient
3
- VERSION = "0.3.3".freeze
3
+ VERSION = "0.3.4".freeze
4
4
  end
5
5
  end
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.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
- - Steffen Boller
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@crispymtn.com
89
- - cw@crispymtn.com
90
- - mp@crispymtn.com
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: []