Sha256: 2a43479653b61b5fd59c8ea5e11ff528fa2bf43e237f586ac5092d24bbbc23a5
Contents?: true
Size: 887 Bytes
Versions: 8
Compression:
Stored size: 887 Bytes
Contents
require 'omf_common/auth' require 'omf_common/auth/assertion' module OmfCommon::Auth::PDP # Authorise job service (experiment controller) messages class JobService def initialize(opts = {}) @slice = opts[:slice] end 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 # Check current slice with slice specified in assertion 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 end end
Version data entries
8 entries across 8 versions & 1 rubygems