Class: Scim::Kit::V2::AuthenticationScheme

Inherits:
Object
  • Object
show all
Includes:
Templatable
Defined in:
lib/scim/kit/v2/authentication_scheme.rb

Overview

Represents the available Authentication Schemes.

Constant Summary collapse

DEFAULTS =
{
  httpbasic: {
    description: 'Authentication scheme using the HTTP Basic Standard',
    documentation_uri: 'http://example.com/help/httpBasic.html',
    name: 'HTTP Basic',
    spec_uri: 'http://www.rfc-editor.org/info/rfc2617'
  },
  oauthbearertoken: {
    description:
    'Authentication scheme using the OAuth Bearer Token Standard',
    documentation_uri: 'http://example.com/help/oauth.html',
    name: 'OAuth Bearer Token',
    spec_uri: 'http://www.rfc-editor.org/info/rfc6750'
  }
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Templatable

#as_json, #render, #template_name, #to_h, #to_json

Constructor Details

#initialize {|_self| ... } ⇒ AuthenticationScheme

Returns a new instance of AuthenticationScheme.

Yields:

  • (_self)

Yield Parameters:



31
32
33
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 31

def initialize
  yield self if block_given?
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



25
26
27
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 25

def description
  @description
end

#documentation_uriObject

Returns the value of attribute documentation_uri.



26
27
28
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 26

def documentation_uri
  @documentation_uri
end

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 24

def name
  @name
end

#primaryObject

Returns the value of attribute primary.



29
30
31
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 29

def primary
  @primary
end

#spec_uriObject

Returns the value of attribute spec_uri.



27
28
29
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 27

def spec_uri
  @spec_uri
end

#typeObject

Returns the value of attribute type.



28
29
30
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 28

def type
  @type
end

Class Method Details

.build_for(type, primary: nil) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/scim/kit/v2/authentication_scheme.rb', line 35

def self.build_for(type, primary: nil)
  defaults = DEFAULTS[type.to_sym] || {}
  new do |x|
    x.type = type
    x.primary = primary
    x.description = defaults[:description]
    x.documentation_uri = defaults[:documentation_uri]
    x.name = defaults[:name]
    x.spec_uri = defaults[:spec_uri]
  end
end