public async Task <T> AuthApp(AuthResultAddressModel model, bool isPersistent = false) { var openId = await OAuthService.CodeToOpenIdAsync(model.code, await AppsContainer.AccessToken()()); var userinfo = await OAuthService.OpenIdToUserInfo(AccessToken : await AppsContainer.AccessToken()(), openid : openId.openid); var current = await _userManager.FindByIdAsync(userinfo.User.Id); if (current == null) { current = new T(); current.Update(userinfo); var result = await _userManager.CreateAsync(current); if (!result.Succeeded) { var message = new StringBuilder(); foreach (var error in result.Errors) { message.AppendLine(error.Description); } throw new InvalidOperationException($"The user info ({userinfo.User.Id}) we get could not register to our database because {message}."); } } else { current.Update(userinfo); await _userManager.UpdateAsync(current); } await _signInManager.SignInAsync(current, isPersistent); return(current); }
public StorageService( OSSApiService ossApiService, AppsContainer appsContainer) { _ossApiService = ossApiService; _appsContainer = appsContainer; }
public UrlConverter( ServiceLocation serviceLocation, AppsContainer appsContainer) { _serviceLocation = serviceLocation; _appsContainer = appsContainer; }
public StorageService( OSSApiService ossApiService, AppsContainer appsContainer, FilesService filesService) { _ossApiService = ossApiService; _appsContainer = appsContainer; _filesService = filesService; }
public AuthService( UserManager <T> userManager, SignInManager <T> signInManager, AccountService accountService, AppsContainer appsContainer) { _userManager = userManager; _signInManager = signInManager; _accountService = accountService; _appsContainer = appsContainer; }
public StorageService( OSSApiService ossApiService, AppsContainer appsContainer, FilesService filesService, ServiceLocation serviceLocation) { _ossApiService = ossApiService; _appsContainer = appsContainer; _filesService = filesService; _serviceLocation = serviceLocation; }
public AuthService( UserManager <T> userManager, SignInManager <T> signInManager, OAuthService oauthService, AppsContainer appsContainer) { _userManager = userManager; _signInManager = signInManager; _oauthService = oauthService; _appsContainer = appsContainer; }
public AiurEmailSender( IConfiguration configuration, ILogger <AiurEmailSender> logger, AppsContainer appsContainer, EventService eventService) { _mailUser = configuration["MailUser"]; _mailPassword = configuration["MailPassword"]; _mailServer = configuration["MailServer"]; _logger = logger; _appsContainer = appsContainer; _eventService = eventService; }
public static async Task <string> SaveToOSS(IFormFile file, int BucketId, int AliveDays, SaveFileOptions options = SaveFileOptions.RandomName, string AccessToken = null, string name = "", bool deleteLocal = true) { string localFilePath = await _SaveLocally(file, options, name); if (AccessToken == null) { AccessToken = await AppsContainer.AccessToken()(); } var fileAddress = await ApiService.UploadFile(AccessToken, BucketId, localFilePath, AliveDays); if (deleteLocal) { File.Delete(localFilePath); } return(fileAddress.Path); }