Sha256: 9c4b6076b118a8c46132141c054937a54be0fd152aa2fc1ba98abada855a4f25

Contents?: true

Size: 559 Bytes

Versions: 8

Compression:

Stored size: 559 Bytes

Contents

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 => error
      proxy = Devise::Hooks::Proxy.new(warden)
      proxy.sign_out(record)
      record.revoke_g5_credentials!
      throw :warden, scope: scope
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_g5_authenticatable-0.3.0 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.5.beta lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.4 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.4.beta lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.3 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.2 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.1 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb
devise_g5_authenticatable-0.2.0 lib/devise_g5_authenticatable/hooks/g5_authenticatable.rb