1 write to Items
Microsoft.AspNetCore.Authentication.Abstractions (1)
AuthenticationProperties.cs (1)
44Items = items ?? new Dictionary<string, string?>(StringComparer.Ordinal);
184 references to Items
CookieSample (1)
Program.cs (1)
64foreach (var (key, value) in ticket.Properties.Items)
Identity.DefaultUI.WebSite (1)
Services\ContosoAuthenticationHandler.cs (1)
30["State"] = JsonConvert.SerializeObject(properties.Items),
Microsoft.AspNetCore.Authentication (7)
PropertiesSerializer.cs (2)
51writer.Write(properties.Items.Count); 53foreach (var item in properties.Items)
RemoteAuthenticationHandler.cs (5)
154ticketContext.Properties!.Items[AuthSchemeKey] = Scheme.Name; 205&& ticket.Properties.Items.TryGetValue(AuthSchemeKey, out var authenticatedScheme) 236properties.Items[CorrelationProperty] = correlationId; 252if (!properties.Items.TryGetValue(CorrelationProperty, out var correlationId)) 258properties.Items.Remove(CorrelationProperty);
Microsoft.AspNetCore.Authentication.Abstractions (24)
AuthenticationProperties.cs (16)
54new Dictionary<string, string?>(Items, StringComparer.Ordinal), 120/// Get a string value from the <see cref="Items"/> collection. 126return Items.TryGetValue(key, out var value) ? value : null; 130/// Set or remove a string value from the <see cref="Items"/> collection. 138Items[key] = value; 142Items.Remove(key); 165/// Get a nullable <see cref="bool"/> from the <see cref="Items"/> collection. 171if (Items.TryGetValue(key, out var value) && bool.TryParse(value, out var boolValue)) 179/// Set or remove a <see cref="bool"/> value in the <see cref="Items"/> collection. 187Items[key] = value.GetValueOrDefault().ToString(); 191Items.Remove(key); 196/// Get a nullable <see cref="DateTimeOffset"/> value from the <see cref="Items"/> collection. 202if (Items.TryGetValue(key, out var value) 211/// Sets or removes a <see cref="DateTimeOffset" /> value in the <see cref="Items"/> collection. 219Items[key] = value.GetValueOrDefault().ToString(UtcDateTimeFormat, CultureInfo.InvariantCulture); 223Items.Remove(key);
TokenExtensions.cs (8)
30properties.Items.Remove(TokenKeyPrefix + t.Name); 32properties.Items.Remove(TokenNamesKey); 44properties.Items[TokenKeyPrefix + token.Name] = token.Value; 49properties.Items[TokenNamesKey] = string.Join(";", tokenNames); 66return properties.Items.TryGetValue(tokenKey, out var value) ? value : null; 82if (!properties.Items.ContainsKey(tokenKey)) 86properties.Items[tokenKey] = tokenValue; 100if (properties.Items.TryGetValue(TokenNamesKey, out var value) && !string.IsNullOrEmpty(value))
Microsoft.AspNetCore.Authentication.Cookies (2)
CookieAuthenticationHandler.cs (2)
142foreach (var item in ticket.Properties.Items) 144newProperties.Items[item.Key] = item.Value;
Microsoft.AspNetCore.Authentication.Core.Test (62)
AuthenticationPropertiesTests.cs (54)
24Assert.Same(items, props.Items); 27Assert.NotSame(props.Items, copy.Items); 30Assert.Equal(props.Items, copy.Items); 32props.Items["change"] = "good"; 34Assert.NotEqual(props.Items, copy.Items); 42Assert.Empty(props.Items); 54Assert.Same(items, props.Items); 71Assert.Same(items, props.Items); 80Assert.Equal(0, props.Items.Count); 84Assert.Equal("foo bar", props.Items["foo"]); 85Assert.Equal(1, props.Items.Count); 89Assert.Equal("foo baz", props.Items["foo"]); 90Assert.Equal(1, props.Items.Count); 94Assert.Equal("xy", props.Items["bar"]); 95Assert.Equal(2, props.Items.Count); 99Assert.Equal(string.Empty, props.Items["bar"]); 103Assert.Equal(1, props.Items.Count); 106Assert.False(props.Items.ContainsKey("doesntexist")); 107Assert.Equal(1, props.Items.Count); 173Assert.Equal(string.Empty, props.Items.First().Value); 175props.Items.Clear(); 187Assert.Equal("http://example.com", props.Items.First().Value); 189props.Items.Clear(); 201Assert.Equal("Wed, 21 Mar 2018 00:00:00 GMT", props.Items.First().Value); 203props.Items.Clear(); 215Assert.Equal("Mon, 19 Mar 2018 12:34:56 GMT", props.Items.First().Value); 217props.Items.Clear(); 229Assert.Equal("True", props.Items.First().Value); 233Assert.Equal("False", props.Items.First().Value); 235props.Items.Clear(); 245Assert.Equal("Mon, 19 Mar 2018 12:34:56 GMT", props.Items["foo"]); 248Assert.False(props.Items.ContainsKey("foo")); 251Assert.False(props.Items.ContainsKey("doesnotexist")); 260props.Items["foo"] = dateTimeOffset.ToString("r", CultureInfo.InvariantCulture); 263props.Items.Remove("foo"); 266props.Items["foo"] = "BAR"; 268Assert.Equal("BAR", props.Items["foo"]); 277Assert.Equal(true.ToString(), props.Items["foo"]); 280Assert.Equal(false.ToString(), props.Items["foo"]); 283Assert.False(props.Items.ContainsKey("foo")); 291props.Items["foo"] = true.ToString(); 294props.Items["foo"] = false.ToString(); 297props.Items["foo"] = null; 300props.Items["foo"] = "BAR"; 302Assert.Equal("BAR", props.Items["foo"]); 317props.Items.Add("foo", "bar"); 338Assert.NotNull(deserialized.Items); 339Assert.True(deserialized.Items.ContainsKey("foo")); 340Assert.Equal(props.Items["foo"], deserialized.Items["foo"]); 373props.Items.Add("foo", "bar");
AuthenticationTicketTests.cs (8)
27Assert.Same(items, ticket.Properties.Items); 31Assert.NotSame(ticket.Properties.Items, copy.Properties.Items); 34Assert.Equal(ticket.Properties.Items, copy.Properties.Items); 36props.Items["change"] = "good"; 38Assert.NotEqual(ticket.Properties.Items, copy.Properties.Items);
Microsoft.AspNetCore.Authentication.Google (2)
GoogleHandler.cs (2)
100else if (!properties.Items.TryGetValue(name, out value)) 106properties.Items.Remove(name);
Microsoft.AspNetCore.Authentication.MicrosoftAccount (3)
MicrosoftAccountHandler.cs (3)
86properties.Items.Add(OAuthConstants.CodeVerifierKey, codeVerifier); 114else if (!properties.Items.TryGetValue(name, out value)) 120properties.Items.Remove(name);
Microsoft.AspNetCore.Authentication.OAuth (3)
OAuthHandler.cs (3)
210if (context.Properties.Items.TryGetValue(OAuthConstants.CodeVerifierKey, out var codeVerifier)) 213context.Properties.Items.Remove(OAuthConstants.CodeVerifierKey); 320properties.Items.Add(OAuthConstants.CodeVerifierKey, codeVerifier);
Microsoft.AspNetCore.Authentication.OpenIdConnect (11)
OpenIdConnectHandler.cs (11)
265properties.Items[OpenIdConnectDefaults.UserstatePropertiesKey] = message.State; 418properties.Items.Add(OAuthConstants.CodeVerifierKey, codeVerifier); 474properties.Items[OpenIdConnectDefaults.UserstatePropertiesKey] = message.State; 478properties.Items.Add(OpenIdConnectDefaults.RedirectUriForCodePropertiesKey, message.RedirectUri); 587if (properties == null || properties.Items.Count == 0) 852properties.Items.TryGetValue(OpenIdConnectDefaults.UserstatePropertiesKey, out var userstate); 863properties.Items[OpenIdConnectSessionProperties.SessionState] = message.SessionState; 868properties.Items[OpenIdConnectSessionProperties.CheckSessionIFrame] = _configuration.CheckSessionIframe; 1159RedirectUri = properties.Items[OpenIdConnectDefaults.RedirectUriForCodePropertiesKey] 1163if (properties.Items.TryGetValue(OAuthConstants.CodeVerifierKey, out var codeVerifier)) 1166properties.Items.Remove(OAuthConstants.CodeVerifierKey);
Microsoft.AspNetCore.Authentication.Test (55)
CookieTests.cs (2)
684ctx.Properties.Items["updated"] = "yes"; 1897xml.Add(result.Ticket.Properties.Items.Select(extra => new XElement("extra", new XAttribute("type", extra.Key), new XAttribute("value", extra.Value))));
FacebookTests.cs (1)
359properties.Items.Add(correlationKey, correlationValue);
GoogleTests.cs (28)
200Assert.DoesNotContain("scope", stateProperties.Items.Keys); 201Assert.DoesNotContain("access_type", stateProperties.Items.Keys); 202Assert.DoesNotContain("include_granted_scopes", stateProperties.Items.Keys); 203Assert.DoesNotContain("approval_prompt", stateProperties.Items.Keys); 204Assert.DoesNotContain("prompt", stateProperties.Items.Keys); 205Assert.DoesNotContain("login_hint", stateProperties.Items.Keys); 252Assert.DoesNotContain("scope", stateProperties.Items.Keys); 253Assert.DoesNotContain("access_type", stateProperties.Items.Keys); 254Assert.DoesNotContain("include_granted_scopes", stateProperties.Items.Keys); 255Assert.DoesNotContain("approval_prompt", stateProperties.Items.Keys); 256Assert.DoesNotContain("prompt", stateProperties.Items.Keys); 257Assert.DoesNotContain("login_hint", stateProperties.Items.Keys); 308Assert.DoesNotContain("scope", stateProperties.Items.Keys); 309Assert.DoesNotContain("access_type", stateProperties.Items.Keys); 310Assert.DoesNotContain("include_granted_scopes", stateProperties.Items.Keys); 311Assert.DoesNotContain("approval_prompt", stateProperties.Items.Keys); 312Assert.DoesNotContain("prompt", stateProperties.Items.Keys); 313Assert.DoesNotContain("login_hint", stateProperties.Items.Keys); 551properties.Items.Add(correlationKey, correlationValue); 617properties.Items.Add(correlationKey, correlationValue); 670properties.Items.Add(correlationKey, correlationValue); 714properties.Items.Add(correlationKey, correlationValue); 755properties.Items.Add(correlationKey, correlationValue); 799properties.Items.Add(correlationKey, correlationValue); 875properties.Items.Add(correlationKey, correlationValue); 919properties.Items.Add(correlationKey, correlationValue); 963properties.Items.Add(correlationKey, correlationValue); 1000properties.Items.Add(correlationKey, correlationValue);
MicrosoftAccountTests.cs (6)
236properties.Items.Add(correlationKey, correlationValue); 279Assert.DoesNotContain("scope", stateProperties.Items.Keys); 280Assert.DoesNotContain("domain_hint", stateProperties.Items.Keys); 281Assert.DoesNotContain("login_hint", stateProperties.Items.Keys); 282Assert.DoesNotContain("prompt", stateProperties.Items.Keys); 283Assert.DoesNotContain("response_mode", stateProperties.Items.Keys);
OAuthTests.cs (3)
336Assert.Equal("testvalue", context.Properties.Items["testkey"]); 372Assert.Equal("testvalue", context.Properties.Items["testkey"]); 408Assert.Equal("testvalue", context.Properties.Items["testkey"]);
OpenIdConnect\OpenIdConnectChallengeTests.cs (4)
188properties.Items.Add(OpenIdConnectDefaults.UserstatePropertiesKey, userState); 201Assert.Equal(userState ?? string.Empty, actualProperties.Items[OpenIdConnectDefaults.UserstatePropertiesKey]); 238Assert.Equal(userState, actualProperties.Items[OpenIdConnectDefaults.UserstatePropertiesKey]); 242Assert.False(actualProperties.Items.ContainsKey(OpenIdConnectDefaults.UserstatePropertiesKey));
OpenIdConnect\OpenIdConnectEventTests.cs (2)
815Assert.Equal("testvalue", context.Properties.Items["testkey"]); 886Assert.Equal("testvalue", context.Properties.Items["testkey"]);
OpenIdConnect\OpenIdConnectEventTests_Handler.cs (2)
815Assert.Equal("testvalue", context.Properties.Items["testkey"]); 886Assert.Equal("testvalue", context.Properties.Items["testkey"]);
TwitterTests.cs (7)
203properties.Items["testkey"] = "testvalue"; 243Assert.Equal("testvalue", context.Properties.Items["testkey"]); 253properties.Items["testkey"] = "testvalue"; 349Assert.Equal("testvalue", context.Properties.Items["testkey"]); 359properties.Items["testkey"] = "testvalue"; 424token.Properties.Items.Add(correlationKey, correlationValue); 503token.Properties.Items.Add(correlationKey, correlationValue);
Microsoft.AspNetCore.Authentication.WsFederation (3)
WsFederationHandler.cs (3)
131properties.Items[WsFederationDefaults.UserstatePropertiesKey] = wsFederationMessage.Wctx; 197properties.Items.TryGetValue(WsFederationDefaults.UserstatePropertiesKey, out var userState); 214if (properties.Items.TryGetValue(CorrelationProperty, out string? correlationId)
Microsoft.AspNetCore.Identity (3)
SignInManager.cs (3)
690var items = auth?.Properties?.Items; 760properties.Items[LoginProviderKey] = provider; 763properties.Items[XsrfKey] = userId;
Microsoft.AspNetCore.Identity.InMemory.Test (1)
FunctionalTest.cs (1)
416xml.Add(result.Properties.Items.Select(extra => new XElement("extra", new XAttribute("type", extra.Key), new XAttribute("value", extra.Value))));
Microsoft.AspNetCore.Identity.Test (5)
SignInManagerTest.cs (5)
1040properties.Items["LoginProvider"] = "blah"; 1071properties.Items["LoginProvider"] = "blah"; 1102properties.Items["LoginProvider"] = "blah"; 1103properties.Items["CustomValue"] = "fizzbuzz"; 1119var customValue = externalProperties?.Items["CustomValue"];
SocialSample (1)
Startup.cs (1)
225foreach (var pair in context.Properties.Items)