Exemplo n.º 1
0
 public IdentityClient(
     HttpClient httpClient,
     OAuthConfiguration oAuthConfiguration)
 {
     _httpClient         = httpClient;
     _oAuthConfiguration = oAuthConfiguration;
 }
Exemplo n.º 2
0
 public OAuthClient(
     OAuthConfiguration oAuthConfiguration,
     HttpClient httpClient)
 {
     _oAuthConfiguration = oAuthConfiguration;
     _httpClient         = httpClient;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeycloakOAuthValidator"/> <see langword="class"/>.
 /// </summary>
 /// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> for the <see cref="GenericOAuthValidator"/>.</param>
 /// <param name="assemblyInformationProvider">The <see cref="IAssemblyInformationProvider"/> for the <see cref="GenericOAuthValidator"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="GenericOAuthValidator"/>.</param>
 /// <param name="oAuthConfiguration">The <see cref="OAuthConfiguration"/> for the <see cref="GenericOAuthValidator"/>.</param>
 public KeycloakOAuthValidator(
     IHttpClientFactory httpClientFactory,
     IAssemblyInformationProvider assemblyInformationProvider,
     ILogger <KeycloakOAuthValidator> logger,
     OAuthConfiguration oAuthConfiguration)
     : base(httpClientFactory, assemblyInformationProvider, logger, oAuthConfiguration)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="OAuthTokenRequest"/> <see langword="class"/>.
        /// </summary>
        /// <param name="oAuthConfiguration">The <see cref="OAuthConfiguration"/> to build from.</param>
        /// <param name="code">The value of <see cref="Code"/>.</param>
        /// <param name="scope">The value of <see cref="Scope"/></param>
        public OAuthTokenRequest(OAuthConfiguration oAuthConfiguration, string code, string scope)
            : base(oAuthConfiguration)
        {
            Code  = code ?? throw new ArgumentNullException(nameof(code));
            Scope = scope ?? throw new ArgumentNullException(nameof(scope));

            RedirectUri = oAuthConfiguration.RedirectUrl;
            GrantType   = "authorization_code";
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GitHubOAuthValidator"/> class.
 /// </summary>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
 /// <param name="logger">The value of <see cref="logger"/>.</param>
 /// <param name="oAuthConfiguration">The value of <see cref="oAuthConfiguration"/>.</param>
 public GitHubOAuthValidator(
     IGitHubClientFactory gitHubClientFactory,
     ILogger <GitHubOAuthValidator> logger,
     OAuthConfiguration oAuthConfiguration)
 {
     this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     this.oAuthConfiguration = oAuthConfiguration ?? throw new ArgumentNullException(nameof(oAuthConfiguration));
 }
Exemplo n.º 6
0
 public IdentityService(
     HttpClient httpClient,
     OAuthConfiguration oAuthConfiguration,
     ICacheManager <string> tokenCache)
 {
     _httpClient         = httpClient;
     _oAuthConfiguration = oAuthConfiguration;
     _tokenCache         = tokenCache;
 }
Exemplo n.º 7
0
        public void PostInit()
        {
            CheckDirectoryPermissions();

            FilterActiveBundles();

            OAuth = new OAuthConfiguration(ServerUrl);
            OAuth.Initialize(Settings);
        }
Exemplo n.º 8
0
 public AccountController(IOptions <JwtBearerAuthenticationOptions> authenticationOptions,
                          OAuthConfiguration oAuthConfiguration,
                          IHttpClientFactory clientFactory, IUserService userService, UserManager <ApplicationUser> i)
 {
     _authenticationOptions = authenticationOptions.Value;
     _oAuthConfiguration    = oAuthConfiguration;
     _clientFactory         = clientFactory;
     _userService           = userService;
 }
Exemplo n.º 9
0
 public AccountController(UserManager <ApplicationUser> userManager,
                          SignInManager <ApplicationUser> signInManager,
                          IOptions <JwtBearerAuthenticationOptions> authenticationOptions,
                          OAuthConfiguration oAuthConfiguration)
 {
     _userManager           = userManager;
     _signInManager         = signInManager;
     _authenticationOptions = authenticationOptions.Value;
     _oAuthConfiguration    = oAuthConfiguration;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericOAuthValidator"/> <see langword="class"/>.
 /// </summary>
 /// <param name="httpClientFactory">The value of <see cref="httpClientFactory"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="logger">The value of <see cref="Logger"/>.</param>
 /// <param name="oAuthConfiguration">The value of <see cref="OAuthConfiguration"/>.</param>
 public BaseOAuthValidator(
     IHttpClientFactory httpClientFactory,
     IAssemblyInformationProvider assemblyInformationProvider,
     ILogger <BaseOAuthValidator> logger,
     OAuthConfiguration oAuthConfiguration)
 {
     this.httpClientFactory           = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     Logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     OAuthConfiguration = oAuthConfiguration ?? throw new ArgumentNullException(nameof(oAuthConfiguration));
 }
Exemplo n.º 11
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddControllers();
     services.AddDbContext <DataContext>(d => d.UseSqlite(Configuration.GetConnectionString("DefConnection")));
     services.AddCors();
     services.AddAutoMapper(typeof(AuthRepository).Assembly);
     services.AddScoped <IAuthRepository, AuthRepository>();
     services.AddAuthentication()
     .AddOAuth("GitHub",
               options => OAuthConfiguration.SetOAuth2Options(options)
               );
 }
 public SendResetPasswordLinkCommandHandler(
     ICaptchaService captchaService,
     IPublishEndpoint publishEndpoint,
     IIdentityService identityService,
     IQueryProcessor queryProcessor,
     OAuthConfiguration oAuthConfiguration)
 {
     _captchaService     = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _publishEndpoint    = publishEndpoint ?? throw new ArgumentNullException(nameof(publishEndpoint));
     _identityService    = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _queryProcessor     = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
     _oAuthConfiguration = oAuthConfiguration;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TGForumsOAuthValidator"/> <see langword="class"/>.
 /// </summary>
 /// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> for the <see cref="BaseOAuthValidator"/></param>
 /// <param name="assemblyInformationProvider">The <see cref="IAssemblyInformationProvider"/> for the <see cref="BaseOAuthValidator"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="BaseOAuthValidator"/></param>
 /// <param name="oAuthConfiguration">The <see cref="OAuthConfiguration"/> for the <see cref="BaseOAuthValidator"/>.</param>
 public TGForumsOAuthValidator(
     IHttpClientFactory httpClientFactory,
     IAssemblyInformationProvider assemblyInformationProvider,
     ILogger <TGForumsOAuthValidator> logger,
     OAuthConfiguration oAuthConfiguration)
     : base(
         httpClientFactory,
         assemblyInformationProvider,
         logger,
         oAuthConfiguration)
 {
     sessions = new List <Tuple <TGCreateSessionResponse, DateTimeOffset> >();
 }
 public SendResetPasswordLinkCommandHandler(
     ICaptchaService captchaService,
     IBus bus,
     IIdentityClient identityClient,
     IQueryProcessor queryProcessor,
     OAuthConfiguration oAuthConfiguration)
 {
     _captchaService     = captchaService ?? throw new ArgumentNullException(nameof(captchaService));
     _bus                = bus ?? throw new ArgumentNullException(nameof(bus));
     _identityClient     = identityClient ?? throw new ArgumentNullException(nameof(identityClient));
     _queryProcessor     = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
     _oAuthConfiguration = oAuthConfiguration;
 }
Exemplo n.º 15
0
        protected AzureDevOpsOAuthConfigs()
        {
            AuthConfig                    = new OAuthConfiguration();
            AuthConfig.AuthType           = ConfigurationManager.AppSettings["AuthType"];
            AuthConfig.Environment        = ConfigurationManager.AppSettings["Environment"];
            AuthConfig.AzureDevOpsBaseUrl = ConfigurationManager.AppSettings["AzureDevOpsBaseUrl"];
            //if (AuthConfig.AuthType == Constants.BasicAuthentication)
            //{

            AuthConfig.AzureDevOpsParams         = ConfigurationManager.AppSettings["AzureDevOpsParams"];
            AuthConfig.AzureDevOpsClientId       = ConfigurationManager.AppSettings["AzureDevOpsClientId"];
            AuthConfig.AzureDevOpsScope          = ConfigurationManager.AppSettings["AzureDevOpsScope"];
            AuthConfig.AzureDevOpsRedirectionUri = ConfigurationManager.AppSettings["AzureDevOpsRedirectionUri"];
            AuthConfig.AzureDevOpsReponseState   = ConfigurationManager.AppSettings["AzureDevOpsReponseState"];
            AuthConfig.AzureDevOpsReponseType    = ConfigurationManager.AppSettings["AzureDevOpsReponseType"];
            AuthConfig.AccessTokenParams         = ConfigurationManager.AppSettings["AccessTokenParams"];
            AuthConfig.AzureDevOpsAppSecret      = ConfigurationManager.AppSettings["AzureDevOpsAppSecret"];
            AuthConfig.TempScope = ConfigurationManager.AppSettings["TempScope"];
            //AuthConfig.AuthType = ConfigurationManager.AppSettings["AuthType"];
            //  AuthConfig.Environment = ConfigurationManager.AppSettings["Environment"];
            //}
        }
Exemplo n.º 16
0
 public OAuthController(IOptions <OAuthConfiguration> oAuthConfigOptions)
 {
     _oAuthConfig = oAuthConfigOptions.Value;
 }