Release 0.7.5 (#70)

* Resolve issue with opaque tokens not being parsed correctly

* Increase test coverage

* Further improvements to test coverage and code quality

* Add new providers.

* fixup! Add new providers.

* Cleanup.

* fixup! Cleanup.

* fixup! fixup! Cleanup.

* fixup! fixup! fixup! Cleanup.

* fixup! fixup! fixup! fixup! Cleanup.

* Memory management optimisation

24 bytes per Put < 256-4096 bytes per buffer allocation avoided (10-170x difference)

* Pooling cleanup.
This commit is contained in:
2025-10-01 12:13:10 +01:00
committed by GitHub
parent 3bbc6a1608
commit c3f23cb99b
93 changed files with 26767 additions and 4230 deletions
+14 -5
View File
@@ -1,9 +1,9 @@
package traefikoidc
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"runtime"
"strings"
@@ -12,6 +12,7 @@ import (
"time"
"github.com/gorilla/sessions"
"github.com/lukaszraczylo/traefikoidc/internal/pool"
)
// TokenConfig defines validation and storage parameters for different token types.
@@ -981,9 +982,13 @@ func (cm *ChunkManager) extractJWTExpiration(token string) (*time.Time, error) {
return nil, fmt.Errorf("failed to decode JWT payload: %w", err)
}
// Parse the JSON payload
// Parse the JSON payload using pooled decoder
var claims map[string]interface{}
if err := json.Unmarshal(payload, &claims); err != nil {
pm := pool.Get()
decoder := pm.GetJSONDecoder(bytes.NewReader(payload))
defer pm.PutJSONDecoder(decoder)
if err := decoder.Decode(&claims); err != nil {
return nil, fmt.Errorf("failed to parse JWT claims: %w", err)
}
@@ -1067,9 +1072,13 @@ func (cm *ChunkManager) extractJWTIssuedAt(token string) (*time.Time, error) {
return nil, fmt.Errorf("failed to decode JWT payload: %w", err)
}
// Parse the JSON payload
// Parse the JSON payload using pooled decoder
var claims map[string]interface{}
if err := json.Unmarshal(payload, &claims); err != nil {
pm := pool.Get()
decoder := pm.GetJSONDecoder(bytes.NewReader(payload))
defer pm.PutJSONDecoder(decoder)
if err := decoder.Decode(&claims); err != nil {
return nil, fmt.Errorf("failed to parse JWT claims: %w", err)
}