MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / TestScope

Function TestScope

providers/providers_test.go:214–320  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

212}
213
214func TestScope(t *testing.T) {
215 g := NewWithT(t)
216
217 testCases := []struct {
218 name string
219 configuredType options.ProviderType
220 configuredScope string
221 expectedScope string
222 allowedGroups []string
223 }{
224 {
225 name: "oidc: with no scope provided",
226 configuredType: "oidc",
227 configuredScope: "",
228 expectedScope: "openid email profile",
229 },
230 {
231 name: "oidc: with no scope provided and allowed groups",
232 configuredType: "oidc",
233 configuredScope: "",
234 expectedScope: "openid email profile groups",
235 allowedGroups: []string{"foo"},
236 },
237 {
238 name: "oidc: with custom scope including groups without allowed groups",
239 configuredType: "oidc",
240 configuredScope: "myscope groups",
241 expectedScope: "myscope groups",
242 },
243 {
244 name: "oidc: with custom scope without groups but allowed groups",
245 configuredType: "oidc",
246 configuredScope: "myscope",
247 expectedScope: "myscope",
248 allowedGroups: []string{"foo"},
249 },
250 {
251 name: "oidc: with custom scope with groups and allowed groups",
252 configuredType: "oidc",
253 configuredScope: "myscope groups",
254 expectedScope: "myscope groups",
255 allowedGroups: []string{"foo"},
256 },
257 {
258 name: "oidc: with a configured scope provided",
259 configuredType: "oidc",
260 configuredScope: "openid",
261 expectedScope: "openid",
262 },
263 {
264 name: "github: with no scope provided",
265 configuredType: "github",
266 configuredScope: "",
267 expectedScope: "user:email read:org",
268 },
269 {
270 name: "github: with a configured scope provided",
271 configuredType: "github",

Callers

nothing calls this directly

Calls 3

DataMethod · 0.95
ToFunction · 0.92
NewProviderFunction · 0.70

Tested by

no test coverage detected