Giter Site home page Giter Site logo

lowecg / clj-aws-sign Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joseferben/clj-aws-sign

0.0 0.0 0.0 41 KB

A clojure implementation of the AWS Signature Version 4 algorithm provided as easy-to-use library.

License: Eclipse Public License 1.0

Clojure 92.72% Dockerfile 7.28%

clj-aws-sign's Introduction

clj-aws-sign

A clojure library that implements the Signature Version 4 Signing Process. It is inspired by s3-beam and this blog post. This library can be used to sign requests, for instance by implementing a signing service.

This library passes the Signature Version 4 Test Suite. Badge

Clojars Project

[clj-aws-sign "0.1.1"]

Usage

Simple example:

(clj-aws-sign.core/authorize 
    {:method "GET" :uri "/foo/bar" 
     :query [["name" "asimov"]] :date "20150830T123600Z" 
     :headers {"host" "somehost"}
     :service "s3" :region "ca-central-1"
     :access-key "myaccesskey" :secret-key "mysecretkey"})

Output:

AWS4-HMAC-SHA256 Credential=myaccesskey/20150830/ca-central-1/s3/aws4_request, SignedHeaders=host, Signature=e771437ef1c615047cffbf99a20bd20c6e4f361b2600e12534b563065e900bc7

You can use this string as Authorization header.

The following options are necessary:

  • :method - The method of the request: GET, POST, PUT

  • :uri - The uri of the request

  • date - Date following ISO 8601 format YYYYMMDD'T'HHMMSS'Z', for instance "20150830T123600Z"

  • :access-key - AWS access key

  • :secret-key- AWS secret key

  • :service - AWS service, for instance "s3"

  • :region - AWS region, for instance "eu-west-1"

The following options are optional:

  • :query - Query parameters of the request as vector tuples in a vector: [["name" "Walter"] ["surname" "White"]]

  • :headers - Headers of the request you want to sign as map: {"Host" "s3-eu-west-1" "x-amz-content-sha256" "UNSIGNED-PAYLOAD"}, if you provide a "x-amz-date" header :date will be overriden

  • :payload - The request body

Building

Using lein

lein test
lein jar

Using Dockergile

docker build \
    --build-arg DOCKER_URL=docker.io \
	--build-arg DOCKER_ORG='alphaprosoft' \
	--build-arg ARTIFACT_ORG='com.github.clj-aws-sign' \
	--build-arg BUILD_ID=0 \
	-f Dockerfile .

License

Copyright © 2017 Josef Erben

Distributed under the Eclipse Public License, the same as Clojure.

clj-aws-sign's People

Contributors

joseferben avatar robertpofuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.