oauth2-proxy / mockoidc

A Mock OIDC Server for Unit & Integration Tests
MIT License
58 stars 38 forks source link

mockoidc: enable server impersonation #36

Open raggi opened 2 years ago

raggi commented 2 years ago

By customizing EndpointConfig, the mock server can now impersonate many other OIDC servers, which can then be used with a MITM-ing http.RoundTripper to execute tests against otherwise unaltered client code.

raggi commented 2 years ago

I'm happy to add additional test coverage, or provide examples of usage as you might like, but I wanted to send an in-principle patch first for feedback.

lanwen commented 1 year ago

@raggi Would you be so kind to provide a usage example? Seems that doing

endpoints := mockoidc.EndpointConfig{
        IssuerBase:    "/",
        TokenEndpoint: "/oauth/token",
    }
    endpoints.Defaults()
    m.EndpointConfig = endpoints

doesn't really work, as well as not really convenient, as you can't inline it. Thank you