macaroons 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -38
- data/lib/macaroons/raw_macaroon.rb +1 -1
- data/lib/macaroons/verifier.rb +1 -1
- data/lib/macaroons/version.rb +1 -1
- data/macaroons.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12077081feaaf8fc5433f0ad4b46dfbc37d740fc
|
4
|
+
data.tar.gz: eb5b5f1d3028790cebd36e218233cf0d5c4df5c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e419caf63482deeda7157835841f35d5dcdf7a1f7ade2e668a760801ee1615ebb4b140987a7305d5387161a7264448095ab459532cf4b2f26e7b095149d31f
|
7
|
+
data.tar.gz: 3f107670dd47a75d3ec007d7263b4536ee439e80f91c95a0b99a6c84689679bc174e6ffc10037335bd153ffa71301262a5f7fd5f9ce5e2bef2dd6cc49ad8380f
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://coveralls.io/r/localmed/ruby-macaroons?branch=master)
|
4
4
|
[](http://badge.fury.io/rb/macaroons)
|
5
5
|
|
6
|
-
This is a Ruby implementation of
|
6
|
+
This is a Ruby implementation of macaroons. The implementation is stable but should be considered temporary, pending any standardization attempts around macaroons.
|
7
7
|
|
8
8
|
## What is a Macaroon?
|
9
9
|
Macaroons, like cookies, are a form of bearer credential. Unlike opaque tokens, macaroons embed *caveats* that define specific authorization requirements for the *target service*, the service that issued the root macaroon and which is capable of verifying the integrity of macaroons it recieves.
|
@@ -14,54 +14,42 @@ Simple examples are outlined below. For more in-depth examples check out the [fu
|
|
14
14
|
|
15
15
|
## Installing
|
16
16
|
|
17
|
-
|
17
|
+
The macaroon implementation is pure Ruby, but relies on [rbnacl-libsodium](https://github.com/cryptosphere/rbnacl-libsodium) to provide strong cryptographic primitives.
|
18
18
|
|
19
|
-
|
19
|
+
Install with:
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
For other systems, please see the [libsodium documentation](http://doc.libsodium.org/).
|
26
|
-
|
27
|
-
### Macaroons gem
|
28
|
-
|
29
|
-
Once you have libsodium installed, add this line to your application's Gemfile:
|
30
|
-
|
31
|
-
gem 'macaroons'
|
32
|
-
|
33
|
-
And then execute:
|
34
|
-
|
35
|
-
$ bundle
|
36
|
-
|
37
|
-
Or install it manually:
|
38
|
-
|
39
|
-
$ gem install macaroons
|
21
|
+
```
|
22
|
+
gem install macaroons
|
23
|
+
```
|
40
24
|
|
41
|
-
|
25
|
+
And then import it into your Ruby program:
|
42
26
|
|
43
|
-
|
27
|
+
```ruby
|
28
|
+
require 'macaroons'
|
29
|
+
```
|
44
30
|
|
45
31
|
## Quickstart
|
46
32
|
|
47
|
-
|
48
|
-
|
49
|
-
|
33
|
+
```ruby
|
34
|
+
key => Very secret key used to sign the macaroon
|
35
|
+
identifier => An identifier, to remind you which key was used to sign the macaroon
|
36
|
+
location => The location at which the macaroon is created
|
50
37
|
|
51
|
-
|
52
|
-
|
38
|
+
# Construct a Macaroon.
|
39
|
+
m = Macaroon.new(key: key, identifier: identifier, location: 'http://foo.com')
|
53
40
|
|
54
|
-
|
55
|
-
|
41
|
+
# Add first party caveat
|
42
|
+
m.add_first_party_caveat('caveat_1')
|
56
43
|
|
57
|
-
|
58
|
-
|
44
|
+
# List all first party caveats
|
45
|
+
m.first_party_caveats
|
59
46
|
|
60
|
-
|
61
|
-
|
47
|
+
# Add third party caveat
|
48
|
+
m.add_third_party_caveat('caveat_key', 'caveat_id', 'http://foo.com')
|
62
49
|
|
63
|
-
|
64
|
-
|
50
|
+
# List all third party caveats
|
51
|
+
m.third_party_caveats
|
52
|
+
```
|
65
53
|
|
66
54
|
## Example with first- and third-party caveats
|
67
55
|
|
@@ -118,4 +106,4 @@ PyMacaroons, libmacaroons, and Ruby-Macaroons all use the same underlying crypto
|
|
118
106
|
- [Mozilla Macaroon Tech Talk](https://air.mozilla.org/macaroons-cookies-with-contextual-caveats-for-decentralized-authorization-in-the-cloud/)
|
119
107
|
- [libmacaroons](https://github.com/rescrv/libmacaroons)
|
120
108
|
- [PyMacaroons](https://github.com/ecordell/pymacaroons)
|
121
|
-
- [
|
109
|
+
- [rbnacl-libsodium](https://github.com/cryptosphere/rbnacl-libsodium)
|
data/lib/macaroons/verifier.rb
CHANGED
data/lib/macaroons/version.rb
CHANGED
data/macaroons.gemspec
CHANGED
@@ -17,7 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
spec.required_ruby_version = "~> 2.0"
|
19
19
|
spec.add_dependency "multi_json", "~> 1.10.1"
|
20
|
-
spec.add_dependency "rbnacl", "~> 3.
|
20
|
+
spec.add_dependency "rbnacl", "~> 3.2"
|
21
|
+
spec.add_dependency "rbnacl-libsodium", "~> 1.0"
|
21
22
|
|
22
23
|
spec.add_development_dependency "bundler", "> 1.3"
|
23
24
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macaroons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Cordell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -32,14 +32,28 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 3.
|
35
|
+
version: '3.2'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
42
|
+
version: '3.2'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rbnacl-libsodium
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.0'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: bundler
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|