Module: Saml::Kit::Bindings

Defined in:
lib/saml/kit/bindings.rb,
lib/saml/kit/bindings/binding.rb,
lib/saml/kit/bindings/http_post.rb,
lib/saml/kit/bindings/url_builder.rb,
lib/saml/kit/bindings/http_redirect.rb

Overview

This module is responsible for exposing the different SAML bindings that are supported by this gem.

Defined Under Namespace

Classes: Binding, HttpPost, HttpRedirect, UrlBuilder

Constant Summary collapse

BINDINGS_2_0 =
'urn:oasis:names:tc:SAML:2.0:bindings'
HTTP_ARTIFACT =
"#{BINDINGS_2_0}:HTTP-Artifact"
HTTP_POST =
"#{BINDINGS_2_0}:HTTP-POST"
HTTP_REDIRECT =
"#{BINDINGS_2_0}:HTTP-Redirect"
ALL =
{
  http_post: HTTP_POST,
  http_redirect: HTTP_REDIRECT,
  http_artifact: HTTP_ARTIFACT,
}.freeze

Class Method Summary collapse

Class Method Details

.binding_for(binding) ⇒ Object



24
25
26
# File 'lib/saml/kit/bindings.rb', line 24

def self.binding_for(binding)
  ALL[binding]
end

.create_for(binding, location) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/saml/kit/bindings.rb', line 39

def self.create_for(binding, location)
  case binding
  when HTTP_REDIRECT
    HttpRedirect.new(location: location)
  when HTTP_POST
    HttpPost.new(location: location)
  else
    Binding.new(binding: binding, location: location)
  end
end

.to_symbol(binding) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/saml/kit/bindings.rb', line 28

def self.to_symbol(binding)
  case binding
  when HTTP_REDIRECT
    :http_redirect
  when HTTP_POST
    :http_post
  else
    binding
  end
end