cache

package
v0.2.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Linux-specific PoP cache implementation using kernel keyrings for secure storage. This implementation is adapted from the Azure SDK azidentity cache to eliminate the dependency on libsecret while maintaining secure token storage on Linux systems.

The implementation uses Linux kernel keyrings to store encryption keys securely in memory, with encrypted cache data persisted to disk. This provides: - No external dependencies (no libsecret required) - Secure key storage that survives process restarts but not system reboots - Encrypted cache files with keys protected by the kernel keyring system

Reference: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azidentity/cache/linux.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSecureAccessor

func NewSecureAccessor(cachePath string) (accessor.Accessor, error)

NewSecureAccessor creates a new platform-specific secure storage accessor. This can be used for storing other sensitive data like RSA private keys using the same encrypted storage infrastructure as the PoP token cache.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache implements the MSAL cache.ExportReplace interface using our platform-specific PoP cache. This provides secure, persistent PoP token storage without depending on libsecret on Linux. Cache provides a unified interface for PoP token caching following azidentity patterns.

func NewCache

func NewCache(cacheDir string) (*Cache, error)

NewCache creates a new MSAL cache provider using custom platform-specific PoP cache. This implementation provides secure storage on all platforms without external dependencies like libsecret on Linux. Following the azidentity pattern, this proactively tests storage capability before creating the cache.

func (*Cache) Clear

func (c *Cache) Clear(ctx context.Context) error

Clear removes all PoP token data from the cache.

func (*Cache) Export

func (c *Cache) Export(ctx context.Context, marshaler cache.Marshaler, hints cache.ExportHints) error

Export saves the current PoP token cache state to platform-specific secure storage. This method is called by MSAL to persist PoP tokens across application restarts.

func (*Cache) Replace

func (c *Cache) Replace(ctx context.Context, unmarshaler cache.Unmarshaler, hints cache.ReplaceHints) error

Replace loads PoP token cache data from platform-specific secure storage and restores it into MSAL's in-memory cache. This method is called by MSAL during initialization to restore previously cached PoP tokens from persistent storage.

Directories

Path Synopsis
internal
jwe

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL