forked from Azure/azure-docs-sdk-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTokenCachePersistenceOptions.xml
168 lines (163 loc) · 8.99 KB
/
TokenCachePersistenceOptions.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<Type Name="TokenCachePersistenceOptions" FullName="Azure.Identity.TokenCachePersistenceOptions">
<TypeSignature Language="C#" Value="public class TokenCachePersistenceOptions" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit TokenCachePersistenceOptions extends System.Object" />
<TypeSignature Language="DocId" Value="T:Azure.Identity.TokenCachePersistenceOptions" />
<TypeSignature Language="VB.NET" Value="Public Class TokenCachePersistenceOptions" />
<TypeSignature Language="F#" Value="type TokenCachePersistenceOptions = class" />
<AssemblyInfo>
<AssemblyName>Azure.Identity</AssemblyName>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<AssemblyVersion>1.8.1.0</AssemblyVersion>
<AssemblyVersion>1.8.2.0</AssemblyVersion>
<AssemblyVersion>1.9.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>
Options controlling the storage of the token cache.
</summary>
<remarks>To be added.</remarks>
<example>
<para>
This is an example showing how TokenCachePersistenceOptions and an AuthenticationRecord can be used together to enable silent authentication
across executions of a client application.
</para>
<code snippet="Snippet:AuthenticationRecord_TokenCachePersistenceOptions" language="csharp">
const string TOKEN_CACHE_NAME = "MyTokenCache";
InteractiveBrowserCredential credential;
AuthenticationRecord authRecord;
// Check if an AuthenticationRecord exists on disk.
// If it does not exist, get one and serialize it to disk.
// If it does exist, load it from disk and deserialize it.
if (!File.Exists(AUTH_RECORD_PATH))
{
// Construct a credential with TokenCachePersistenceOptions specified to ensure that the token cache is persisted to disk.
// We can also optionally specify a name for the cache to avoid having it cleared by other applications.
credential = new InteractiveBrowserCredential(
new InteractiveBrowserCredentialOptions { TokenCachePersistenceOptions = new TokenCachePersistenceOptions { Name = TOKEN_CACHE_NAME } });
// Call AuthenticateAsync to fetch a new AuthenticationRecord.
authRecord = await credential.AuthenticateAsync();
// Serialize the AuthenticationRecord to disk so that it can be re-used across executions of this initialization code.
using var authRecordStream = new FileStream(AUTH_RECORD_PATH, FileMode.Create, FileAccess.Write);
await authRecord.SerializeAsync(authRecordStream);
}
else
{
// Load the previously serialized AuthenticationRecord from disk and deserialize it.
using var authRecordStream = new FileStream(AUTH_RECORD_PATH, FileMode.Open, FileAccess.Read);
authRecord = await AuthenticationRecord.DeserializeAsync(authRecordStream);
// Construct a new client with our TokenCachePersistenceOptions with the addition of the AuthenticationRecord property.
// This tells the credential to use the same token cache in addition to which account to try and fetch from cache when GetToken is called.
credential = new InteractiveBrowserCredential(
new InteractiveBrowserCredentialOptions
{
TokenCachePersistenceOptions = new TokenCachePersistenceOptions { Name = TOKEN_CACHE_NAME },
AuthenticationRecord = authRecord
});
}
// Construct our client with the credential which is connected to the token cache
// with the capability of silent authentication for the account specified in the AuthenticationRecord.
var client = new SecretClient(new Uri("https://myvault.vault.azure.net/"), credential);
</code>
</example>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public TokenCachePersistenceOptions ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Azure.Identity.TokenCachePersistenceOptions.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Azure.Identity</AssemblyName>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<AssemblyVersion>1.8.1.0</AssemblyVersion>
<AssemblyVersion>1.8.2.0</AssemblyVersion>
<AssemblyVersion>1.9.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Name">
<MemberSignature Language="C#" Value="public string Name { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Name" />
<MemberSignature Language="DocId" Value="P:Azure.Identity.TokenCachePersistenceOptions.Name" />
<MemberSignature Language="VB.NET" Value="Public Property Name As String" />
<MemberSignature Language="F#" Value="member this.Name : string with get, set" Usage="Azure.Identity.TokenCachePersistenceOptions.Name" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Azure.Identity</AssemblyName>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<AssemblyVersion>1.8.1.0</AssemblyVersion>
<AssemblyVersion>1.8.2.0</AssemblyVersion>
<AssemblyVersion>1.9.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>
Name uniquely identifying the <see cref="T:Azure.Identity.TokenCachePersistenceOptions" />.
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="UnsafeAllowUnencryptedStorage">
<MemberSignature Language="C#" Value="public bool UnsafeAllowUnencryptedStorage { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool UnsafeAllowUnencryptedStorage" />
<MemberSignature Language="DocId" Value="P:Azure.Identity.TokenCachePersistenceOptions.UnsafeAllowUnencryptedStorage" />
<MemberSignature Language="VB.NET" Value="Public Property UnsafeAllowUnencryptedStorage As Boolean" />
<MemberSignature Language="F#" Value="member this.UnsafeAllowUnencryptedStorage : bool with get, set" Usage="Azure.Identity.TokenCachePersistenceOptions.UnsafeAllowUnencryptedStorage" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Azure.Identity</AssemblyName>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<AssemblyVersion>1.8.1.0</AssemblyVersion>
<AssemblyVersion>1.8.2.0</AssemblyVersion>
<AssemblyVersion>1.9.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>
If set to true the token cache may be persisted as an unencrypted file if no OS level user encryption is available. When set to false the token cache
will throw a <see cref="T:Azure.Identity.CredentialUnavailableException" /> in the event no OS level user encryption is available.
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>