Sha256: da3b70918acc6c8c16b851f0f6de0675de897df0bcc8e84c44b13abb96ef51cf
Contents?: true
Size: 859 Bytes
Versions: 3
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true module NulogySSO # A mix-in that is intended to enhance a controller with NulogySSO authentication code. # It is recommended to `include NulogySSO::ControllerHelper` in your ApplicationController. module ControllerHelper extend ActiveSupport::Concern included do # Makes the commonly used @current_user variable available to controllers and views. # This emulates a code pattern popular in Rails apps using Devise. attr_reader :current_user helper_method :current_user end def authenticate_sso_user raw_token = cookies[NulogySSO.auth_cookie_key] return redirect_to nulogy_sso.login_path if raw_token.blank? @current_user = Authenticator.new.authenticated_user(raw_token) return redirect_to nulogy_sso.login_path if @current_user.blank? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nulogy_sso-0.3.3 | lib/nulogy_sso/controller_helper.rb |
nulogy_sso-0.3.1 | lib/nulogy_sso/controller_helper.rb |
nulogy_sso-0.3.0 | lib/nulogy_sso/controller_helper.rb |