CrossClj

0.1.3 docs

SourceDocs



RECENT

    aws-sig4

    Clojars

    May 18, 2017


    OWNER
    Sharetribe
    Helsinki, Finland
    info@sharetribe.com
    www.sharetribe.com

    Readme

    Index of all namespaces


    The README below is fetched from the published project artifact. Some relative links may be broken.

    aws-sig4

    AWS signature v4 request signing implemented as an clj-http middleware. This is a pure clojure implementation and does not require the AWS SDK. It only provides the middleware and doesn’t do anything else like autodetecting AWS credentials. Providing correct credentials, region and service name is the responsibility of caller.

    This library has seen only limited production use so far. Bugs and problems may exist. Please file issues if you encounter any problems.

    Circle CI

    Installation

    With Leiningen/Boot:

    [org.sharetribe/aws-sig4 "0.1.3"]
    

    Usage

    Require clj-http client and the middleware.

    (require '[aws-sig4.middleware :as aws-sig4]
             '[clj-http.client :as http])
    

    Build an auth middleware instance by passing in AWS parameters.

    (def wrap-aws-auth (aws-sig4/build-wrap-aws-auth {:region "us-east-1"
                                                      :service "es"
                                                      :access-key "AWS_ACCESS_KEY"
                                                      :secret-key "AWS_SECRET_KEY"
                                                      :token "AWS_SESSION_TOKEN" ; optional
                                                      }))
    
    

    Wrap outgoing requests with the middleware instance. Optionally include wrap-aws-date to ensure that all requests have either the required Date header, or if not generate X-Amz-Date header. wrap-aws-date must be defined first in the middleware chain.

    (http/with-additional-middleware
      [wrap-aws-auth aws-sig4/wrap-aws-date]
      (http/get "https://my-es-instance.us-east-1.es.amazonaws.com/_cat/indices"))
    

    That’s it.

    Hint: Consider using temporary security credentials when accessing AWS services.

    License

    Copyright © 2015 Sharetribe Ltd.

    Distributed under The Apache License, Version 2.0