Sha256: 93064cb22440c69e354e60a5c667f154cfe17f1352542747e31cb4b662e26c7a

Contents?: true

Size: 637 Bytes

Versions: 7

Compression:

Stored size: 637 Bytes

Contents

module OpenIDConnect
  module Discovery
    class Principal
      class URI < Principal
        def initialize(identifier)
          uri = normalize(identifier)
          @identifier = uri.to_s
          @host = uri.host
          @port = uri.port unless [80, 443].include?(uri.port)
        end

        private

        def normalize(identifier)
          identifier = "https://#{identifier}" unless identifier.include?('://')
          uri = ::URI.parse(identifier)
          uri.fragment = nil
          uri
        rescue ::URI::Error => e
          raise InvalidIdentifier.new('Invalid URI')
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openid_connect-0.4.1 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.4.0 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.3.7 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.3.6 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.3.5 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.3.4 lib/openid_connect/discovery/principal/uri.rb
openid_connect-0.3.3 lib/openid_connect/discovery/principal/uri.rb