Class: AzureACS::IdPFeed

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/azure-acs/idp_feed.rb

Instance Method Summary collapse

Constructor Details

#initialize(acs_namespace, realm, reply_to) ⇒ IdPFeed

Returns a new instance of IdPFeed.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/azure-acs/idp_feed.rb', line 10

def initialize(acs_namespace, realm, reply_to)
  raise ArgumentError.new('Azure ACS namespace cannot be null.')    if acs_namespace.nil? || acs_namespace == ''
  raise ArgumentError.new('Relying party realm cannot be null.')    if realm.nil? || realm == ''
  raise ArgumentError.new('Relying party reply_to cannot be null.') if reply_to.nil? || reply_to == ''

  realm         = url_encode(realm)
  reply_to      = url_encode(reply_to)

  url_base        = "https://#{acs_namespace}.accesscontrol.windows.net:443/v2/metadata/IdentityProviders.js"
  url_params      = "protocol=wsfederation&realm=#{realm}&reply_to=#{reply_to}&context=&request_id=&version=1.0&callback="
  @json_feed_url  = "#{url_base}?#{url_params}"
end

Instance Method Details

#identity_providersObject



27
28
29
# File 'lib/azure-acs/idp_feed.rb', line 27

def identity_providers
  @identity_providers ||= Typhoeus::Request.get(@json_feed_url).body
end

#json_feed_urlObject



23
24
25
# File 'lib/azure-acs/idp_feed.rb', line 23

def json_feed_url
  @json_feed_url
end