class Softwear::Auth::Controller

Public Class Methods

abstract_class?() click to toggle source
# File lib/softwear/auth/controller.rb, line 6
def self.abstract_class?
  true
end

Public Instance Methods

clear_query_cache() click to toggle source

Comes from an img tag on softwear-hub when there has been a change to user attributes or roles and the cache should be cleared.

# File lib/softwear/auth/controller.rb, line 34
def clear_query_cache
  Softwear::Auth::Model.descendants.each do |user|
    user.query_cache.clear
  end

  render inline: 'Done'
end
set_session_token() click to toggle source

Comes from an img tag on softwear-hub to let an authorized app know that a user has signed in.

# File lib/softwear/auth/controller.rb, line 14
def set_session_token
  encrypted_token = params[:token]
  redirect_to Figaro.env.softwear_hub_url and return if encrypted_token.blank?

  Rails.logger.info "RECEIVED ENCRYPTED TOKEN: #{encrypted_token}"

  decipher = OpenSSL::Cipher::AES.new(256, :CBC)
  decipher.decrypt
  decipher.key = Figaro.env.token_cipher_key.first(32)
  decipher.iv  = Figaro.env.token_cipher_iv.first(16)

  session[:user_token] = decipher.update(Base64.urlsafe_decode64(encrypted_token)) + decipher.final

  render inline: 'Done'
end