11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/omf_common/auth/pdp/job_service.rb', line 11
def authorize(msg, &block)
if msg.assert.nil?
warn 'No assertion found, drop it'
return nil
end
assert = OmfCommon::Auth::Assertion.new(msg.assert)
unless assert.verify
return nil
else
info "#{msg.src.address} tells >> #{assert.iss} says >> #{assert.content}"
end
if assert.content =~ /(.+) can use slice (.+)/ &&
$1 == msg.src.id.to_s &&
$2 == @slice.to_s
block.call(msg) if block
return msg
else
warn 'Drop it'
return nil
end
end
|