Class: SAML2::Conditions::AudienceRestriction

Inherits:
Condition
  • Object
show all
Defined in:
lib/saml2/conditions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audience) ⇒ AudienceRestriction

Returns a new instance of AudienceRestriction.



49
50
51
# File 'lib/saml2/conditions.rb', line 49

def initialize(audience)
  @audience = audience
end

Instance Attribute Details

#audienceObject

Returns the value of attribute audience.



47
48
49
# File 'lib/saml2/conditions.rb', line 47

def audience
  @audience
end

Instance Method Details

#build(builder) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/saml2/conditions.rb', line 57

def build(builder)
  builder['saml'].AudienceRestriction do |builder|
    Array.wrap(audience).each do |single_audience|
      builder['saml'].Audience(single_audience)
    end
  end
end

#valid?(options) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/saml2/conditions.rb', line 53

def valid?(options)
  Array.wrap(audience).include?(options[:audience]) ? :valid : :invalid
end