Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Add token generation using go macaroon #437

Merged
merged 5 commits into from
May 22, 2018

Conversation

APwhitehat
Copy link
Contributor

@APwhitehat APwhitehat commented Apr 15, 2018

  • Add Go macaroon library.
  • Add macaroon generation and serialization, for login token.

Only the second commit is of interest.
1st commit is just the result of gb vendor fetch -tag v2.0.0 github.com/go-macaroon/macaroon.

This was earlier part of #429

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
@APwhitehat APwhitehat force-pushed the add_macaroon_lib_token branch from 32e9ea7 to bb5863e Compare May 22, 2018 06:34
@APwhitehat
Copy link
Contributor Author

Warning: deSerializeMacaroon is deadcode. But will be required for token handler.
My rationale for including it in this PR is to keep its test in one place, with serializeMacaroon.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks pretty good to me! Just some minor spelling things but that's all.

const (
macaroonVersion = macaroon.V2
defaultDuration = 2 * 60
// UserPrefix is common prefix for every user_id caveat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is common prefix" -> "is a common prefix"

defaultDuration = 2 * 60
// UserPrefix is common prefix for every user_id caveat
UserPrefix = "user_id = "
// TimePrefix is common prefix for every expiry caveat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is common prefix" -> "is a common prefix"

}

// serializeMacaroon takes a macaroon to be serialized.
// returns it's base64 encoded string, URL safe, which can be sent via web, email, etc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"returns it's" -> "returns its"

@anoadragon453
Copy link
Member

Merging with dead code.

@anoadragon453 anoadragon453 merged commit afeab7b into matrix-org:master May 22, 2018
anoadragon453 added a commit that referenced this pull request May 22, 2018
anoadragon453 added a commit that referenced this pull request May 22, 2018
This reverts commit afeab7b.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
@APwhitehat APwhitehat deleted the add_macaroon_lib_token branch July 9, 2018 08:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants