public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties) { var defaultScheme = await _schemes.GetDefaultSignInSchemeAsync(); var cookieScheme = await context.GetCookieAuthenticationSchemeAsync(); if ((scheme == null && defaultScheme?.Name == cookieScheme) || scheme == cookieScheme) { AugmentPrincipal(principal); if (properties == null) { properties = new AuthenticationProperties(); } properties.Items[IdentityConstants.AuthenticationProperties.Ip] = context.GetRequestIp(); if (!properties.Items.ContainsKey(IdentityConstants.AuthenticationProperties.SkipCreateSession)) { var userDevice = context .GetHeaderValueAs <string>("User-Agent") .GetDevice(); if (!string.IsNullOrEmpty(userDevice)) { properties.Items[IdentityConstants.AuthenticationProperties.Device] = userDevice; } } await _session.CreateSessionIdAsync(principal, properties); } await _inner.SignInAsync(context, scheme, principal, properties); }
public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties) { var defaultScheme = await _schemes.GetDefaultSignInSchemeAsync(); var cookieScheme = await context.GetCookieAuthenticationSchemeAsync(); if ((scheme == null && defaultScheme?.Name == cookieScheme) || scheme == cookieScheme) { AugmentPrincipal(principal); properties ??= new AuthenticationProperties(); await _session.CreateSessionIdAsync(principal, properties); } await _inner.SignInAsync(context, scheme, principal, properties); }
public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties) { var defaultScheme = await _schemes.GetDefaultSignInSchemeAsync(); if (scheme == null || scheme == defaultScheme.Name) { AugmentPrincipal(principal); if (properties == null) { properties = new AuthenticationProperties(); } await _session.CreateSessionIdAsync(principal, properties); } await _inner.SignInAsync(context, scheme, principal, properties); }
public Task CreateSessionIdAsync(ClaimsPrincipal principal, AuthenticationProperties properties) { return(_inner.CreateSessionIdAsync(principal, properties)); }