Class: Softwear::Auth::Controller
- Inherits:
-
Softwear::ApplicationController
- Object
- ActionController::Base
- Softwear::ApplicationController
- Softwear::Auth::Controller
- Defined in:
- lib/softwear/auth/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#clear_query_cache ⇒ Object
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.
-
#set_session_token ⇒ Object
Comes from an img tag on softwear-hub to let an authorized app know that a user has signed in.
Class Method Details
.abstract_class? ⇒ Boolean
6 7 8 |
# File 'lib/softwear/auth/controller.rb', line 6 def self.abstract_class? true end |
Instance Method Details
#clear_query_cache ⇒ Object
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.
34 35 36 37 38 39 40 |
# 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 ⇒ Object
Comes from an img tag on softwear-hub to let an authorized app know that a user has signed in.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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 decipher.iv = Figaro.env.token_cipher_iv session[:user_token] = decipher.update(Base64.urlsafe_decode64(encrypted_token)) + decipher.final render inline: 'Done' end |