module Samlr::Command
Helper module for command line options
Constants
- COMMANDS
Public Class Methods
execute(options, path = nil)
click to toggle source
# File lib/samlr/command.rb, line 9 def self.execute(options, path = nil) Samlr.logger.level = Logger::DEBUG if options[:verbose] Samlr.validation_mode = :log if options[:skip_validation] if options[:verify] if File.directory?(path) result = [] Dir.glob("#{path}/*.*").each do |file| result << execute_verify(file, options) end result.join("\n") else execute_verify(path, options) end elsif options[:schema_validate] Samlr::Tools.validate(:path => path) elsif options[:print] Samlr::Response.parse(File.read(path)).to_xml end end
Private Class Methods
execute_verify(path, options)
click to toggle source
# File lib/samlr/command.rb, line 32 def self.execute_verify(path, options) begin Samlr::Response.new(File.read(path), options).verify! "Verification passed for #{path}" rescue Samlr::SamlrError => e "Verification failed for #{path}: #{e.message}" end end