MCPcopy Index your code
hub / github.com/coder/coder / AddRoute

Method AddRoute

coderd/coderdtest/oidctest/idp.go:1546–1558  ·  view source on GitHub ↗
(route string, handle func(email string, rw http.ResponseWriter, r *http.Request))

Source from the content-addressed store, hash-verified

1544}
1545
1546func (o *ExternalAuthConfigOptions) AddRoute(route string, handle func(email string, rw http.ResponseWriter, r *http.Request)) *ExternalAuthConfigOptions {
1547 if route == "/" || route == "" || route == "/user" {
1548 panic("cannot override the /user route. Use ValidatePayload instead")
1549 }
1550 if !strings.HasPrefix(route, "/") {
1551 route = "/" + route
1552 }
1553 if o.routes == nil {
1554 o.routes = make(map[string]func(email string, rw http.ResponseWriter, r *http.Request))
1555 }
1556 o.routes[route] = handle
1557 return o
1558}
1559
1560// ExternalAuthConfig is the config for external auth providers.
1561func (f *FakeIDP) ExternalAuthConfig(t testing.TB, id string, custom *ExternalAuthConfigOptions, opts ...func(cfg *externalauth.Config)) *externalauth.Config {

Callers 1

TestExternalAuthByIDFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestExternalAuthByIDFunction · 0.64