Skip to content

feat: csrf Redis storage adapter #215

@FumingPower3925

Description

@FumingPower3925

Summary

Add a Redis-backed csrf.Storage implementation for server-side CSRF tokens.

Context

The CSRF middleware defines:

type Storage interface {
    Get(key string) (string, bool)
    Set(key string, token string, expiry time.Duration)
    Delete(key string)
}

Currently uses an in-memory sharded map. For multi-instance deployments, server-side CSRF tokens must be shared.

Scope

  • Implement RedisStorage satisfying csrf.Storage
  • Use Redis GET/SETEX/DEL with key prefix (default: csrf:)
  • Use celeris's native Redis driver

Metadata

Metadata

Labels

middlewareMiddleware implementation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions