# MDQT - A Metadata Query Tool [![Gem Version](https://badge.fury.io/rb/mdqt.svg)](https://badge.fury.io/rb/mdqt) [![Maintainability](https://api.codeclimate.com/v1/badges/111c46aaebfe25e4a4a9/maintainability)](https://codeclimate.com/github/Digital-Identity-Labs/mdqt/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/111c46aaebfe25e4a4a9/test_coverage)](https://codeclimate.com/github/Digital-Identity-Labs/mdqt/test_coverage) [![Build Status](https://travis-ci.org/Digital-Identity-Labs/mdqt.svg?branch=master)](https://travis-ci.org/Digital-Identity-Labs/mdqt) MDQT is small library and commandline tool to query MDQ services for SAML metadata. You could do this with `curl` but it's a little more convenient to use `mdqt` instead. At present `mdqt` does *not* verify signed metadata, so an extra step is required to use it securely. MDQ currently supports: - Downloading single entities, lists or aggregates - Caching entity metadata on disk - Gzip compression ## MDQ? MDQ is a simple HTTP-based standard for looking up individual SAML entity metadata. Rather than regularly downloading large metadata aggregates containing thousands of entity descriptions, an IdP or SP can download the metadata for an individual entity whenever it is needed. The UK Access Management Federation has a [useful page explaining MDQ](https://www.ukfederation.org.uk/content/Documents/MDQ) ## Installation To add MDQT to a project, include this line in your application's Gemfile ```ruby gem 'mdqt' ``` and then execute: $ bundle To install system-wide on your default Ruby, use $ sudo gem install mdqt If using a per-user Ruby such via `rbenv` or similar, you'll just need $ gem install mdqt MDQT should work with Ruby 2.1.0 or later. ## Commandline Usage as an MDQ client You can see a list of commandline options by typing: $ mdqt --help To see more information about a command, use the `--help` option after the command: $ mdqt get --help Specifying the MDQ service with a commandline option: $ mdqt get --service https://mdq.example.com/mdq http://entity.ac.uk/shibboleth It's more convenient to set an environment variable to specify a default MDQ service. Set `MDQT_SERVICE` or `MDQ_BASE_URL` to the base URL of your MDQ service. Downloading entity metadata to STDOUT: $ mdqt get https://test-idp.ukfederation.org.uk/idp/shibboleth Using the sha1 hashed version of entity IDs requires quotes or escaping: $ mdqt get "{sha1}52e2065fc0d53744e8d4ee2c2f30696ebfc5def9" $ mdqt get \{sha1\}52e2065fc0d53744e8d4ee2c2f30696ebfc5def9 Requesting all metadata from an MDQ endpoint is done by specifying `--all`: $ mdqt get --all Caching can be enabled using `--cache`. At the moment the `mdqt` executable only supports caching to disk. It will create a cache directory in your temporary directory. $ mdqt get --cache --service https://mdq.example.com/mdq http://entity.ac.uk/shibboleth If you don't specify an MDQ service with `--service' or `MDQT_SERVICE` then `mdqt` *might* be able to guess your local NREN's MDQ service. Do not do this in production. ## Library Usage Please don't! This gem is very early in development and the API is not stable. Later releases of this gem will provide a simple library to use in other Ruby applications. ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/Digital-Identity-Labs/mdqt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).