Class: RSAML::Protocol::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/rsaml/protocol/message.rb

Overview

Base class for messages. This class should not be instantiated directly, rather the Request and Response classes should be used.

Direct Known Subclasses

Request, Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessage

Initialize the message instance



36
37
38
39
40
# File 'lib/rsaml/protocol/message.rb', line 36

def initialize
  @id = UUID.new.generate
  @version = "2.0"
  @issue_instant = Time.now.utc
end

Instance Attribute Details

Indicates whether or not (and under what conditions) consent has been obtained from a principal in the sending of this message. If no Consent value is provided, the identifier

urn:oasis:names:tc:SAML:2.0:consent:unspecified is in effect.



27
28
29
# File 'lib/rsaml/protocol/message.rb', line 27

def consent
  @consent
end

#destinationObject

A URI reference indicating the address to which this message has been sent. This is useful to prevent malicious forwarding of messages to unintended recipients, a protection that is required by some protocol bindings. If it is present, the actual recipient MUST check that the URI reference identifies the location at which the message was sent or received. If it does not, the response MUST be discarded. Some protocol bindings may require the use of this attribute.



22
23
24
# File 'lib/rsaml/protocol/message.rb', line 22

def destination
  @destination
end

#idObject

An identifier for the message. It is of type xs:ID and MUST follow the requirements specified in Section 1.3.4 of the SAML 2.0 specification for identifier uniqueness.



9
10
11
# File 'lib/rsaml/protocol/message.rb', line 9

def id
  @id
end

#issue_instantObject

The time instant of issue of the message. The time value must be encoded in UTC.



15
16
17
# File 'lib/rsaml/protocol/message.rb', line 15

def issue_instant
  @issue_instant
end

#issuerObject

Identifies the entity that generated the message.



30
31
32
# File 'lib/rsaml/protocol/message.rb', line 30

def issuer
  @issuer
end

#signatureObject

An XML Signature that authenticates the requestor or responder and provides message integrity.



33
34
35
# File 'lib/rsaml/protocol/message.rb', line 33

def signature
  @signature
end

#versionObject

The version of this message. The identifier for the version of SAML defined in this specification is “2.0”.



12
13
14
# File 'lib/rsaml/protocol/message.rb', line 12

def version
  @version
end

Instance Method Details

#extensionsObject

This extension point contains optional protocol message extension elements that are agreed on between the communicating parties.



44
45
46
# File 'lib/rsaml/protocol/message.rb', line 44

def extensions
  @extionsion ||= []
end

#validateObject

Validate the request structure

Raises:



49
50
51
52
53
54
# File 'lib/rsaml/protocol/message.rb', line 49

def validate
  raise ValidationError, "ID is required" if id.nil?
  raise ValidationError, "Version is required" if version.nil?
  raise ValidationError, "Issue instant is required" if issue_instant.nil?
  raise ValidationError, "Issue instant must be UTC" unless issue_instant.utc?
end