Class: Shibkit::MetaMeta::Entity

Inherits:
MetadataItem show all
Defined in:
lib/shibkit/meta_meta/entity.rb

Overview

Class to represent the metadata of a Shibboleth IDP or SP

Constant Summary collapse

ROOT_ELEMENT =

Element and attribute used to select XML for new objects

'EntityDescriptor'
TARGET_ATTR =
'entityID'
REQUIRED_QUACKS =
[:entity_uri]
LINE_START =
"<!--"
LINE_END =
"-->"
HR_CHAR =
"="

Constants inherited from MetadataItem

MetadataItem::NAMESPACES

Instance Attribute Summary collapse

Attributes inherited from MetadataItem

#read_at

Instance Method Summary collapse

Methods inherited from MetadataItem

#filter, #from_xml, #hashed_id, #initialize, #parsed_xml, #purge_xml, #source_xml, #textify_xml, #to_hash, #to_rdf, #to_xml

Constructor Details

This class inherits a constructor from Shibkit::MetaMeta::MetadataItem

Instance Attribute Details

#accountableObject Also known as: accountable?

Is the entity accountable?



57
58
59
# File 'lib/shibkit/meta_meta/entity.rb', line 57

def accountable
  @accountable
end

#admin_contactObject

Contact object containing technical contact details



80
81
82
# File 'lib/shibkit/meta_meta/entity.rb', line 80

def admin_contact
  @admin_contact
end

#athensObject Also known as: athens?

Is the entity using Athens?



63
64
65
# File 'lib/shibkit/meta_meta/entity.rb', line 63

def athens
  @athens
end

#entity_uriObject Also known as: uri, entity_id

The URI of the entity



40
41
42
# File 'lib/shibkit/meta_meta/entity.rb', line 40

def entity_uri
  @entity_uri
end

#hideObject Also known as: hide?

Show in normal WAYFs?



66
67
68
# File 'lib/shibkit/meta_meta/entity.rb', line 66

def hide
  @hide
end

#idpObject

Is the entity an IDP?



83
84
85
# File 'lib/shibkit/meta_meta/entity.rb', line 83

def idp
  @idp
end

#metadata_idObject

The ID of the entity with the metadata file (not globally unique)



54
55
56
# File 'lib/shibkit/meta_meta/entity.rb', line 54

def 
  @metadata_id
end

#organisationObject Also known as: organization

Organisation object for the owner of the entity



71
72
73
# File 'lib/shibkit/meta_meta/entity.rb', line 71

def organisation
  @organisation
end

#other_federation_urisObject Also known as: secondary_federation_uris

The URI of the entity’s parent federation



47
48
49
# File 'lib/shibkit/meta_meta/entity.rb', line 47

def other_federation_uris
  @other_federation_uris
end

#primaryObject

Has this entity object been selected to represent the service?



51
52
53
# File 'lib/shibkit/meta_meta/entity.rb', line 51

def primary
  @primary
end

#primary_federation_uriObject

The URI of the entity’s parent federation



44
45
46
# File 'lib/shibkit/meta_meta/entity.rb', line 44

def primary_federation_uri
  @primary_federation_uri
end

#scopesObject

Returns the value of attribute scopes.



68
69
70
# File 'lib/shibkit/meta_meta/entity.rb', line 68

def scopes
  @scopes
end

#spObject

Is the entity an SP?



86
87
88
# File 'lib/shibkit/meta_meta/entity.rb', line 86

def sp
  @sp
end

#support_contactObject

Contact object containing user support contact details



74
75
76
# File 'lib/shibkit/meta_meta/entity.rb', line 74

def support_contact
  @support_contact
end

#technical_contactObject

Contact object containing technical contact details



77
78
79
# File 'lib/shibkit/meta_meta/entity.rb', line 77

def technical_contact
  @technical_contact
end

#ukfmObject Also known as: ukfm?

Is the entity part of the UK Access Management Federation?



60
61
62
# File 'lib/shibkit/meta_meta/entity.rb', line 60

def ukfm
  @ukfm
end

Instance Method Details

#federation_urisObject

All federations that this entity is a member of



133
134
135
136
137
138
139
140
# File 'lib/shibkit/meta_meta/entity.rb', line 133

def federation_uris

  ## All unique federations, making sure we include primary
  all_fed_uris = [primary_federation_uri].concat other_federation_uris 
  
  return all_fed_uris.uniq

end

#idp?Boolean

Returns:

  • (Boolean)


101
102
103
104
105
# File 'lib/shibkit/meta_meta/entity.rb', line 101

def idp? 
  
  return idp.kind_of?(::Shibkit::MetaMeta::IDP)
  
end

#multi_federated?Boolean

Returns:

  • (Boolean)


126
127
128
129
130
# File 'lib/shibkit/meta_meta/entity.rb', line 126

def multi_federated?
  
  return other_federation_uris.size > 0 ? true : false
  
end

#primary?Boolean

Returns:

  • (Boolean)


120
121
122
123
124
# File 'lib/shibkit/meta_meta/entity.rb', line 120

def primary?
  
  return @primary ? true : false
  
end

#sp?Boolean

Returns:

  • (Boolean)


107
108
109
110
111
# File 'lib/shibkit/meta_meta/entity.rb', line 107

def sp?
  
  return sp.kind_of?(::Shibkit::MetaMeta::SP)
  
end

#tagsObject



157
158
159
160
161
# File 'lib/shibkit/meta_meta/entity.rb', line 157

def tags
  
  return @tags.nil? ? [] : @tags.collect { |t| t.to_sym }
  
end

#tags=(tags) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/shibkit/meta_meta/entity.rb', line 142

def tags=(tags)
  
  @tags ||= []
  
  if Shibkit::MetaMeta.config.auto_tag?
    
    @tags << :idp if idp?
    @tags << :sp  if sp?
    
  end
  
  @tags = @tags.concat([tags].flatten).uniq
 
end

#to_sObject



95
96
97
98
99
# File 'lib/shibkit/meta_meta/entity.rb', line 95

def to_s
  
  return uri
  
end

#urn?Boolean

Returns:

  • (Boolean)


113
114
115
116
117
# File 'lib/shibkit/meta_meta/entity.rb', line 113

def urn?

  return uri.strip.downcase[0..3] == 'urn:'
  
end

#xml_commentObject



163
164
165
166
167
168
169
170
171
# File 'lib/shibkit/meta_meta/entity.rb', line 163

def xml_comment

  out = "\n" + LINE_START + (HR_CHAR * 71) + LINE_END + "\n"
  out << LINE_START + " " + uri + " "  + LINE_END  + "\n"
  out << LINE_START + (HR_CHAR * 71) + LINE_END + "\n\n"
  
  return out
  
end