MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / parseTfaRememberDuration

Function parseTfaRememberDuration

server-source-code/internal/handler/auth.go:623–642  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

621}
622
623func parseTfaRememberDuration(s string) time.Duration {
624 s = strings.TrimSpace(strings.ToLower(s))
625 if len(s) < 2 {
626 return 30 * 24 * time.Hour
627 }
628 n, err := strconv.Atoi(s[:len(s)-1])
629 if err != nil || n <= 0 {
630 return 30 * 24 * time.Hour
631 }
632 switch s[len(s)-1] {
633 case 'd':
634 return time.Duration(n) * 24 * time.Hour
635 case 'h':
636 return time.Duration(n) * time.Hour
637 case 'm':
638 return time.Duration(n) * time.Minute
639 default:
640 return 30 * 24 * time.Hour
641 }
642}
643
644// CompleteOidcLogin creates tokens, sets cookies (SameSite=Lax for IdP redirects), and redirects to success.
645// Used by OIDC callback after successful authentication.

Callers 2

completeLoginMethod · 0.85
parseJwtExpiresInSecondsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected