Class: Sso::Pingback
- Inherits:
-
Object
show all
- Includes:
- Logging
- Defined in:
- app/models/sso/pingback.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Logging
#debug, #error, #fatal, #info, #warn
Constructor Details
#initialize(user, warden, options) ⇒ Pingback
Returns a new instance of Pingback.
15
16
17
|
# File 'app/models/sso/pingback.rb', line 15
def initialize(user, warden, options)
@user, @warden, @options = user, warden, options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5
6
7
|
# File 'app/models/sso/pingback.rb', line 5
def options
@options
end
|
#user ⇒ Object
Returns the value of attribute user.
5
6
7
|
# File 'app/models/sso/pingback.rb', line 5
def user
@user
end
|
#warden ⇒ Object
Returns the value of attribute warden.
5
6
7
|
# File 'app/models/sso/pingback.rb', line 5
def warden
@warden
end
|
Class Method Details
.to_proc ⇒ Object
9
10
11
12
13
|
# File 'app/models/sso/pingback.rb', line 9
def self.to_proc
proc do |user, warden, options|
new(user, warden, options).call
end
end
|
Instance Method Details
#call ⇒ Object
19
20
21
|
# File 'app/models/sso/pingback.rb', line 19
def call
execute if logged_in?
end
|
#execute ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/models/sso/pingback.rb', line 23
def execute
return false unless sso_session = ::Sso::Session.find_by_id(session["sso_session_id"])
::Doorkeeper::Application.all.each do |app|
debug { "Pingback Sso::Pingback for #{app.inspect}" }
unless app.pingback_uri.blank?
data = ::Sso::SessionSerializer.new(sso_session)
debug { data.inspect }
notifier = ::Sso::Notifier.new(app.pingback_uri, app.uid, app.secret, data)
notifier.execute
end
end
end
|
#logged_in? ⇒ Boolean
44
45
46
|
# File 'app/models/sso/pingback.rb', line 44
def logged_in?
warden.authenticated?(scope) && session && user
end
|
#scope ⇒ Object
36
37
38
|
# File 'app/models/sso/pingback.rb', line 36
def scope
scope = options[:scope]
end
|
#session ⇒ Object
40
41
42
|
# File 'app/models/sso/pingback.rb', line 40
def session
warden.session(scope)
end
|