Skip to content

v1.0.2

Latest

Choose a tag to compare

@kasaiarashi kasaiarashi released this 01 Mar 17:26
75ceb0b

What's new

ginmw — five new capabilities

Symbol Description
JWTOption / WithClaimsExtractor Map claims.Custom fields to named Gin context keys immediately after token verification
WithWebSocketFallback Fall back to ?token= query param on WebSocket upgrades when Authorization header is absent
RequireCustomClaim(key, values...) 403 unless the Gin context value at key matches one of values
RequireCustomClaimNot(key, value) 403 when the Gin context value equals value (e.g. block "pending" accounts)
RequireAsyncPermission(...) DB-backed async permission check via PermissionFunc with optional bypass

ginmw.JWT(svc) with no options is unchanged.

audit — custom DB schema support

Symbol Description
EventMapper func(Event) []any — maps an event to positional SQL params
WithCustomSchema(insertSQL, mapper) Caller-supplied INSERT statement + mapper; SDK is schema-agnostic

WithTableName is silently ignored when WithCustomSchema is set.
audit.NewDBLogger(db) with no options is unchanged.

Upgrade

go get github.com/KriaaCompany/api-security-sdk@v1.0.2