Class: Saml::Artifact

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/saml/artifact.rb

Constant Summary collapse

TYPE_CODE =
"\000\004"
END_POINT_INDEX =
"\000\000"

Instance Method Summary collapse

Constructor Details

#initialize(artifact = nil) ⇒ Artifact

Returns a new instance of Artifact.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/saml/artifact.rb', line 13

def initialize(artifact = nil)
  if artifact
    @artifact = artifact
  else
    source_id       = ::Digest::SHA1.digest(Saml.current_provider.entity_id.to_s)
    message_handle  = ::SecureRandom.random_bytes(20)
    @type_code      = TYPE_CODE
    @endpoint_index = END_POINT_INDEX
    @artifact   = Saml::Encoding.encode_64 [@type_code, @endpoint_index, source_id, message_handle].join
  end
end

Instance Method Details

#endpoint_indexObject



29
30
31
# File 'lib/saml/artifact.rb', line 29

def endpoint_index
  decoded_value[2, 2]
end

#message_handleObject



37
38
39
# File 'lib/saml/artifact.rb', line 37

def message_handle
  decoded_value[24, 20]
end

#source_idObject



33
34
35
# File 'lib/saml/artifact.rb', line 33

def source_id
  decoded_value[4, 20]
end

#to_sObject



41
42
43
# File 'lib/saml/artifact.rb', line 41

def to_s
  artifact
end

#type_codeObject



25
26
27
# File 'lib/saml/artifact.rb', line 25

def type_code
  decoded_value[0, 2]
end