Sha256: d306e9bd31034d2527e5af60d135ed701c8892f3e7dc1625671d39d58bd336d8

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

require 'vidibus/user/extensions/helper'

module Vidibus
  module User
    module Extensions
      module Controller
        include Helper

        # Authenticates user from single sign on cookie.
        # Nothing happens if authentication fails.
        def single_sign_on
          return if authenticated?
          warden.authenticate(:single_sign_on)
        end

        # Authenticates user either from single sign on cookie
        # or from email and password params.
        # Calls failure app if authentication fails.
        def authenticate!
          return if authenticated?
          warden.authenticate!
        end
        alias :signin! :authenticate!
        alias :authenticate_user! :authenticate!

        # Performs logout.
        def logout
          return unless authenticated?
          warden.logout
        end
        alias :signout :logout
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vidibus-user-1.0.1 lib/vidibus/user/extensions/controller.rb
vidibus-user-1.0.0 lib/vidibus/user/extensions/controller.rb