Skip to content

Commit

Permalink
vendor: support dep (#606)
Browse files Browse the repository at this point in the history
* fix go-jose

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>

* add Gopkg.toml

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>

* add tests for dep

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>

* fix glide build

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>
  • Loading branch information
joshuarubin authored and arekkas committed Oct 11, 2017
1 parent b1169ad commit f2f8f7a
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 96 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ before_install:
- sudo apt-get install curl

install:
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/Masterminds/glide github.com/mitchellh/gox
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/Masterminds/glide github.com/mitchellh/gox github.com/golang/dep/cmd/dep
- git clone https://github.com/docker-library/official-images.git ~/official-images
- glide install
- go install github.com/ory/hydra
- glide update
- go install github.com/ory/hydra
- dep ensure
- go install github.com/ory/hydra

script:
- touch ./coverage.tmp
Expand Down
71 changes: 71 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[[constraint]]
name = "github.com/dgrijalva/jwt-go"
version = "3.0.0"

[[constraint]]
name = "github.com/go-sql-driver/mysql"
version = "1.3.0"

[[constraint]]
name = "github.com/gorilla/context"
version = "1.1.0"

[[constraint]]
name = "github.com/gorilla/sessions"
version = "1.1.0"

[[constraint]]
name = "github.com/imdario/mergo"
version = "0.2.2"

[[constraint]]
name = "github.com/julienschmidt/httprouter"
version = "1.1.0"

[[constraint]]
name = "github.com/oleiade/reflections"
version = "1.0.0"

[[constraint]]
name = "github.com/ory/fosite"
version = "0.10.0"

[[constraint]]
name = "github.com/ory/graceful"
version = "0.1.0"

[[constraint]]
name = "github.com/ory/herodot"
version = "0.1.1"

[[constraint]]
name = "github.com/ory/ladon"
version = "0.8.2"

[[constraint]]
name = "github.com/pborman/uuid"
version = "1.0.0"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"

[[constraint]]
name = "github.com/pkg/profile"
version = "1.2.1"

[[constraint]]
name = "github.com/square/go-jose"
version = "2.1.3"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.1.4"

[[constraint]]
name = "github.com/toqueteos/webbrowser"
version = "1.0.0"

[[constraint]]
name = "github.com/urfave/negroni"
version = "0.2.0"
4 changes: 2 additions & 2 deletions cmd/server/helper_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func getOrCreateTLSCertificate(cmd *cobra.Command, c *config.Config) tls.Certifi

private := jwk.First(keys.Key("private"))
private.Certificates = []*x509.Certificate{cert}
keys = &jose.JsonWebKeySet{
Keys: []jose.JsonWebKey{
keys = &jose.JSONWebKeySet{
Keys: []jose.JSONWebKey{
*private,
*jwk.First(keys.Key("public")),
},
Expand Down
54 changes: 28 additions & 26 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import:
- package: github.com/sirupsen/logrus
version: master
- package: github.com/Sirupsen/logrus
version: master
repo: https://github.com/sirupsen/logrus.git
vcs: git
version: master
- package: github.com/dgrijalva/jwt-go
version: 3.0.0
- package: github.com/go-sql-driver/mysql
Expand Down Expand Up @@ -52,9 +52,7 @@ import:
- package: github.com/spf13/cobra
- package: github.com/spf13/viper
- package: github.com/square/go-jose
version: ~1.1.0
subpackages:
- json
version: 2.1.3
- package: github.com/stretchr/testify
version: 1.1.4
subpackages:
Expand Down
8 changes: 4 additions & 4 deletions jwk/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/square/go-jose"
)

func MustRSAPublic(key *jose.JsonWebKey) *rsa.PublicKey {
func MustRSAPublic(key *jose.JSONWebKey) *rsa.PublicKey {
res, err := ToRSAPublic(key)
if err != nil {
panic(err.Error())
Expand All @@ -16,23 +16,23 @@ func MustRSAPublic(key *jose.JsonWebKey) *rsa.PublicKey {

}

func ToRSAPublic(key *jose.JsonWebKey) (*rsa.PublicKey, error) {
func ToRSAPublic(key *jose.JSONWebKey) (*rsa.PublicKey, error) {
res, ok := key.Key.(*rsa.PublicKey)
if !ok {
return res, errors.New("Could not convert key to RSA Private Key.")
}
return res, nil
}

func MustRSAPrivate(key *jose.JsonWebKey) *rsa.PrivateKey {
func MustRSAPrivate(key *jose.JSONWebKey) *rsa.PrivateKey {
res, err := ToRSAPrivate(key)
if err != nil {
panic(err.Error())
}
return res
}

func ToRSAPrivate(key *jose.JsonWebKey) (*rsa.PrivateKey, error) {
func ToRSAPrivate(key *jose.JSONWebKey) (*rsa.PrivateKey, error) {
res, ok := key.Key.(*rsa.PrivateKey)
if !ok {
return res, errors.New("Could not convert key to RSA Private Key.")
Expand Down
2 changes: 1 addition & 1 deletion jwk/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package jwk
import "github.com/square/go-jose"

type KeyGenerator interface {
Generate(id string) (*jose.JsonWebKeySet, error)
Generate(id string) (*jose.JSONWebKeySet, error)
}
6 changes: 3 additions & 3 deletions jwk/generator_ecdsa256.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (

type ECDSA256Generator struct{}

func (g *ECDSA256Generator) Generate(id string) (*jose.JsonWebKeySet, error) {
func (g *ECDSA256Generator) Generate(id string) (*jose.JSONWebKeySet, error) {
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
if err != nil {
return nil, errors.Errorf("Could not generate key because %s", err)
}

return &jose.JsonWebKeySet{
Keys: []jose.JsonWebKey{
return &jose.JSONWebKeySet{
Keys: []jose.JSONWebKey{
{
Key: key,
KeyID: ider("private", id),
Expand Down
6 changes: 3 additions & 3 deletions jwk/generator_ecdsa521.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (

type ECDSA521Generator struct{}

func (g *ECDSA521Generator) Generate(id string) (*jose.JsonWebKeySet, error) {
func (g *ECDSA521Generator) Generate(id string) (*jose.JSONWebKeySet, error) {
key, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
if err != nil {
return nil, errors.Errorf("Could not generate key because %s", err)
}

return &jose.JsonWebKeySet{
Keys: []jose.JsonWebKey{
return &jose.JSONWebKeySet{
Keys: []jose.JSONWebKey{
{
Key: key,
KeyID: ider("private", id),
Expand Down
6 changes: 3 additions & 3 deletions jwk/generator_hs256.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type HS256Generator struct {
Length int
}

func (g *HS256Generator) Generate(id string) (*jose.JsonWebKeySet, error) {
func (g *HS256Generator) Generate(id string) (*jose.JSONWebKeySet, error) {
if g.Length < 12 {
g.Length = 12
}
Expand All @@ -26,8 +26,8 @@ func (g *HS256Generator) Generate(id string) (*jose.JsonWebKeySet, error) {
return nil, errors.Errorf("Could not generate key because %s", err)
}

return &jose.JsonWebKeySet{
Keys: []jose.JsonWebKey{
return &jose.JSONWebKeySet{
Keys: []jose.JSONWebKey{
{
Key: []byte(string(key)),
KeyID: id,
Expand Down

0 comments on commit f2f8f7a

Please sign in to comment.