Sha256: 9e272698bab5616e4cd05dd5d9d8b802abc27c0e41406deeb77317a6bf79b4d1

Contents?: true

Size: 547 Bytes

Versions: 7

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

Warden::Manager.after_set_user only: :fetch do |record, warden, options|
  if Devise.g5_strict_token_validation
    scope = options[:scope]

    auth_client = G5AuthenticationClient::Client.new(
      allow_password_credentials: 'false',
      access_token: record.g5_access_token
    )

    begin
      auth_client.token_info
    rescue StandardError
      proxy = Devise::Hooks::Proxy.new(warden)
      proxy.sign_out(record)
      record.revoke_g5_credentials!
      throw :warden, scope: scope
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devise_g5_authenticatable-1.0.3 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.2.rc.3 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.2.rc.2 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.2.rc.1 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.1.rc.1 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.0 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-1.0.0.pre.1 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb