/// <summary> /// Initializes a new instance of the <see cref="FindGifs"/> class. /// </summary> /// <param name="accountStore"> /// The account store. /// </param> public FindGifs(IAccountStore accountStore) { this.accountStore = accountStore; this.InitializeComponent(); this.viewModel = this.DataContext as FindGifViewModel; }
public UsernamePasswordRequest(string username, string password, IAccountStore accountStore, string organizationNameKey) { this.username = username; this.password = password; this.accountStore = accountStore; this.organizationNameKey = organizationNameKey; }
public AcmeCertificateFactory( AcmeClientFactory acmeClientFactory, TermsOfServiceChecker tosChecker, IOptions <LettuceEncryptOptions> options, IHttpChallengeResponseStore challengeStore, IAccountStore?accountRepository, ILogger <AcmeCertificateFactory> logger, IHostApplicationLifetime appLifetime, ICertificateAuthorityConfiguration certificateAuthority) { _acmeClientFactory = acmeClientFactory; _tosChecker = tosChecker; _options = options; _challengeStore = challengeStore; _logger = logger; _appStarted = new TaskCompletionSource <object?>(); appLifetime.ApplicationStarted.Register(() => _appStarted.TrySetResult(null)); if (appLifetime.ApplicationStarted.IsCancellationRequested) { _appStarted.TrySetResult(null); } _accountRepository = accountRepository ?? new FileSystemAccountStore(logger, certificateAuthority); }
public CertificateFactory( TermsOfServiceChecker tosChecker, IOptions <LetsEncryptOptions> options, IHttpChallengeResponseStore challengeStore, IAccountStore?accountRepository, ILogger logger, IHostEnvironment env, IHostApplicationLifetime appLifetime, TlsAlpnChallengeResponder tlsAlpnChallengeResponder) { _tosChecker = tosChecker; _options = options; _challengeStore = challengeStore; _logger = logger; _tlsAlpnChallengeResponder = tlsAlpnChallengeResponder; _appStarted = new TaskCompletionSource <object?>(); appLifetime.ApplicationStarted.Register(() => _appStarted.TrySetResult(null)); if (appLifetime.ApplicationStarted.IsCancellationRequested) { _appStarted.TrySetResult(null); } _accountRepository = accountRepository ?? new FileSystemAccountStore(logger, options, env); AcmeServer = _options.Value.GetAcmeServer(env); }
public AccountManager(IAccountStore accountStore) { _accountStorePlugin = accountStore; _defaultPhoto.ContentType = "image/png"; _defaultPhoto.Fichier = File.ReadAllBytes("defaultPhoto.png"); _defaultPhoto.FileName = "defaultPhoto.png"; }
/// <summary> /// Initializes a new instance of the <see cref="Login"/> class. /// </summary> /// <param name="accountStore"> /// The account repository. /// </param> public Login(IAccountStore accountStore) { this.accountStore = accountStore; this.InitializeComponent(); this.viewModel = this.DataContext as LoginViewModel; }
public UsernamePasswordRequest(string username, string password, IAccountStore accountStore, string organizationNameKey) { this.username = username; this.password = password; this.accountStore = accountStore; this.organizationNameKey = organizationNameKey; }
/// <summary> /// Adds an Account Store to this resource based on the result of a query. /// </summary> /// <typeparam name="T">The Account Store type.</typeparam> /// <typeparam name="TMapping">The Account Store Mapping type.</typeparam> /// <param name="container">The Account Store container.</param> /// <param name="internalDataStore">The internal data store.</param> /// <param name="query">A query that selects a single Account Store.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The new <see cref="IAccountStoreMapping"/>.</returns> public static async Task <TMapping> AddAccountStoreAsync <T, TMapping>( IAccountStoreContainer <TMapping> container, IInternalAsyncDataStore internalDataStore, Func <IAsyncQueryable <T>, IAsyncQueryable <T> > query, CancellationToken cancellationToken) where TMapping : class, IAccountStoreMapping <TMapping> { if (query == null) { throw new ArgumentNullException(nameof(query)); } IAccountStore foundAccountStore = null; if (typeof(T) == typeof(IDirectory)) { var directoryQuery = query as Func <IAsyncQueryable <IDirectory>, IAsyncQueryable <IDirectory> >; foundAccountStore = await GetSingleTenantDirectoryAsync(container, directoryQuery, cancellationToken).ConfigureAwait(false); } else if (typeof(T) == typeof(IGroup)) { var groupQuery = query as Func <IAsyncQueryable <IGroup>, IAsyncQueryable <IGroup> >; foundAccountStore = await GetSingleTenantGroupAsync(container, groupQuery, cancellationToken).ConfigureAwait(false); } if (foundAccountStore != null) { return((TMapping) await AddAccountStoreAsync(container, internalDataStore, foundAccountStore, cancellationToken).ConfigureAwait(false)); } // No account store can be added return(null); }
public AccountService( IAccountStore store, AccountOptions options, ILogger <AccountService> logger, IIssuerService issuerService, IProfileService profileService, IMapper mapper, IHttpContextAccessor httpContextAccessor = null ) { _options = options; _logger = logger; _certStore = issuerService; _profileService = profileService ?? new DefaultProfileService(store, _options); _rand = new Random(); _store = store; Mapper = mapper; var http = httpContextAccessor?.HttpContext; string url = http is HttpContext ? $"{http.Request.Scheme}://{http.Request.Host.Value}{http.Request.PathBase}" : ""; _serviceUrl = options.Profile.ImageServerUrl ?? url + options.Profile.ImagePath; }
/// <summary> /// Synchronously adds an Account Store to this resource based on the result of a query. /// </summary> /// <typeparam name="T">The Account Store type.</typeparam> /// <typeparam name="TMapping">The Account Store Mapping type.</typeparam> /// <param name="container">The Account Store container.</param> /// <param name="internalDataStore">The internal data store.</param> /// <param name="query">A query that selects a single Account Store.</param> /// <returns>The new <see cref="IAccountStoreMapping"/>.</returns> public static TMapping AddAccountStore <T, TMapping>( IAccountStoreContainer <TMapping> container, IInternalSyncDataStore internalDataStore, Func <IQueryable <T>, IQueryable <T> > query) where TMapping : class, IAccountStoreMapping <TMapping> { if (query == null) { throw new ArgumentNullException(nameof(query)); } IAccountStore foundAccountStore = null; if (typeof(T) == typeof(IDirectory)) { var directoryQuery = query as Func <IQueryable <IDirectory>, IQueryable <IDirectory> >; foundAccountStore = GetSingleTenantDirectory(container, directoryQuery); } else if (typeof(T) == typeof(IGroup)) { var groupQuery = query as Func <IQueryable <IGroup>, IQueryable <IGroup> >; foundAccountStore = GetSingleTenantGroup(container, groupQuery); } if (foundAccountStore != null) { return(AddAccountStore(container, internalDataStore, foundAccountStore)); } // No account store can be added return(null); }
public void Creating_account_store_mapping(TestClientProvider clientBuilder) { var client = clientBuilder.GetClient(); var tenant = client.GetCurrentTenant(); var createdApplication = tenant.CreateApplication( $".NET IT {this.fixture.TestRunIdentifier} Adding AccountStore Directly Test Application (Sync)", createDirectory: false); createdApplication.Href.ShouldNotBeNullOrEmpty(); this.fixture.CreatedApplicationHrefs.Add(createdApplication.Href); IAccountStore directory = client.GetResource <IDirectory>(this.fixture.PrimaryDirectoryHref); var mapping = client.Instantiate <IAccountStoreMapping>(); mapping.SetAccountStore(directory); mapping.SetListIndex(500); createdApplication.CreateAccountStoreMapping(mapping); mapping.GetAccountStore().Href.ShouldBe(directory.Href); mapping.GetApplication().Href.ShouldBe(createdApplication.Href); mapping.IsDefaultAccountStore.ShouldBeFalse(); mapping.IsDefaultGroupStore.ShouldBeFalse(); mapping.ListIndex.ShouldBe(0); // Clean up createdApplication.Delete().ShouldBeTrue(); this.fixture.CreatedApplicationHrefs.Remove(createdApplication.Href); }
/// <summary> /// 判斷這個使用者是否已經通過了身分驗證 /// </summary> /// <returns></returns> public static async Task <Account> IsAlreadyAuthenticated() { // 取得 Prism 相依性服務使用到的容器 IUnityContainer fooContainer = (XFoAuth2.App.Current as PrismApplication).Container; // 取得 IAccountStore 介面實際實作的類別物件 IAccountStore fooIAccountStore = fooContainer.Resolve <IAccountStore>(); #region 若可以取得使用者認證的使用者資訊,表示,這個使用者已經通過認證了 if (fooIAccountStore.GetPlatform() == "UWP") { return(await fooIAccountStore.GetAccount()); } else { // Retrieve any stored account information var accounts = await AccountStore.Create().FindAccountsForServiceAsync(AppName); var account = accounts.FirstOrDefault(); // If we already have the account info then we are set if (account == null) { return(null); } return(account); } #endregion }
public async Task Creating_account_store_mapping(TestClientProvider clientBuilder) { var client = clientBuilder.GetClient(); var tenant = await client.GetCurrentTenantAsync(); var createdOrganization = client.Instantiate <IOrganization>() .SetName($".NET IT {this.fixture.TestRunIdentifier}-{clientBuilder.Name} Adding AccountStore Directly Test Organization") .SetNameKey($"dotnet-test4-{this.fixture.TestRunIdentifier}-{clientBuilder.Name}"); await tenant.CreateOrganizationAsync(createdOrganization, opt => opt.CreateDirectory = false); createdOrganization.Href.ShouldNotBeNullOrEmpty(); this.fixture.CreatedOrganizationHrefs.Add(createdOrganization.Href); IAccountStore directory = await client.GetResourceAsync <IDirectory>(this.fixture.PrimaryDirectoryHref); var mapping = client.Instantiate <IOrganizationAccountStoreMapping>(); mapping.SetAccountStore(directory); mapping.SetListIndex(500); await createdOrganization.CreateAccountStoreMappingAsync(mapping); (await mapping.GetAccountStoreAsync()).Href.ShouldBe(directory.Href); (await mapping.GetOrganizationAsync()).Href.ShouldBe(createdOrganization.Href); mapping.IsDefaultAccountStore.ShouldBeFalse(); mapping.IsDefaultGroupStore.ShouldBeFalse(); mapping.ListIndex.ShouldBe(0); // Clean up (await createdOrganization.DeleteAsync()).ShouldBeTrue(); this.fixture.CreatedOrganizationHrefs.Remove(createdOrganization.Href); }
public ValidationWorker(IOrderStore orderStore, IAccountStore accountStore, IChallangeValidatorFactory challangeValidatorFactory) { _orderStore = orderStore; _accountStore = accountStore; _challangeValidatorFactory = challangeValidatorFactory; }
public DelegatedClientStateStore(IAccountStore accountStore, IChallengeStore challengeStore, ICertStore certStore, ICertReader certReader) { _accountStore = accountStore; _challengeStore = challengeStore; _certStore = certStore; _certReader = certReader; }
public DefaultProfileService( IAccountStore store, AccountOptions options ) { _store = store; _options = options; }
/// <summary> /// Initializes a new instance of the <see cref="MainPage"/> class. /// </summary> /// <param name="accountStore"> /// The account repository. /// </param> public MainPage(IAccountStore accountStore) { this.InitializeComponent(); this.accountStore = accountStore; this.NavigationCacheMode = NavigationCacheMode.Required; }
public BuyStockCommand(BuyViewModel buyViewModel, IBuyStockService buyStockService, IAccountStore accountStore) { _buyViewModel = buyViewModel; _buyStockService = buyStockService; _accountStore = accountStore; _buyViewModel.PropertyChanged += BuyViewModel_PropertyChanged; }
public SellStockCommand(SellViewModel viewModel, ISellStockService sellStockService, IAccountStore accountStore) { _viewModel = viewModel; _sellStockService = sellStockService; _accountStore = accountStore; _viewModel.PropertyChanged += ViewModel_PropertyChanged; }
void ILoginAttempt.SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore.Href)); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); }
public Authenticator(IAuthenticationService authenticationService, IAccountStore accountStore) { _authenticationService = authenticationService; _accountStore = accountStore; }
public AccountController(IMapper mapper, IAccountStore accountStoreService, ICachingProvider cachingProvider, ILogger <AccountController> logger, IOptions <JWTConfig> jwtOptions) { _mapper = mapper; _accountStoreService = accountStoreService; _caching = cachingProvider.CreateCaching(); _logger = logger; _jwtConfig = jwtOptions.Value; }
Task<IPasswordResetToken> IApplication.SendPasswordResetEmailAsync(string email, IAccountStore accountStore, CancellationToken cancellationToken) { var token = this.GetInternalAsyncDataStore() .Instantiate<IPasswordResetToken>() as DefaultPasswordResetToken; token.SetEmail(email); token.SetAccountStore(accountStore); return this.GetInternalAsyncDataStore().CreateAsync(this.PasswordResetToken.Href, (IPasswordResetToken)token, cancellationToken); }
IPasswordResetToken IApplicationSync.SendPasswordResetEmail(string email, IAccountStore accountStore) { var token = this.GetInternalSyncDataStore() .Instantiate<IPasswordResetToken>() as DefaultPasswordResetToken; token.SetEmail(email); token.SetAccountStore(accountStore); return this.GetInternalSyncDataStore().Create(this.PasswordResetToken.Href, (IPasswordResetToken)token); }
void ILoginAttempt.SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore.Href)); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); }
protected AccountFactory(IAccountStore accountStore, int companyId) { if (accountStore == null) { throw new ArgumentNullException("accountStore"); } _accountStore = accountStore; _companyId = companyId; }
public IEmailVerificationRequest SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(accountStore.Href); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); return(this); }
IPasswordGrantRequestBuilder IPasswordGrantRequestBuilder.SetAccountStore(IAccountStore accountStore) { if (accountStore == null) { throw new ArgumentNullException(nameof(accountStore)); } this.accountStoreHref = accountStore.Href; return(this); }
public IPasswordResetToken SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore.Href)); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); return(this); }
IPasswordResetToken IApplicationSync.SendPasswordResetEmail(string email, IAccountStore accountStore) { var token = this.GetInternalSyncDataStore() .Instantiate <IPasswordResetToken>() as DefaultPasswordResetToken; token.SetEmail(email); token.SetAccountStore(accountStore); return(this.GetInternalSyncDataStore().Create(this.PasswordResetToken.Href, (IPasswordResetToken)token)); }
public IPasswordResetToken SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore.Href)); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); return this; }
public IEmailVerificationRequest SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(accountStore.Href); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); return this; }
T IAccountStoreMapping <T> .SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore.Href)); } this.SetLinkProperty(AccountStorePropertyName, accountStore.Href); return(this as T); }
public Database(string accountConnection, IAccountStore accountStore, string playerConnection, IPlayerStore playerStore, string guildConnection, IGuildStore guildStore) { _accountStore = accountStore; _playerStore = playerStore; _guildStore = guildStore; _accountStore.Connect(accountConnection); _playerStore.Connect(playerConnection); _guildStore.Connect(guildConnection); }
public AccountQuery(IAccountStore accountStore, IProfileStore profileStore, IAccountCache accountCache, IProfileCache profileCache) { Ensure.Any.IsNotNull(accountStore, nameof(accountStore)); Ensure.Any.IsNotNull(profileStore, nameof(profileStore)); Ensure.Any.IsNotNull(accountCache, nameof(accountCache)); Ensure.Any.IsNotNull(profileCache, nameof(profileCache)); _accountStore = accountStore; _profileStore = profileStore; _accountCache = accountCache; _profileCache = profileCache; }
public CertRenewer(ManagerConfig config, IAccountStore accountStore, IDnsChallengeHandler dnsHandler, ICertificateStore certStore, ILogger <CertRenewer> logger) { this.logger = logger; this.config = new CertRenewerConfig(config.CertContactEmail, config.CertificateAuthorityUrl); this.accountStore = accountStore; this.dnsHandler = dnsHandler; this.certStore = certStore; this.stopwatch = new Stopwatch(); }
public IList <AccountGroup> SelectGroups(IList <SelectorDefinition> selectors, IDictionary <int, List <RuleFilterDefinition> > dicFilters, RuleContext ruleContext) { IList <AccountGroup> collected = new List <AccountGroup>(); IList <SelectorDefinition> matchingSelectors = FindMatchingSelectors(selectors, dicFilters, ruleContext); IAccountStore accountStore = _accountManager.GetStore(); foreach (SelectorDefinition selectorDefinition in matchingSelectors) { collected.Add(accountStore.GetGroup(selectorDefinition.GroupId)); } return(collected); }
/// <summary> /// Sets the default Account or Group store. /// </summary> /// <typeparam name="T">The parent resource type.</typeparam> /// <typeparam name="TMapping">The Account Store Mapping type.</typeparam> /// <param name="parent">The parent resource.</param> /// <param name="store">The new default Account or Group store.</param> /// <param name="isAccountStore">Determines whether this store should be the default Account (<see langword="true"/>) or Group (<see langword="false"/>) Store.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public static async Task SetDefaultStoreAsync <T, TMapping>( ISaveable <T> parent, IAccountStore store, bool isAccountStore, CancellationToken cancellationToken) where T : IResource, IAccountStoreContainer <TMapping> where TMapping : class, IAccountStoreMapping <TMapping> { if (string.IsNullOrEmpty(store?.Href)) { throw new ArgumentNullException(nameof(store.Href)); } var container = parent as IAccountStoreContainer <TMapping>; if (parent == null) { throw new ApplicationException("SetDefaultStore must be used with a supported AccountStoreContainer."); } IAccountStoreMapping <TMapping> newOrExistingMapping = null; await container.GetAccountStoreMappings().ForEachAsync( mapping => { bool isPassedAccountStore = (mapping as AbstractAccountStoreMapping <TMapping>)?.AccountStore?.Href.Equals(store.Href) ?? false; if (isPassedAccountStore) { newOrExistingMapping = mapping; } return(newOrExistingMapping != null); // break if found }, cancellationToken).ConfigureAwait(false); if (newOrExistingMapping == null) { newOrExistingMapping = await container .AddAccountStoreAsync(store, cancellationToken).ConfigureAwait(false); } if (isAccountStore) { newOrExistingMapping.SetDefaultAccountStore(true); } else { newOrExistingMapping.SetDefaultGroupStore(true); } await newOrExistingMapping.SaveAsync(cancellationToken).ConfigureAwait(false); }
public AccountCommand(IPhotoCommand photoCommand, IProfileCommand profileCommand, IUserStore userStore, IAccountStore accountStore, IAccountCache cache) { Ensure.Any.IsNotNull(photoCommand, nameof(photoCommand)); Ensure.Any.IsNotNull(profileCommand, nameof(profileCommand)); Ensure.Any.IsNotNull(userStore, nameof(userStore)); Ensure.Any.IsNotNull(accountStore, nameof(accountStore)); Ensure.Any.IsNotNull(cache, nameof(cache)); _photoCommand = photoCommand; _profileCommand = profileCommand; _userStore = userStore; _accountStore = accountStore; _cache = cache; }
/// <summary> /// Sets the Account Store to use when locating the account. /// </summary> /// <param name="accountStore">The Account Store.</param> /// <returns>This instance for method chaining.</returns> public UsernamePasswordRequestBuilder SetAccountStore(IAccountStore accountStore) { if (string.IsNullOrEmpty(accountStore?.Href)) { throw new ArgumentNullException(nameof(accountStore)); } if (!string.IsNullOrEmpty(this.organizationNameKey)) { throw new ArgumentException("Cannot set both AccountStore and hrefOrNameKey properties."); } this.accountStore = accountStore; return this; }
/// <summary> /// Synchronously sends a password reset email to an account in the specified <see cref="IAccountStore">Account Store</see> matching /// the specified <paramref name="email"/>. If the email does not match an account in the specified /// <see cref="IAccountStore">Account Store</see>, a <see cref="Error.ResourceException"/> will be thrown. /// If you are unsure of which of the application's mapped account stores might contain the account, use the more general /// <see cref="SendPasswordResetEmail(IApplication, string)"/> method instead. /// The email will contain a password reset link that the user can click or copy into their browser address bar. /// </summary> /// <param name="application">The application.</param> /// <param name="email">An email address of an <see cref="IAccount">Account</see> that may login to the application.</param> /// <param name="accountStore">The AccountStore expected to contain an account with the specified email address.</param> /// <returns>A public static whose result is the created <see cref="IPasswordResetToken">Password Reset Token</see>. /// You can obtain the associated account via <see cref="SyncPasswordResetTokenExtensions.GetAccount(IPasswordResetToken)"/>.</returns> /// <exception cref="Error.ResourceException"> /// The specified <see cref="IAccountStore">Account Store</see> is not mapped to this application, or there is no account that matches the specified email address in the specified <paramref name="accountStore"/>. /// </exception> public static IPasswordResetToken SendPasswordResetEmail(this IApplication application, string email, IAccountStore accountStore) => (application as IApplicationSync).SendPasswordResetEmail(email, accountStore);
/// <summary> /// Initializes a new instance of the <see cref="Home"/> class. /// </summary> /// <param name="accountStore"> /// The account Store. /// </param> /// <param name="newSlapStore"> /// The new Slap Store. /// </param> /// <param name="subscriptionStore"> /// The subscription repository. /// </param> /// <param name="settingsStore"> /// The settings Store. /// </param> public Home(IAccountStore accountStore, INewSlapsStore newSlapStore, ISubscriptionStore subscriptionStore, ISettingsStore settingsStore) { this.accountStore = accountStore; this.newSlapStore = newSlapStore; this.subscriptionStore = subscriptionStore; this.settingsStore = settingsStore; this.InitializeComponent(); this.viewModel = this.DataContext as HomeViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="RegisterViewModel"/> class. /// </summary> /// <param name="accountStore"> /// The account store. /// </param> /// <param name="navigationService"> /// The navigation Service. /// </param> public RegisterViewModel(IAccountStore accountStore, INavigationService navigationService) { this.accountStore = accountStore; this.navigationService = navigationService; this.ExecuteButtonEnabled = true; }
void IPasswordGrantAuthenticationAttempt.SetAccountStore(IAccountStore accountStore) => this.SetProperty(AccountStoreHrefPropertyName, accountStore.Href);
/// <summary> /// Initializes a new instance of the <see cref="PasswordResetViewModel"/> class. /// </summary> /// <param name="accountStore"> /// The account Store. /// </param> /// <param name="navigationService"> /// The navigation Service. /// </param> public PasswordResetViewModel(IAccountStore accountStore, INavigationService navigationService) { this.accountStore = accountStore; this.navigationService = navigationService; this.ExecuteButtonEnabled = true; }