public PersonController(PersonSearch personSearch, PersonUpsert personUpsert, UserAccountGetByEmail userAccountGetByEmail, IAuthorizationService authorizationService) { _personSearch = personSearch; _personUpsert = personUpsert; _userAccountGetByEmail = userAccountGetByEmail; _authorizationService = authorizationService; }
public SiteAccountController(SiteAccountSearch siteAccountSearch, SiteAccountUpsert siteAccountUpsert, UserAccountGetByEmail userAccountGetByEmail, IAuthorizationService authorizationService) { _siteAccountSearch = siteAccountSearch; _siteAccountUpsert = siteAccountUpsert; _userAccountGetByEmail = userAccountGetByEmail; _authorizationService = authorizationService; }
public PostController(PostGetBySiteAccountName postGetBySiteAccountName, PostGetBySiteAccountID postGetBySiteAccountID, PostUpsert postUpsert, PostDelete postDelete, UserAccountGetByEmail userAccountGetByEmail, IAuthorizationService authorizationService) { _postGetBySiteAccountName = postGetBySiteAccountName; _postGetBySiteAccountID = postGetBySiteAccountID; _postUpsert = postUpsert; _postDelete = postDelete; _userAccountGetByEmail = userAccountGetByEmail; _authorizationService = authorizationService; }
public UserAccountController(UserAccountGetByUsername userAccountGetByUsername, UserAccountUpsert userAccountUpsert, UserAccountGetByEmail userAccountGetByEmail, UserAccountGetByID userAccountGetByID, UserAccountSearch userAccountSearch, IAuthorizationService authorizationService) { _userAccountGetByUsername = userAccountGetByUsername; _userAccountUpsert = userAccountUpsert; _userAccountGetByEmail = userAccountGetByEmail; _userAccountGetByID = userAccountGetByID; _authorizationService = authorizationService; _userAccountSearch = userAccountSearch; }
public AuthController(IMemoryCache cache, UserAccountGetByEmail userAccountGetByEmail) { _cache = cache; _userAccountGetByEmail = userAccountGetByEmail; }
public SiteAccountHub(UserAccountGetByEmail userAccountGetByEmail) { _userAccountGetByEmail = userAccountGetByEmail; }
public static Func <OAuthCreatingTicketContext, Task> New(AuthenticationProvider provider) { async Task CreateTask(OAuthCreatingTicketContext context) { // Create the request for user data var request = new HttpRequestMessage(HttpMethod.Get, context.Options.UserInformationEndpoint); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); // Send Request and get response var response = await context.Backchannel.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.HttpContext.RequestAborted); JObject contentJObject = JObject.Parse(await response.Content.ReadAsStringAsync()); UserAccount userAccount = new UserAccount(); // Parse the response for the email, names, and avatar url switch (provider) { case AuthenticationProvider.Github: userAccount.AddGitHubEmailAddress(contentJObject); break; case AuthenticationProvider.Google: userAccount.AddGoogleEmail(contentJObject) .AddGoogleNames(contentJObject) .AddGoogleAvatarLink(contentJObject); break; } // If an Email wasnt parsed fail out if (string.IsNullOrEmpty(userAccount.EmailAddress)) { context.Fail("No Email Provided."); return; } // Check for existing user. Create if not exists. update. UserAccountGetByEmail userAccountGetByEmail = new UserAccountGetByEmail(new IPManDataContext(ConfigurationService.Configuration)); UserAccountUpsert userAccountUpsert = new UserAccountUpsert(new IPManDataContext(ConfigurationService.Configuration)); UserAccount preExistingUser = await userAccountGetByEmail.ExecuteAsync(userAccount.EmailAddress, true); if (preExistingUser == null) { userAccount.AddCreatedData(); } else { userAccount = preExistingUser; } userAccount.AddLoginData(provider); await userAccountUpsert.ExecuteAsync(userAccount, preExistingUser == null); context.Identity.AddClaim(new Claim("TempSalt", userAccount.UserAccountSalt)); context.Success(); } return(CreateTask); }