fix: security & privacy (rate limiter fix, csrf session cookie, logout on server, drafts stale token passw, login timing, password over 72b, JWT_SECRET complexity, SMTP TLS, CSV export neutralised, fonts bundled, upload metadata, hourly cleanup job, privacy.md report)
This commit is contained in:
1 parent
e2812ee0b9
commit
ea98c5ec05
118 files changed
+3828
-130
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/session"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SessionRevocationUseCase struct {
|
||||
sessions session.Repository
|
||||
now func() time.Time
|
||||
}
|
||||
|
||||
func NewSessionRevocationUseCase(sessions session.Repository, now func() time.Time) *SessionRevocationUseCase {
|
||||
return &SessionRevocationUseCase{sessions, now}
|
||||
}
|
||||
|
||||
func (s *SessionRevocationUseCase) Revoke(id string, expiresAt time.Time) error {
|
||||
if err := session.ValidateID(id); err != nil {
|
||||
return err
|
||||
}
|
||||
if !expiresAt.After(s.now()) {
|
||||
return nil
|
||||
}
|
||||
return s.sessions.Revoke(session.Revocation{ID: id, ExpiresAt: expiresAt})
|
||||
}
|
||||
|
||||
func (s *SessionRevocationUseCase) IsRevoked(id string) (bool, error) {
|
||||
if err := session.ValidateID(id); err != nil {
|
||||
return false, err
|
||||
}
|
||||
return s.sessions.IsRevoked(id)
|
||||
}
|
||||
Reference in new issue
Block a user