/http-did-auth-proxy

DID Auth HTTP proxy.

Primary LanguageJavaApache License 2.0Apache-2.0

License Lifecycle:Dormant

DID Auth HTTP Proxy

This is a DID Auth HTTP proxy that uses HTTP Signatures based on Decentralized Identifiers for authenticated HTTP requests.

Technology Stack Used

Third-Party Products/Libraries used and the License they are covert by

Project Status

Under development for a BCDevExchange opportunity.

All repositories related to this project:

Documentation

Architecture: architecture.md

Signing and verifying mode: modes.md

Deployment (Local Development)

Build with Docker:

docker build -f ./Dockerfile -t http_did_auth_proxy .	

Run in signing mode

Required parameters:

  • signing=1 - Enables the DID Auth proxy in signing mode.
  • signingDid=did:v1:test:nym:rZdPg5VF6SqrVuEYEHAuDaeikkA2D8QBLRJQRnhz3pI - The DID to use for signing HTTP requests.
  • signingKey=... - The DID's signing key to use for singing HTTP requests.
  • signingType=rsa - The DID's signing key type, must be one of 'rsa', 'ed25519', 'secp256k1'.

Example #1:

docker run -ti -p 9091:8080 -e signing=1 -e signingDid=did:v1:test:nym:rZdPg5VF6SqrVuEYEHAuDaeikkA2D8QBLRJQRnhz3pI -e "signingKey=-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDcNJDewMzDRRPh\nGnwmpjOoo9DqjZRBDAcADp5bcAlLYepc53lksGi7TlXiHmPpFRWLGCQAkg8FzzVl\n5mMMHcdnVkR4TNlfLEPwFYNyBP9Fl3R6tyHfiqMyQZI2ExmUYUfQnENVo4j9Pu28\ngOhcYNQi/B7xaCm07mTqCpqGs5/HUHbKehP6XwkxV+JvlhouyPbYpJXWgAyFXAtn\nh/hu9lktgwiW0fLYMem3T9ZvX7vmY5q3r/oN/z6DS008FmyeA9CZNwxgvL69pRTi\na/0enQwfvO4PZeXAji/FcFkdBfIaKHWh+clfThWpD6aWhkKyLy55tx7NBm+LUNYe\nDkXDylnzAgMBAAECggEBAJfKxHJIhN22KFXrY9lgiAufoMuOfLu6BrlLWm29dSq5\nfEw+Y7e8wv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8Q7W7ZYKjwE5DQNyzw2yD1WQL1mb+MEAali6P\nFMUmurGezZcIJSVDlt1dLzze2fpQ1CePdDwTGYDCalvedrfYgWyLiGzAaiwjajLB\nKeo2UiboLAs92t1KatoJiWY=\n-----END PRIVATE KEY-----" -e signingKeyType=rsa http_did_auth_proxy

Example #2:

docker run -ti -p 9091:8080 -e signing=1 -e signingDid=did:sov:DavnUKB3kjn7VmVZXzEDL7 -e signingKey=2SqJFQVkR4HvqoLYwfpw6cZwxfpzdjtXj1KUCvZ7jVWEMfQnKKmgocQ4SRqXcxPy7e4irSd4vmGJoVEtQLeJDtnF -e signingKeyType=ed25519 http_did_auth_proxy

Run in verifying mode

Required parameters:

  • signing=0 - Enables the DID Auth proxy in verifying mode.
  • resolverUri=https://uniresolver.io/1.0/identifiers/ - The URL of the Universal Resolved used to resolve DIDs.
  • targetHost=httpbin.org:80 - The target host and port to forward requests to.
  • whitelist=did:sov:DavnUKB3kjn7VmVZXzEDL7,did:v1:test:nym:rZdPg5VF6SqrVuEYEHAuDaeikkA2D8QBLRJQRnhz3pI - Optional whitelist of DIDs from which to accept signed requests.

Example:

docker run -ti -p 9092:8080 -e signing=0 -e resolverUri=https://uniresolver.io/1.0/identifiers/ -e targetHost=httpbin.org:80 http_did_auth_proxy

How to test

You can use a curl command that will make a call to the proxy in verifying mode, passed through the proxy in signing mode:

curl http://192.168.200.1:9092/get --proxy 192.168.200.1:9091

(Replace 192.168.200.1 with your actual IP address that is reachable by Docker containers)

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an issue.

How to Contribute

If you would like to contribute, please see our CONTRIBUTING guidelines.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License

Copyright 2018 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.