コード例 #1
0
 public void ThrowsIfArgumentsAreInvalid(
     ITokenProviderFactory factory,
     IOptions <SSOSettings> options,
     string expected)
 {
     // Arrange/Act/Assert
     var ex = Assert.Throws <ArgumentNullException>(expected, () => new SSOManager(factory, options));
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileSecurityClient"/> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client to use. The caller is expected to manage this resource and it will not be disposed.</param>
 /// <param name="tokenProviderFactory">The Logic access token provider factory.</param>
 /// <param name="options">The required configuration options.</param>
 public FileSecurityClient(
     HttpClient httpClient,
     ITokenProviderFactory tokenProviderFactory,
     FileSecurityOptions options)
 {
     this.httpClient           = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     this.options              = options ?? throw new ArgumentNullException(nameof(options));
     this.tokenProviderFactory = tokenProviderFactory ?? throw new ArgumentNullException(nameof(tokenProviderFactory));
 }
コード例 #3
0
ファイル: SSOService.cs プロジェクト: wolf8196/Portunus
        internal SSOService(ITokenProviderFactory factory, SSOTargetSettings targetSettings)
        {
            settings = targetSettings.ThrowIfNull(nameof(settings));

            settings.AppName.ThrowIfNullOrEmpty(nameof(settings.AppName));
            settings.AuthenticationUrlTemplate.ThrowIfNullOrEmpty(nameof(settings.AuthenticationUrlTemplate));
            settings.TokenProviderSettings.ThrowIfNull(nameof(settings.TokenProviderSettings));

            tokenProvider = factory.Create(settings.TokenProviderSettings);
        }
コード例 #4
0
        public SSOManager(ITokenProviderFactory factory, IOptions <SSOSettings> options)
        {
            factory.ThrowIfNull(nameof(factory));
            settings = options.ThrowIfNull(nameof(options)).Value;
            settings.ThrowIfNull(nameof(settings));

            ssoServices = new Dictionary <string, SSOService>();

            foreach (var app in settings.Apps)
            {
                var ssoService = new SSOService(factory, app);
                ssoServices.Add(app.AppName.ToLower(), ssoService);
            }
        }
        public SecureWebApiConfiguration(ITokenProviderFactory tokenProviderFactory)
        {
            if (this.TokenProviderType == null)
            {
                throw new ArgumentNullException("TokenProviderType");
            }

            try
            {
                this.TokenProvider = tokenProviderFactory.Create(this.TokenProviderType);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Failed to create token provider of type '{0}'", this.TokenProviderType.FullName), ex);
            }
        }
コード例 #6
0
 public LoginRequestHandler(ITokenProviderFactory tokenProviderFactory, IUserRepository userRepository)
 {
     _tokenFactory   = tokenProviderFactory.GetTokenFactory(TokenConfiguration.TokenProvider);
     _userRepository = userRepository;
 }
コード例 #7
0
 public SecureWebApiAppSettingsConfiguration(ITokenProviderFactory tokenProviderFactory)
     : base(tokenProviderFactory)
 {
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CprClient"/> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client to use. The caller is expected to manage this resource and it will not be disposed.</param>
 /// <param name="tokenProviderFactory">The Logic access token provider factory.</param>
 /// <param name="options">The required configuration options.</param>
 public CprClient(HttpClient httpClient, ITokenProviderFactory tokenProviderFactory, CprOptions options)
 {
     this._httpClient           = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     this._options              = options ?? throw new ArgumentNullException(nameof(options));
     this._tokenProviderFactory = tokenProviderFactory ?? throw new ArgumentNullException(nameof(tokenProviderFactory));
 }
コード例 #9
0
 public AuthorizationHandler(ITokenProviderFactory tokenProviderFactory, ITokenFlowRegister tokenFlowRegister)
 {
     this.tokenProviderFactory = tokenProviderFactory;
     this.tokenFlowRegister    = tokenFlowRegister;
 }