/// <summary> /// Multi-user application constructor, using user-level OAuth2 /// </summary> /// <param name="accessToken">Your Vimeo API Access Token</param> public VimeoClient(string clientId, string clientSecret) : this() { ClientId = clientId; ClientSecret = clientSecret; OAuth2Client = new AuthorizationClient(ClientId, ClientSecret); }
private void InitializeFakeObjects() { _httpClientFactoryStub = new Mock<IHttpClientFactory>(); _policyClient = new PolicyClient(new AddPolicyOperation(_httpClientFactoryStub.Object), new GetPolicyOperation(_httpClientFactoryStub.Object), new DeletePolicyOperation(_httpClientFactoryStub.Object), new GetPoliciesOperation(_httpClientFactoryStub.Object), new AddResourceToPolicyOperation(_httpClientFactoryStub.Object), new DeleteResourceFromPolicyOperation(_httpClientFactoryStub.Object), new UpdatePolicyOperation(_httpClientFactoryStub.Object), new GetConfigurationOperation(_httpClientFactoryStub.Object)); _resourceSetClient = new ResourceSetClient(new AddResourceSetOperation(_httpClientFactoryStub.Object), new DeleteResourceSetOperation(_httpClientFactoryStub.Object), new GetResourcesOperation(_httpClientFactoryStub.Object), new GetResourceOperation(_httpClientFactoryStub.Object), new UpdateResourceOperation(_httpClientFactoryStub.Object), new GetConfigurationOperation(_httpClientFactoryStub.Object)); _authorizationClient = new AuthorizationClient(new GetAuthorizationOperation(_httpClientFactoryStub.Object), new GetConfigurationOperation(_httpClientFactoryStub.Object)); _permissionClient = new PermissionClient( new AddPermissionsOperation(_httpClientFactoryStub.Object), new GetConfigurationOperation(_httpClientFactoryStub.Object)); _introspectionClient = new IntrospectionClient( new GetIntrospectionAction(_httpClientFactoryStub.Object), new GetIntrospectionsAction(_httpClientFactoryStub.Object), new GetConfigurationOperation(_httpClientFactoryStub.Object)); }
private void PrepAuthorizationClient() { if (OAuth2Client == null) { OAuth2Client = AuthClientFactory.GetAuthorizationClient(ClientId, ClientSecret); } }
/// <summary> /// Multi-user application constructor, using user-level OAuth2 /// </summary> /// <param name="clientId">ClientId</param> /// <param name="clientSecret">ClientSecret</param> public VimeoClient(string clientId, string clientSecret) : this() { ClientId = clientId; ClientSecret = clientSecret; OAuth2Client = new AuthorizationClient(ClientId, ClientSecret); }
public AuthorizeCommandHandler( IAuthorizationClient authorizationClient, ILogger <AuthorizeCommandHandler> logger) { _authorizationClient = authorizationClient; _logger = logger; }
public RegisterModel(ILogger <RegisterModel> logger, IEmailSender emailSender, IAuthorizationClient client, IBankClient bankClient) { _logger = logger; _emailSender = emailSender; _authorizationClient = client ?? throw new ArgumentNullException(nameof(client)); _bankClient = bankClient; }
public AuthorizationService(IAuthorizationClient authorizationClient, IOptions <AuthServiceSettings> authServiceSettings) { _authorizationClient = authorizationClient; if (authServiceSettings.Value != null) { _authorizationClient.ConfigureClient(authServiceSettings.Value.Url); } }
/// <summary> /// Constructor /// </summary> /// <param name="client"></param> /// <param name="optionsAccessor"></param> /// <param name="idProviderAccessor"></param> /// <param name="logger"></param> public AuthorizationHelper( IAuthorizationClient client, IOptions <AuthorizationClientOptions> optionsAccessor, IOptions <IdentityProviderOptions> idProviderAccessor, ILogger logger) { this.client = client; this.options = optionsAccessor.Value; this.idProviderOptions = idProviderAccessor.Value; this.logger = logger; }
public OnTagReadNotificationHandler( IMediator mediator, AccessPointState state, ILEDService ledService, IBuzzerService buzzerService, IAuthorizationClient authorizationClient, ILogger <OnTagReadNotificationHandler> logger) { _mediator = mediator; _state = state; _ledService = ledService; _buzzerService = buzzerService; _authorizationClient = authorizationClient; _logger = logger; }
private void InitializeFakeObjects() { _httpClientFactoryStub = new Mock <IHttpClientFactory>(); var getAuthorizationOperation = new GetAuthorizationOperation(_httpClientFactoryStub.Object); var getDiscoveryOperation = new GetDiscoveryOperation(_httpClientFactoryStub.Object); var postTokenOperation = new PostTokenOperation(_httpClientFactoryStub.Object); var introspectionOperation = new IntrospectOperation(_httpClientFactoryStub.Object); var revokeTokenOperation = new RevokeTokenOperation(_httpClientFactoryStub.Object); _authorizationClient = new AuthorizationClient(getAuthorizationOperation, getDiscoveryOperation); _clientAuthSelector = new ClientAuthSelector( new TokenClientFactory(postTokenOperation, getDiscoveryOperation), new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation), new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation)); }
private void InitializeFakeObjects() { var services = new ServiceCollection(); services.AddSimpleIdentityServerJwt(); var provider = services.BuildServiceProvider(); _jwsGenerator = (IJwsGenerator)provider.GetService(typeof(IJwsGenerator)); _jweGenerator = (IJweGenerator)provider.GetService(typeof(IJweGenerator)); _httpClientFactoryStub = new Mock <IHttpClientFactory>(); var getAuthorizationOperation = new GetAuthorizationOperation(_httpClientFactoryStub.Object); var getDiscoveryOperation = new GetDiscoveryOperation(_httpClientFactoryStub.Object); var postTokenOperation = new PostTokenOperation(_httpClientFactoryStub.Object); var introspectionOperation = new IntrospectOperation(_httpClientFactoryStub.Object); var revokeTokenOperation = new RevokeTokenOperation(_httpClientFactoryStub.Object); _authorizationClient = new AuthorizationClient(getAuthorizationOperation, getDiscoveryOperation); _clientAuthSelector = new ClientAuthSelector( new TokenClientFactory(postTokenOperation, getDiscoveryOperation), new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation), new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation)); }
/// <summary> /// Get User Access Token /// </summary> /// Gets a user access token /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='location'> /// Location. Possible values include: 'trial', 'westus2', 'northeurope', /// 'eastasia' /// </param> /// <param name='allowEdit'> /// Determines whether the token has write permissions /// </param> public static void GetUserAccessToken(this IAuthorizationClient operations, string location, bool?allowEdit = default(bool?)) { Task.Factory.StartNew(s => ((IAuthorizationClient)s).GetUserAccessTokenAsync(location, allowEdit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Get Video Access Token /// </summary> /// Gets a video access token /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='location'> /// Location. Possible values include: 'trial', 'westus2', 'northeurope', /// 'eastasia' /// </param> /// <param name='accountId'> /// The account id /// </param> /// <param name='videoId'> /// The video id /// </param> /// <param name='allowEdit'> /// Determines whether the token has write permissions /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task GetVideoAccessTokenAsync(this IAuthorizationClient operations, string location, string accountId, string videoId, bool?allowEdit = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { await operations.GetVideoAccessTokenWithHttpMessagesAsync(location, accountId, videoId, allowEdit, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Get Accounts /// </summary> /// Get Accounts /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='location'> /// Location. Possible values include: 'northeurope', 'westus2', 'eastasia', /// 'trial' /// </param> /// <param name='generateAccessTokens'> /// Whether to generate an access token for each account. Possible values /// include: 'true', 'false' /// </param> /// <param name='allowEdit'> /// Whether the tokens have write permissions. Possible values include: /// 'true', 'false' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task GetAccountsAsync(this IAuthorizationClient operations, string location, string generateAccessTokens = default(string), string allowEdit = default(string), CancellationToken cancellationToken = default(CancellationToken)) { await operations.GetAccountsWithHttpMessagesAsync(location, generateAccessTokens, allowEdit, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Get Accounts /// </summary> /// Get Accounts /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='location'> /// Location. Possible values include: 'northeurope', 'westus2', 'eastasia', /// 'trial' /// </param> /// <param name='generateAccessTokens'> /// Whether to generate an access token for each account. Possible values /// include: 'true', 'false' /// </param> /// <param name='allowEdit'> /// Whether the tokens have write permissions. Possible values include: /// 'true', 'false' /// </param> public static void GetAccounts(this IAuthorizationClient operations, string location, string generateAccessTokens = default(string), string allowEdit = default(string)) { Task.Factory.StartNew(s => ((IAuthorizationClient)s).GetAccountsAsync(location, generateAccessTokens, allowEdit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Returns the Login with Amazon (LWA) authorization code for an existing /// Amazon MWS authorization. /// </summary> /// <remarks> /// With the getAuthorizationCode operation, you can request a Login With /// Amazon (LWA) authorization code that will allow you to call a Selling /// Partner API on behalf of a seller who has already authorized you to call /// Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an /// MWS auth token, and a seller ID. Taken together, these represent the Amazon /// MWS authorization that the seller previously granted you. The operation /// returns an LWA authorization code that can be exchanged for a refresh token /// and access token representing authorization to call the Selling Partner API /// on the seller's behalf. By using this API, sellers who have already /// authorized you for Amazon MWS do not need to re-authorize you for the /// Selling Partner API. /// /// **Usage Plan:** /// /// | Rate (requests per second) | Burst | /// | ---- | ---- | /// | 1 | 5 | /// /// For more information, see "Usage Plans and Rate Limits" in the Selling /// Partner API documentation. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='sellingPartnerId'> /// The seller ID of the seller for whom you are requesting Selling Partner API /// authorization. This must be the seller ID of the seller who authorized your /// application on the Marketplace Appstore. /// </param> /// <param name='developerId'> /// Your developer ID. This must be one of the developer ID values that you /// provided when you registered your application in Developer Central. /// </param> /// <param name='mwsAuthToken'> /// The MWS Auth Token that was generated when the seller authorized your /// application on the Marketplace Appstore. /// </param> public static GetAuthorizationCodeResponse GetAuthorizationCode(this IAuthorizationClient operations, string sellingPartnerId, string developerId, string mwsAuthToken) { return(operations.GetAuthorizationCodeAsync(sellingPartnerId, developerId, mwsAuthToken).GetAwaiter().GetResult()); }
public RemotePolicyDecisionPoint(IAuthorizationClient authorizationClient) { this.authorizationClient = authorizationClient; }
public SignalRClient(IAuthorizationClient authorizationClient) { _authorizationClient = authorizationClient; }
/// <summary> /// Returns the Login with Amazon (LWA) authorization code for an existing /// Amazon MWS authorization. /// </summary> /// <remarks> /// With the getAuthorizationCode operation, you can request a Login With /// Amazon (LWA) authorization code that will allow you to call a Selling /// Partner API on behalf of a seller who has already authorized you to call /// Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an /// MWS auth token, and a seller ID. Taken together, these represent the Amazon /// MWS authorization that the seller previously granted you. The operation /// returns an LWA authorization code that can be exchanged for a refresh token /// and access token representing authorization to call the Selling Partner API /// on the seller's behalf. By using this API, sellers who have already /// authorized you for Amazon MWS do not need to re-authorize you for the /// Selling Partner API. /// /// **Usage Plan:** /// /// | Rate (requests per second) | Burst | /// | ---- | ---- | /// | 1 | 5 | /// /// For more information, see "Usage Plans and Rate Limits" in the Selling /// Partner API documentation. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='sellingPartnerId'> /// The seller ID of the seller for whom you are requesting Selling Partner API /// authorization. This must be the seller ID of the seller who authorized your /// application on the Marketplace Appstore. /// </param> /// <param name='developerId'> /// Your developer ID. This must be one of the developer ID values that you /// provided when you registered your application in Developer Central. /// </param> /// <param name='mwsAuthToken'> /// The MWS Auth Token that was generated when the seller authorized your /// application on the Marketplace Appstore. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GetAuthorizationCodeResponse> GetAuthorizationCodeAsync(this IAuthorizationClient operations, string sellingPartnerId, string developerId, string mwsAuthToken, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAuthorizationCodeWithHttpMessagesAsync(sellingPartnerId, developerId, mwsAuthToken, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public AuthorizationClientTests(Fixtures.AuthorizationClientFixture fixture) { _sut = fixture.AuthorizationClient; }
public SimpleAuthorizationService(IAuthorizationClient authorizationClient) { this.authorizationClient = authorizationClient; }
public LoginModel(ILogger <LoginModel> logger, IAuthorizationClient client) { _logger = logger; _authorizationClient = client ?? throw new ArgumentNullException(nameof(client)); }
private void PrepAuthorizationClient() { if (OAuth2Client == null) { OAuth2Client = _authClientFactory.GetAuthorizationClient(ClientId, ClientSecret); } }
public RegistryClient(HttpClient httpClient, IAuthorizationClient authorizationClient) : base(httpClient) { _authorizationClient = Guard.Argument(authorizationClient).NotNull().Value; }