Class: SSO::Server::Doorkeeper::GrantMarker
- Inherits:
-
Object
- Object
- SSO::Server::Doorkeeper::GrantMarker
show all
- Includes:
- Logging
- Defined in:
- lib/sso/server/doorkeeper/grant_marker.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Logging
#debug, #error, #fatal, #info, #logger, #progname, #warn
Constructor Details
Returns a new instance of GrantMarker.
10
11
12
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 10
def initialize(app)
@app = app
end
|
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
7
8
9
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 7
def response
@response
end
|
Instance Method Details
#call(env) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 14
def call(env)
@env = env
@response = @app.call @env
return response unless outgoing_grant_token
if passport_id
debug { %(Detected outgoing "Authorization Grant Token" #{outgoing_grant_token.inspect} of the "Authorization Code Grant" flow.) }
debug { %(Augmenting Passport #{passport_id.inspect} with this outgoing Grant Token...) }
registration = ::SSO::Server::Passports.register_authorization_grant passport_id: passport_id, token: outgoing_grant_token
if registration.failure?
warn { 'The passport could not be augmented. Destroying warden session.' }
warden.logout
end
end
response
end
|
#code ⇒ Object
38
39
40
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 38
def code
response.first
end
|
50
51
52
53
54
55
56
57
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 50
def
unless code == 302
return
end
response.second['Location']
end
|
#outgoing_grant_token ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 73
def outgoing_grant_token
unless redirect_uri_params && redirect_uri_params['code']
return
end
redirect_uri_params['code']
end
|
#passport_id ⇒ Object
46
47
48
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 46
def passport_id
session['passport_id']
end
|
#redirect_uri ⇒ Object
59
60
61
62
63
64
65
66
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 59
def redirect_uri
unless
return
end
::URI.parse
end
|
#redirect_uri_params ⇒ Object
68
69
70
71
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 68
def redirect_uri_params
return unless redirect_uri
::Rack::Utils.parse_query redirect_uri.query
end
|
#request ⇒ Object
34
35
36
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 34
def request
::ActionDispatch::Request.new @env
end
|
#warden ⇒ Object
42
43
44
|
# File 'lib/sso/server/doorkeeper/grant_marker.rb', line 42
def warden
request.env['warden']
end
|