mirror of https://github.com/dexidp/dex.git
12 changed files with 346 additions and 367 deletions
@ -1,3 +1,2 @@
|
||||
Bobby Rullo <bobby.rullo@coreos.com> (@bobbyrullo) |
||||
Ed Rooth <ed.rooth@coreos.com> (@sym3tri) |
||||
Eric Chiang <eric.chiang@coreos.com> (@ericchiang) |
||||
Eric Chiang <echiang@redhat.com> (@ericchiang) |
||||
Rithu Leena John <rjohn@redhat.com> (@rithujohn191) |
||||
|
||||
@ -0,0 +1,61 @@
|
||||
## CoreOS Community Code of Conduct |
||||
|
||||
### Contributor Code of Conduct |
||||
|
||||
As contributors and maintainers of this project, and in the interest of |
||||
fostering an open and welcoming community, we pledge to respect all people who |
||||
contribute through reporting issues, posting feature requests, updating |
||||
documentation, submitting pull requests or patches, and other activities. |
||||
|
||||
We are committed to making participation in this project a harassment-free |
||||
experience for everyone, regardless of level of experience, gender, gender |
||||
identity and expression, sexual orientation, disability, personal appearance, |
||||
body size, race, ethnicity, age, religion, or nationality. |
||||
|
||||
Examples of unacceptable behavior by participants include: |
||||
|
||||
* The use of sexualized language or imagery |
||||
* Personal attacks |
||||
* Trolling or insulting/derogatory comments |
||||
* Public or private harassment |
||||
* Publishing others' private information, such as physical or electronic addresses, without explicit permission |
||||
* Other unethical or unprofessional conduct. |
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or |
||||
reject comments, commits, code, wiki edits, issues, and other contributions |
||||
that are not aligned to this Code of Conduct. By adopting this Code of Conduct, |
||||
project maintainers commit themselves to fairly and consistently applying these |
||||
principles to every aspect of managing this project. Project maintainers who do |
||||
not follow or enforce the Code of Conduct may be permanently removed from the |
||||
project team. |
||||
|
||||
This code of conduct applies both within project spaces and in public spaces |
||||
when an individual is representing the project or its community. |
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be |
||||
reported by contacting a project maintainer, Brandon Philips |
||||
<brandon.philips@coreos.com>, and/or Rithu John <rithu.john@coreos.com>. |
||||
|
||||
This Code of Conduct is adapted from the Contributor Covenant |
||||
(http://contributor-covenant.org), version 1.2.0, available at |
||||
http://contributor-covenant.org/version/1/2/0/ |
||||
|
||||
### CoreOS Events Code of Conduct |
||||
|
||||
CoreOS events are working conferences intended for professional networking and |
||||
collaboration in the CoreOS community. Attendees are expected to behave |
||||
according to professional standards and in accordance with their employer’s |
||||
policies on appropriate workplace behavior. |
||||
|
||||
While at CoreOS events or related social networking opportunities, attendees |
||||
should not engage in discriminatory or offensive speech or actions including |
||||
but not limited to gender, sexuality, race, age, disability, or religion. |
||||
Speakers should be especially aware of these concerns. |
||||
|
||||
CoreOS does not condone any statements by speakers contrary to these standards. |
||||
CoreOS reserves the right to deny entrance and/or eject from an event (without |
||||
refund) any individual found to be engaging in discriminatory or offensive |
||||
speech or actions. |
||||
|
||||
Please bring any concerns to the immediate attention of designated on-site |
||||
staff, Brandon Philips <brandon.philips@coreos.com>, and/or Rithu John <rithu.john@coreos.com>. |
||||
@ -1,150 +0,0 @@
|
||||
// +build ignore
|
||||
|
||||
// This file is used to generate keys for tests.
|
||||
|
||||
package main |
||||
|
||||
import ( |
||||
"bytes" |
||||
"crypto" |
||||
"crypto/ecdsa" |
||||
"crypto/elliptic" |
||||
"crypto/rand" |
||||
"crypto/rsa" |
||||
"encoding/hex" |
||||
"encoding/json" |
||||
"fmt" |
||||
"io/ioutil" |
||||
"log" |
||||
"text/template" |
||||
|
||||
jose "gopkg.in/square/go-jose.v2" |
||||
) |
||||
|
||||
type key struct { |
||||
name string |
||||
new func() (crypto.Signer, error) |
||||
} |
||||
|
||||
var keys = []key{ |
||||
{ |
||||
"ECDSA_256", func() (crypto.Signer, error) { |
||||
return ecdsa.GenerateKey(elliptic.P256(), rand.Reader) |
||||
}, |
||||
}, |
||||
{ |
||||
"ECDSA_384", func() (crypto.Signer, error) { |
||||
return ecdsa.GenerateKey(elliptic.P384(), rand.Reader) |
||||
}, |
||||
}, |
||||
{ |
||||
"ECDSA_521", func() (crypto.Signer, error) { |
||||
return ecdsa.GenerateKey(elliptic.P521(), rand.Reader) |
||||
}, |
||||
}, |
||||
{ |
||||
"RSA_1024", func() (crypto.Signer, error) { |
||||
return rsa.GenerateKey(rand.Reader, 1024) |
||||
}, |
||||
}, |
||||
{ |
||||
"RSA_2048", func() (crypto.Signer, error) { |
||||
return rsa.GenerateKey(rand.Reader, 2048) |
||||
}, |
||||
}, |
||||
{ |
||||
"RSA_4096", func() (crypto.Signer, error) { |
||||
return rsa.GenerateKey(rand.Reader, 4096) |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
func newJWK(k key, prefix, ident string) (privBytes, pubBytes []byte, err error) { |
||||
priv, err := k.new() |
||||
if err != nil { |
||||
return nil, nil, fmt.Errorf("generate %s: %v", k.name, err) |
||||
} |
||||
pub := priv.Public() |
||||
|
||||
privKey := &jose.JSONWebKey{Key: priv} |
||||
thumbprint, err := privKey.Thumbprint(crypto.SHA256) |
||||
if err != nil { |
||||
return nil, nil, fmt.Errorf("computing thumbprint: %v", err) |
||||
} |
||||
|
||||
keyID := hex.EncodeToString(thumbprint) |
||||
privKey.KeyID = keyID |
||||
pubKey := &jose.JSONWebKey{Key: pub, KeyID: keyID} |
||||
|
||||
privBytes, err = json.MarshalIndent(privKey, prefix, ident) |
||||
if err != nil { |
||||
return |
||||
} |
||||
pubBytes, err = json.MarshalIndent(pubKey, prefix, ident) |
||||
return |
||||
} |
||||
|
||||
type keyData struct { |
||||
Name string |
||||
Priv string |
||||
Pub string |
||||
} |
||||
|
||||
var tmpl = template.Must(template.New("").Parse(`// +build !golint
|
||||
|
||||
// This file contains statically created JWKs for tests created by gen.go
|
||||
|
||||
package oidc |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
jose "gopkg.in/square/go-jose.v2" |
||||
) |
||||
|
||||
func mustLoadJWK(s string) jose.JSONWebKey { |
||||
var jwk jose.JSONWebKey |
||||
if err := json.Unmarshal([]byte(s), &jwk); err != nil { |
||||
panic(err) |
||||
} |
||||
return jwk |
||||
} |
||||
|
||||
var ( |
||||
{{- range $i, $key := .Keys }} |
||||
testKey{{ $key.Name }} = mustLoadJWK(` + "`" + `{{ $key.Pub }}` + "`" + `) |
||||
testKey{{ $key.Name }}_Priv = mustLoadJWK(` + "`" + `{{ $key.Priv }}` + "`" + `) |
||||
{{ end -}} |
||||
) |
||||
`)) |
||||
|
||||
func main() { |
||||
var tmplData struct { |
||||
Keys []keyData |
||||
} |
||||
for _, k := range keys { |
||||
for i := 0; i < 4; i++ { |
||||
log.Printf("generating %s", k.name) |
||||
priv, pub, err := newJWK(k, "\t", "\t") |
||||
if err != nil { |
||||
log.Fatal(err) |
||||
} |
||||
name := fmt.Sprintf("%s_%d", k.name, i) |
||||
|
||||
tmplData.Keys = append(tmplData.Keys, keyData{ |
||||
Name: name, |
||||
Priv: string(priv), |
||||
Pub: string(pub), |
||||
}) |
||||
} |
||||
} |
||||
|
||||
buff := new(bytes.Buffer) |
||||
if err := tmpl.Execute(buff, tmplData); err != nil { |
||||
log.Fatalf("excuting template: %v", err) |
||||
} |
||||
|
||||
if err := ioutil.WriteFile("jose_test.go", buff.Bytes(), 0644); err != nil { |
||||
log.Fatal(err) |
||||
} |
||||
} |
||||
Loading…
Reference in new issue