public async Task <ExternalLoginResult> LoginWithProviderRequestAsync( IOwinEnvironment environment, IProviderAccountRequest providerRequest, CancellationToken cancellationToken) { var application = await _client.GetApplicationAsync(_configuration.Application.Href, cancellationToken); var result = await application.GetAccountAsync(providerRequest, cancellationToken); return(new ExternalLoginResult { Account = result.Account, IsNewAccount = result.IsNewAccount }); }
public IProviderAccountResult ResolveProviderAccount(string parentHref, IProviderAccountRequest request) { if (string.IsNullOrEmpty(parentHref)) { throw new ArgumentNullException(nameof(parentHref)); } var providerAccountAccess = this.BuildRequest(request); var href = $"{parentHref}/accounts"; // Do NOT store this result in the identity map, because IProviderAccountResult is really just a wrapper around an IAccount. // DefaultProviderAccountResult.OnUpdate does the work of taking the implied IAccount and instantiating it. return(this.dataStoreSync.Create <IProviderAccountAccess, IProviderAccountResult>( href, providerAccountAccess)); }
public IProviderAccountResult ResolveProviderAccount(string parentHref, IProviderAccountRequest request) { if (string.IsNullOrEmpty(parentHref)) { throw new ArgumentNullException(nameof(parentHref)); } var providerAccountAccess = this.BuildRequest(request); var href = $"{parentHref}/accounts"; // Do NOT store this result in the identity map, because IProviderAccountResult is really just a wrapper around an IAccount. // DefaultProviderAccountResult.OnUpdate does the work of taking the implied IAccount and instantiating it. return this.dataStoreSync.Create<IProviderAccountAccess, IProviderAccountResult>( href, providerAccountAccess); }
private IProviderAccountAccess BuildRequest(IProviderAccountRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (request.GetProviderData() == null) { throw new ArgumentNullException("ProviderData"); } var providerAccountAccess = this.dataStoreAsync.Instantiate<IProviderAccountAccess>(); providerAccountAccess.SetProviderData(request.GetProviderData()); return providerAccountAccess; }
private IProviderAccountAccess BuildRequest(IProviderAccountRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (request.GetProviderData() == null) { throw new ArgumentNullException("ProviderData"); } var providerAccountAccess = this.dataStoreAsync.Instantiate <IProviderAccountAccess>(); providerAccountAccess.SetProviderData(request.GetProviderData()); return(providerAccountAccess); }
/// <summary> /// Synchronously retrieves a Provider-based <see cref="IAccount">Account</see>. The account must exist in one of the Provider-based <see cref="Directory.IDirectory">Directory</see> /// assigned to the Application as an account store, and the Directory must also be <see cref="Directory.DirectoryStatus.Enabled">Enabled</see>. /// If not in an assigned account store, the retrieval attempt will fail. /// </summary> /// <param name="application">The application.</param> /// <param name="request"> /// The <see cref="IProviderAccountRequest"/> representing the Provider-specific account access data /// (e.g. an <c>accessToken</c>) used to verify the identity. /// </param> /// <returns>The result of the access request.</returns> /// <exception cref="Error.ResourceException">The access attempt failed.</exception> public static IProviderAccountResult GetAccount(this IApplication application, IProviderAccountRequest request) => (application as IApplicationSync).GetAccount(request);
Task<IProviderAccountResult> IApplication.GetAccountAsync(IProviderAccountRequest request, CancellationToken cancellationToken) => new ProviderAccountResolver(this.GetInternalAsyncDataStore()).ResolveProviderAccountAsync(this.AsInterface.Href, request, cancellationToken);
IProviderAccountResult IApplicationSync.GetAccount(IProviderAccountRequest request) => new ProviderAccountResolver(this.GetInternalSyncDataStore()).ResolveProviderAccount(this.AsInterface.Href, request);
Task <IProviderAccountResult> IApplication.GetAccountAsync(IProviderAccountRequest request, CancellationToken cancellationToken) => new ProviderAccountResolver(this.GetInternalAsyncDataStore()).ResolveProviderAccountAsync(this.AsInterface.Href, request, cancellationToken);