Validate checks if the redirect server configuration is valid. Particularly, it checks the HTTP server parameters as well as if the webroot is valid and contains an index.html.
()
| 536 | // Validate checks if the redirect server configuration is valid. Particularly, it checks the HTTP server |
| 537 | // parameters as well as if the webroot is valid and contains an index.html. |
| 538 | func (o OAuth2RedirectConfig) Validate() error { |
| 539 | if err := o.HTTPServerConfiguration.Validate(); err != nil { |
| 540 | return err |
| 541 | } |
| 542 | if o.Webroot != "" { |
| 543 | webrootStat, err := os.Stat(o.Webroot) |
| 544 | if err != nil { |
| 545 | return wrap(err, "webroot") |
| 546 | } |
| 547 | if !webrootStat.IsDir() { |
| 548 | return newError("webroot", "invalid webroot (not a directory)") |
| 549 | } |
| 550 | indexStat, err := os.Stat(path.Join(o.Webroot, "index.html")) |
| 551 | if err != nil { |
| 552 | return wrapWithMessage(err, "webroot", "webroot does not contain an index.html file") |
| 553 | } |
| 554 | if indexStat.IsDir() { |
| 555 | return newError("webroot", "webroot does not contain an index.html file (index.html is a directory)") |
| 556 | } |
| 557 | } |
| 558 | return nil |
| 559 | } |
| 560 | |
| 561 | // AuthGitHubConfig is the configuration structure for GitHub authentication. |
| 562 | type AuthGitHubConfig struct { |
nothing calls this directly
no test coverage detected