Class: RSAML::Statement::AuthorizationDecisionStatement

Inherits:
Base
  • Object
show all
Defined in:
lib/rsaml/statement/authorization_decision_statement.rb

Overview

A request to allow the assertion subject to access the specified resource has been granted or denied.

Instance Attribute Summary collapse

Attributes inherited from Base

#type

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#decisionObject

The decision rendered by the SAML authority with respect to the specified resource.



23
24
25
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 23

def decision
  @decision
end

#resourceObject

A URI reference identifying the resource to which access authorization is sought. This attribute MAY have the value of the empty URI reference (“”), and the meaning is defined to be “the start of the current document”



20
21
22
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 20

def resource
  @resource
end

Class Method Details

.decision_typesObject

defines the possible values to be reported as the status of an authorization decision statement.

Possible values are:

  • Permit: The specified action is permitted.

  • Deny: The specified action is denied.

  • Indeterminate The SAML authority cannot determine whether the specified action is permitted or denied.



13
14
15
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 13

def self.decision_types
  %w(Permit Deny Indeterminate)
end

Instance Method Details

#actionsObject

The set of actions authorized to be performed on the specified resource.



26
27
28
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 26

def actions
  @actions ||= []
end

#evidenceObject

A set of assertions that the SAML authority relied on in making the decision.



31
32
33
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 31

def evidence
  @evidence ||= []
end

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the authorization decision statement



44
45
46
47
48
49
50
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 44

def to_xml(xml=Builder::XmlMarkup.new)
  attributes = {'Resource' => resource, 'Decision' => decision}
  xml.tag!('saml:AuthzStatement', attributes) {
    actions.each { |action| xml << action.to_xml }
    evidence.each { |e| xml << e.to_xml }
  }
end

#validateObject

Validate the structure

Raises:



36
37
38
39
40
41
# File 'lib/rsaml/statement/authorization_decision_statement.rb', line 36

def validate
  raise ValidationError, "Resource is required" if resource.nil?
  raise ValidationError, "Decision is required" if decision.nil?
  raise ValidationError, "One or more actions must be specified" if actions.empty?
  actions.each { |action| action.validate }
end