oidc_provider 0.2.0 → 0.3.0

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
- SHA1:
3
- metadata.gz: 41bdbed874e8113e65850159b35a33a11a2b9a8d
4
- data.tar.gz: fe9d64dee100c3db0f904093547ef53f1de75100
2
+ SHA256:
3
+ metadata.gz: 052162d08f6ce2895b4deed51b80a11f0a4a9bc01e82d61b95c5f93ad6080284
4
+ data.tar.gz: fb94f8fa4d0feb3a134d457ab941faf3c5bdf935359b5dbe593c423c6137524c
5
5
  SHA512:
6
- metadata.gz: 11d61e2c1235091847cc52d681fc2e5814cc8b52aa88d25edb4946362d24ab2c145ef743f5bd2ce1b99b47a810a1bd0bb3c3023ebcdaf6f7e652024c1c743094
7
- data.tar.gz: b0a8161350e3d45e813ab53cbf85e8ed9904f2c5aab96500873893138685b0bc65f8925aad26e4fd1b59a0fd8b7720e080fe1cb8feb9f825f61af3e167a057a0
6
+ metadata.gz: f2aae6b2d8794a0d7ae42073a4b83a7db6910a5f9379fe79789347930d47af6fe5275eef2745efe0f34e1f2bfa437304d7df8109a31dae29fbcb061f23f9b294
7
+ data.tar.gz: d6ea6683c1a05f2fd8d8413ed7a58cb877a04aa9ea4ed55307bd69b6cd63743d790e753530bdce95606b170b19a6cfd353384c3826a1613613bf572dfbd93345
@@ -0,0 +1,10 @@
1
+ module OIDCProvider
2
+ class SessionsController < ApplicationController
3
+ before_filter :require_authentication
4
+
5
+ def destroy
6
+ unauthenticate!
7
+ redirect_to root_url
8
+ end
9
+ end
10
+ end
@@ -4,11 +4,8 @@ module OIDCProvider
4
4
 
5
5
  scope :valid, -> { where(arel_table[:expires_at].gteq(Time.now.utc)) }
6
6
 
7
- after_initialize :set_defaults, unless: :persisted? # The set_defaults will only work if the object is new
8
- def set_defaults
9
- self.token = SecureRandom.hex 32
10
- self.expires_at = 1.hour.from_now
11
- end
7
+ attribute :token, :string, default: -> { SecureRandom.hex 32 }
8
+ attribute :expires_at, :datetime, default: -> { 1.hours.from_now }
12
9
 
13
10
  def to_bearer_token
14
11
  Rack::OAuth2::AccessToken::Bearer.new(
@@ -6,11 +6,8 @@ module OIDCProvider
6
6
 
7
7
  scope :valid, -> { where(arel_table[:expires_at].gteq(Time.now.utc)) }
8
8
 
9
- after_initialize :set_defaults, unless: :persisted? # The set_defaults will only work if the object is new
10
- def set_defaults
11
- self.code = SecureRandom.hex 32
12
- self.expires_at = 5.minutes.from_now
13
- end
9
+ attribute :code, :string, default: -> { SecureRandom.hex 32 }
10
+ attribute :expires_at, :datetime, default: -> { 5.minutes.from_now }
14
11
 
15
12
  serialize :scopes, JSON
16
13
 
@@ -2,10 +2,7 @@ module OIDCProvider
2
2
  class IdToken < ApplicationRecord
3
3
  belongs_to :authorization
4
4
 
5
- after_initialize :set_defaults, unless: :persisted? # The set_defaults will only work if the object is new
6
- def set_defaults
7
- self.expires_at = 1.hour.from_now
8
- end
5
+ attribute :expires_at, :datetime, default: -> { 1.hour.from_now }
9
6
 
10
7
  delegate :account, to: :authorization
11
8
 
@@ -1,6 +1,7 @@
1
1
  OIDCProvider::Engine.routes.draw do
2
2
  match 'authorizations' => 'authorizations#create', via: [:get, :post]
3
3
  resource :user_info, only: :show
4
+ get 'sessions/logout', to: 'sessions#destroy', as: :end_session
4
5
 
5
6
  post 'tokens', to: proc { |env| OIDCProvider::TokenEndpoint.new.call(env) }
6
7
  get 'jwks.json', as: :jwks, to: proc { |env| [200, {'Content-Type' => 'application/json'}, [OIDCProvider::IdToken.config[:jwk_set].to_json]] }
@@ -1,3 +1,3 @@
1
1
  module OIDCProvider
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oidc_provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Carey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -53,6 +53,7 @@ files:
53
53
  - app/controllers/oidc_provider/concerns/authentication.rb
54
54
  - app/controllers/oidc_provider/concerns/connect_endpoint.rb
55
55
  - app/controllers/oidc_provider/discovery_controller.rb
56
+ - app/controllers/oidc_provider/sessions_controller.rb
56
57
  - app/controllers/oidc_provider/user_infos_controller.rb
57
58
  - app/models/oidc_provider/access_token.rb
58
59
  - app/models/oidc_provider/application_record.rb
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  requirements: []
96
97
  rubyforge_project:
97
- rubygems_version: 2.5.2
98
+ rubygems_version: 2.7.6.2
98
99
  signing_key:
99
100
  specification_version: 4
100
101
  summary: Uses the openid_connect gem to turn a Rails app into an OpenID Connect provider.