diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e1b9a6bdd8a08754b38231799acefcb2ab..691126f7f7641fb7a32afda1c962cc528f773ce1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,20 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + def dspace_service + @dspace_service ||= DspaceService.new( + DspaceService.create_dspace_client( + 'https://portalmecdev.c3sl.ufpr.br:8443/rest', + get_remote_authenticable_token + ) + ) + end + + private + + def get_remote_authenticable_token + session[:dspace_auth_token] || nil + end + end