Documentation ¶
Overview ¶
Example ¶
This example shows how to configure an MSAL public client to store data in a peristent, encrypted cache.
package main import ( "github.com/AzureAD/microsoft-authentication-extensions-for-go/cache" "github.com/AzureAD/microsoft-authentication-extensions-for-go/cache/accessor" "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" ) func main() { // On Linux and macOS, "s" is an arbitrary name identifying the cache. // On Windows, it's the path to a file in which to store cache data. s := "..." a, err := accessor.New(s) if err != nil { // TODO: handle error } c, err := cache.New(a, s) if err != nil { // TODO: handle error } app, err := public.New("client-id", public.WithCache(c)) if err != nil { // TODO: handle error } _ = app }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache caches authentication data in external storage, using a file lock to coordinate access with other processes.
func New ¶
New is the constructor for Cache. "p" is the path to a file used to track when stored data changes. Cache.Export will create this file and any directories in its path which don't already exist.
func (*Cache) Export ¶
Export writes the bytes marshaled by "m" to the accessor. MSAL clients call this method automatically.
func (*Cache) Replace ¶
func (c *Cache) Replace(ctx context.Context, u cache.Unmarshaler, h cache.ReplaceHints) error
Replace reads bytes from the accessor and unmarshals them to "u". MSAL clients call this method automatically.