MCPcopy Index your code
hub / github.com/tinyauthapp/tinyauth / IsAuthEnabled

Method IsAuthEnabled

internal/service/auth_service.go:518–546  ·  view source on GitHub ↗
(uri string, path config.AppPath)

Source from the content-addressed store, hash-verified

516}
517
518func (auth *AuthService) IsAuthEnabled(uri string, path config.AppPath) (bool, error) {
519 // Check for block list
520 if path.Block != "" {
521 regex, err := regexp.Compile(path.Block)
522
523 if err != nil {
524 return true, err
525 }
526
527 if !regex.MatchString(uri) {
528 return false, nil
529 }
530 }
531
532 // Check for allow list
533 if path.Allow != "" {
534 regex, err := regexp.Compile(path.Allow)
535
536 if err != nil {
537 return true, err
538 }
539
540 if regex.MatchString(uri) {
541 return false, nil
542 }
543 }
544
545 return true, nil
546}
547
548func (auth *AuthService) GetBasicAuth(c *gin.Context) *config.User {
549 username, password, ok := c.Request.BasicAuth()

Callers 1

proxyHandlerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected