Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oidctest package #345

Open
ericchiang opened this issue Jul 6, 2022 · 1 comment · May be fixed by #400
Open

Add oidctest package #345

ericchiang opened this issue Jul 6, 2022 · 1 comment · May be fixed by #400

Comments

@ericchiang
Copy link
Collaborator

Currently it's pretty hard to write a unit test for this package. Consider adding a wrapper around https://pkg.go.dev/net/http/httptest that spins up a minimal server.

package oidctest

type Server struct {
    PublicKeys []crypto.PublicKey
    SigningKey crypto.PrivateKey
    // ... other configuration
}

type Claims struct {
    // ... fields
}

func (s *Server) Start()
func (s *Server) Close()
func (s *Server) NewIDToken(claims *Claims) string
func (s *Server) NewProvider() *oidc.Provider
@jimlambrt
Copy link

hashicorp's cap provides a TestProvider which could possibly be used to write unit tests or you could be "inspired" by it's implementation for something similar here.

@ericchiang ericchiang linked a pull request Nov 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants