doorkeeper_hub 0.1.1 → 0.1.2

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: 4e23d3e5083949341c37c8232317c3522835d48c407ebc2f6800a2212b5e3eff
4
- data.tar.gz: 216e1277207ae9f51da9cb537b74f6ac0a0949bfe89a49a24e757c6a68ba8937
3
+ metadata.gz: e0323f1e027ab3321e8a50037d70ecf9bb7f98f15b0c5d88080870031d20fb71
4
+ data.tar.gz: d42bd09e2885ac4c4818f3563c8f144bf7dd8c4c1cdefd91c34625d1c8fc4c73
5
5
  SHA512:
6
- metadata.gz: bed5ad5532c7919d3838a41405f7ccd8d3204e54becef917a5364117e9c5d710b10279a87e2c045466851f6ad3cf93a67ca42048b663043688b383478fb55388
7
- data.tar.gz: 9040b8be14c6a28bfc47091e1c3b6fad189be2758b3eaf253c73bef1d6c0ae3ff0a2695fb1e8fac7ca921021a9557a0491bb9b2c6e95e2a61d91ba08e31989d6
6
+ metadata.gz: 05d6ebb3327da326b0bad77c7d06c0d2d423370f2ea2304777a42122133da11b02e86e631febe19b2aa2666c6f17e7cbe1b04b151454436c9264974deefc8f52
7
+ data.tar.gz: 933017e512524a9dd518e02e788399e715f63e3a736004de8e8cb7f2014b41c12d6d0adcffc6a6d78978687b0223401fb26ce89d3f2b25dceb01e808502c7068
@@ -4,7 +4,7 @@ module DoorkeeperHub
4
4
  return if params[:access_token] != DoorkeeperHub.config.service_token
5
5
  # {name, access_token, doorkeeper_token, active, options}
6
6
  record = DoorkeeperHub.config.scope_model.find_or_initialize_by(
7
- DoorkeeperHub.config.doorkeeper_token_name => params[DoorkeeperHub.config.doorkeeper_token_name]
7
+ DoorkeeperHub.token_name => params[DoorkeeperHub.token_name]
8
8
  )
9
9
  record.update active: params[:active], name: params[:name]
10
10
  render body: nil
@@ -1,10 +1,13 @@
1
1
  module DoorkeeperHub
2
2
  class OmniauthCallbacksController < Devise::OmniauthCallbacksController
3
- skip_before_action :verify_authenticity_token, :check_login!, :check_d_token, only: :saml
3
+ skip_before_action :verify_authenticity_token,
4
+ :check_login!,
5
+ :check_d_token, only: :saml
4
6
 
5
7
  def saml
6
- # You need to implement the method below in your model (e.g. app/models/user.rb)
7
- @user = DoorkeeperHub.config.user_model.from_omniauth(request.env["omniauth.auth"])
8
+ @user = DoorkeeperHub
9
+ .user_model
10
+ .from_omniauth(request.env["omniauth.auth"])
8
11
 
9
12
  if @user.present? && @user.persisted?
10
13
  sign_in_and_redirect @user, event: :authentication
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do
2
+ devise_for DoorkeeperHub.devise_scope,
3
+ controllers: {
4
+ omniauth_callbacks: 'doorkeeper_hub/omniauth_callbacks'
5
+ }
6
+
7
+ post 'doorkeeper/activation', to: 'doorkeeper_hub/callbacks#activation'
8
+ end
@@ -1,3 +1,3 @@
1
1
  module DoorkeeperHub
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -11,4 +11,16 @@ module DoorkeeperHub
11
11
  def self.configure
12
12
  yield config
13
13
  end
14
+
15
+ def self.devise_scope
16
+ config.user_model.to_s.downcase.pluralize.to_sym
17
+ end
18
+
19
+ def self.user_model
20
+ config.user_model
21
+ end
22
+
23
+ def self.token_name
24
+ config.doorkeeper_token_name
25
+ end
14
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Fan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-24 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,7 @@ files:
83
83
  - app/controllers/doorkeeper_hub/omniauth_callbacks_controller.rb
84
84
  - bin/console
85
85
  - bin/setup
86
+ - config/routes.rb
86
87
  - doorkeeper_hub.gemspec
87
88
  - lib/doorkeeper_hub.rb
88
89
  - lib/doorkeeper_hub/configurator.rb