-
-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec20f55
commit 5c8fd1b
Showing
40 changed files
with
3,879 additions
and
3,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,57 @@ | ||
# frozen_string_literal: true | ||
|
||
module OneLogin | ||
module RubySaml | ||
module RubySaml | ||
|
||
# SAML2 AttributeService. Auxiliary class to build the AttributeService of the SP Metadata | ||
# SAML2 AttributeService. Auxiliary class to build the AttributeService of the SP Metadata | ||
# | ||
class AttributeService | ||
attr_reader :attributes | ||
attr_reader :name | ||
attr_reader :index | ||
|
||
# Initializes the AttributeService, set the index value as 1 and an empty array as attributes | ||
# | ||
def initialize | ||
@index = "1" | ||
@attributes = [] | ||
end | ||
|
||
def configure(&block) | ||
instance_eval(&block) | ||
end | ||
|
||
# @return [Boolean] True if the AttributeService object has been initialized and set with the required values | ||
# (has attributes and a name) | ||
def configured? | ||
!@attributes.empty? && !@name.nil? | ||
end | ||
|
||
# Set a name to the service | ||
# @param name [String] The service name | ||
# | ||
def service_name(name) | ||
@name = name | ||
end | ||
|
||
# Set an index to the service | ||
# @param index [Integer] An index | ||
# | ||
def service_index(index) | ||
@index = index | ||
end | ||
|
||
# Add an AttributeService | ||
# @param options [Hash] AttributeService option values | ||
# add_attribute( | ||
# :name => "Name", | ||
# :name_format => "Name Format", | ||
# :index => 1, | ||
# :friendly_name => "Friendly Name", | ||
# :attribute_value => "Attribute Value" | ||
# ) | ||
# | ||
class AttributeService | ||
attr_reader :attributes | ||
attr_reader :name | ||
attr_reader :index | ||
|
||
# Initializes the AttributeService, set the index value as 1 and an empty array as attributes | ||
# | ||
def initialize | ||
@index = "1" | ||
@attributes = [] | ||
end | ||
|
||
def configure(&block) | ||
instance_eval(&block) | ||
end | ||
|
||
# @return [Boolean] True if the AttributeService object has been initialized and set with the required values | ||
# (has attributes and a name) | ||
def configured? | ||
!@attributes.empty? && !@name.nil? | ||
end | ||
|
||
# Set a name to the service | ||
# @param name [String] The service name | ||
# | ||
def service_name(name) | ||
@name = name | ||
end | ||
|
||
# Set an index to the service | ||
# @param index [Integer] An index | ||
# | ||
def service_index(index) | ||
@index = index | ||
end | ||
|
||
# Add an AttributeService | ||
# @param options [Hash] AttributeService option values | ||
# add_attribute( | ||
# :name => "Name", | ||
# :name_format => "Name Format", | ||
# :index => 1, | ||
# :friendly_name => "Friendly Name", | ||
# :attribute_value => "Attribute Value" | ||
# ) | ||
# | ||
def add_attribute(options={}) | ||
attributes << options | ||
end | ||
def add_attribute(options={}) | ||
attributes << options | ||
end | ||
end | ||
end |
Oops, something went wrong.