MCPcopy Index your code
hub / github.com/ContainerSSH/ContainerSSH / Validate

Method Validate

config/auth.go:465–497  ·  view source on GitHub ↗

Validate validates if the OAuth2 client configuration is valid.

()

Source from the content-addressed store, hash-verified

463
464// Validate validates if the OAuth2 client configuration is valid.
465func (o *AuthOAuth2ClientConfig) Validate() error {
466 if err := o.Redirect.Validate(); err != nil {
467 return wrap(err, "redirect")
468 }
469 if o.ClientID == "" {
470 return newError("clientId", "empty client ID")
471 }
472
473 if o.ClientSecret == "" {
474 return newError("clientSecret", "empty client secret")
475 }
476
477 if err := o.Provider.Validate(); err != nil {
478 return wrap(err, "provider")
479 }
480
481 switch o.Provider {
482 case AuthOAuth2GitHubProvider:
483 if err := o.GitHub.Validate(); err != nil {
484 return wrap(err, "github")
485 }
486 case AuthOAuth2OIDCProvider:
487 if err := o.OIDC.Validate(); err != nil {
488 return wrap(err, "oidc")
489 }
490 case AuthOAuth2GenericProvider:
491 if err := o.Generic.Validate(); err != nil {
492 return wrap(err, "generic")
493 }
494 }
495
496 return nil
497}
498
499// OAuth2ProviderName provides the various methods of oAuth2 authentication.
500type OAuth2ProviderName string

Callers

nothing calls this directly

Calls 3

wrapFunction · 0.85
newErrorFunction · 0.85
ValidateMethod · 0.65

Tested by

no test coverage detected