Debian Codegraph @

cache/example_test.go

raw
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3
4 package cache_test
5
6 import (
7 "github.com/AzureAD/microsoft-authentication-extensions-for-go/cache"
8 "github.com/AzureAD/microsoft-authentication-extensions-for-go/cache/accessor"
9 "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public"
10 )
11
12 // This example shows how to configure an MSAL public client to store data in a peristent, encrypted cache.
13 func Example() {
14 // On Linux and macOS, "s" is an arbitrary name identifying the cache.
15 // On Windows, it's the path to a file in which to store cache data.
16 s := "..."
17 a, err := accessor.New(s)
18 if err != nil {
19 // TODO: handle error
20 }
21 c, err := cache.New(a, s)
22 if err != nil {
23 // TODO: handle error
24 }
25 app, err := public.New("client-id", public.WithCache(c))
26 if err != nil {
27 // TODO: handle error
28 }
29
30 _ = app
31 }