Class: RSAML::SubjectLocality
- Inherits:
-
Object
- Object
- RSAML::SubjectLocality
- Defined in:
- lib/rsaml/subject_locality.rb
Overview
This element is entirely advisory, since both of these fields are quite easily “spoofed,” but may be useful information in some applications.
Instance Attribute Summary collapse
-
#address ⇒ Object
The network address of the system from which the principal identified by the subject was authenticated.
-
#dns_name ⇒ Object
The DNS name of the system from which the principal identified by the subject was authenticated.
Instance Method Summary collapse
-
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the subject locality.
-
#validate ⇒ Object
Raise an error if the subject locality is structurally invalid.
Instance Attribute Details
#address ⇒ Object
The network address of the system from which the principal identified by the subject was authenticated.
7 8 9 |
# File 'lib/rsaml/subject_locality.rb', line 7 def address @address end |
#dns_name ⇒ Object
The DNS name of the system from which the principal identified by the subject was authenticated.
10 11 12 |
# File 'lib/rsaml/subject_locality.rb', line 10 def dns_name @dns_name end |
Instance Method Details
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the subject locality
20 21 22 23 24 25 |
# File 'lib/rsaml/subject_locality.rb', line 20 def to_xml(xml=Builder::XmlMarkup.new) attributes = {} attributes['Address'] = address unless address.nil? attributes['DNSName'] = dns_name unless dns_name.nil? xml.tag!('saml:SubjectLocality', attributes) end |
#validate ⇒ Object
Raise an error if the subject locality is structurally invalid.
13 14 15 16 17 |
# File 'lib/rsaml/subject_locality.rb', line 13 def validate unless address =~ /^(\d{1,3}\.){3}\d{1,3}$/ raise ValidationError, "Invalid address" end end |