Module: SamlSp

Defined in:
lib/saml-sp.rb,
lib/saml_sp/config.rb

Defined Under Namespace

Modules: Logging Classes: Config, ConfigBlock, ConfigurationError, HttpBasicAuthConfig, IssuerConfig, ResolutionSerivceConfig

Constant Summary collapse

LIBPATH =

:stopdoc:

::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
VERSION =
::File.read(PATH + 'VERSION').strip
BITBUCKET_LOGGER =

Logger that does nothing

Logger.new(nil)
CertificateStore =
Class.new(Hash) do
  include Logging

  def load_certificates(glob)
    logger.info "loading certificates from #{glob}"
    Dir[glob].each do |file|
      begin
        next unless File.file?(file)
        logger.info "reading #{file}"
        cert = OpenSSL::X509::Certificate.new(File.read(file))
        fingerprint = Digest::SHA1.hexdigest(cert.to_der)
        self[fingerprint] = cert
        logger.info "loaded certificate #{cert.inspect} with fingerprint #{fingerprint}"
      rescue StandardError => e
        logger.warn "unable to read X.509 cert from #{file}: #{e.message}"
      end
    end
  end
end.new

Class Method Summary collapse

Class Method Details

.libpath(*args) ⇒ Object

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.



22
23
24
# File 'lib/saml-sp.rb', line 22

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.loggerObject

The logger saml-sp should use



42
43
44
# File 'lib/saml-sp.rb', line 42

def self.logger
  @@logger ||= BITBUCKET_LOGGER
end

.logger=(a_logger) ⇒ Object

Set the logger for saml-sp



47
48
49
# File 'lib/saml-sp.rb', line 47

def self.logger=(a_logger)
  @@logger = a_logger
end

.path(*args) ⇒ Object

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



30
31
32
# File 'lib/saml-sp.rb', line 30

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.versionObject

Returns the version string for the library.



14
15
16
# File 'lib/saml-sp.rb', line 14

def self.version
  VERSION
end