p11 plugin work

Implementing: blueprint crypto-implement-hsm-plugin
Many TODOs. This is not a functional plugin and is committed only to
provide visibility into in progress code to other developers

Change-Id: I9f4d4b5a02e94f39fe3153a85f3bdf446ebbbd7b
First attempt to integrate Paul's HSM plugin into Barbican.

Initial mods to change the plugin interface a little bit, and to introduce
a new 'kek_data' table to house key encryption key (KEK) metadata used for
encryption/decryption. This new table will house per-tenant metadata.

Change-Id: I87cd0d4516fa19209be94cacdb79ac4b7eb740df
Implements: blueprint crypto-implement-hsm-plugin
Update P11 plugin to function &  match new plugin contract.

add plugin to entry_points and more cleanup

Change-Id: Ie3c742e3071912f3a22d7460cfb79b1a383efb6f
Implementing: blueprint crypto-implement-hsm-plugin
P11CryptoPlugin is now functional

Still needed: tests (next up)

Change-Id: Ib4ed643178a8e1d4b72c5a588ed8b8b90b0805f4
Implements: blueprint crypto-implement-hsm-plugin
Fix rpm build.

It appears that pyenv is incompatible with rpmbuild since setup.py
is installing files to BUILDROOT/.pyenv/... instead of using paths
that match the system python.  This file should force pyenv to use
the system python for the build.

Change-Id: I1d7deca736cfa1bb0c8ea842113ba4daa33c41fd
Add mock testing for the p11_crypto plugin

* Initial set of unit tests
* Simplify the class by removing test-specific code (now done via patch)

Change-Id: I6b2f81d4f53f133731e0f21539b0e463a266c3fa
Implements: bp/crypto-hsm/unit-tests
Fix order creation bug involving content types

Order creation was trying to look up mime_type, which is no longer
a supported field. MIME type was replaced with payload_content_type
and a secret_payload_content_type column was created. The database
must be flushed or the addition must be migrated for this to work
properly. Also require payload_content_type when creating orders.

Fixes: bug #1208528
Change-Id: I51e93ec63ce2786ddb7a47d528cc70507a7d88dd
Remove padding code and tests in the p11 plugin

Added new tox target "coverage" for generating html coverage.
To run: tox -e coverage

Change-Id: Ia60a0ed0749c27d9f9ee17058b0b027adc485e30
Handle missing cyper_type and algorithm fields

When creating orders, Http 500 responses would occurr when
these fields were missing because islower() would be called
on a None type.

Change-Id: I7d1b8c71a84f1fe9d8d33f1677b358eebc888484
Fixes: bug #1210583
Merge "Remove padding code and tests in the p11 plugin"
Add role based access control (RBAC) to Barbican

Barbican must support RBAC on its various REST methods. This commit adds logic to enforce
RBAC rules defined in a policy.json to the REST resource API methods they need to
protect for unauthorized access. The implementation utilizes the latest oslo policy
module updates to read, parse and enforce RBAC rules.

Change-Id: I94b1709532540947ab3f1c9878c883a1fd167183
Implements: blueprint rbac-add-support
adds lazy app loading to the uwsgi inis.

This change is to resolve the aggressive forking that uwsgi does which
causes it to only have shared sessions across processes in the p11 plugin
and shared db handles as well

Change-Id: I766e50457474844e518c4be6e7dbdd60779064d7
Add new dependencies to rpm.

Change-Id: I898ebff979c595fd462dbc47cbc11a94c75a75d6
Merge "adds lazy app loading to the uwsgi inis."
Added total number of secrets/orders available to response.

The total number of secrets/orders available was not being returned
in paged requests.

Change-Id: I03cf93e6ff946c441a6292eec3ed331de9aab4b2
Implements: blueprint api-resp-add-list-size
Remove uwsgi requirement

Even though we use uWSGI as our WSGI server for barbican,
we don't have any code dependencies.  It is possible to run
barbican usin gnuicorn or any other WSGI server, so we won't
require uWSGI in the pip-requires file.

Change-Id: Ia0f53cfea18a9c6d8087247c5c58114523437d50
Add missing content type and encoding business logic after MIME-type revamp.

The intial work on the MIME-type revamp addressed most of the content-type/encoding
and accept/accept-encoding work flows, but there were some flows that weren't addressed,
including some corner cases such as dealing with all the flavors of 'text/plain' that
clients can send to Barbican. This commit set also reorganizes some of the business
logic sections to enable better unit testing of this somewhat complicated workflow.

Change-Id: I091f33bfe1515a3faa13024536745d8fed68604a
moar dependencies thanks to oslo.

touching the commit msg to try to wake up zuul

Change-Id: Idf2729c47b2d0c98a09b8f29c9b3b17fcdd926f0
Merge "moar dependencies thanks to oslo."
Merge "Add missing content type and encoding business logic after MIME-type revamp."