Exemple #1
0
 public AccessTokenService(HttpClient client, IAccessTokenStore accessTokenStore, IClientCredentials clientCredentials)
 {
     this.accessTokenStore  = accessTokenStore;
     this.clientCredentials = clientCredentials;
     this.client            = client;
     client.BaseAddress     = new Uri("https://localhost:5000/");
 }
 public AddOfficeDocumentAction(IOfficeDocumentRepository officeDocumentRepository, IIdentityServerUmaClientFactory identityServerUmaClientFactory, IAccessTokenStore accessTokenStore,
                                IAddDocumentParameterValidator addDocumentParameterValidator)
 {
     _officeDocumentRepository       = officeDocumentRepository;
     _identityServerUmaClientFactory = identityServerUmaClientFactory;
     _accessTokenStore = accessTokenStore;
     _addDocumentParameterValidator = addDocumentParameterValidator;
 }
Exemple #3
0
 public Authorizer(ITwitterApplicationCredentials applicationCredentials, 
     IAccessTokenStore accessTokenStore,
     Factories.UserFactory userFactory)
 {
     _applicationCredentials = applicationCredentials;
     _accessTokenStore = accessTokenStore;
     _userFactory = userFactory;
 }
 public OAuthHeaderHandler(
     IAccessTokenAccessor accessTokenAccessor,
     IAccessTokenStore accessTokenStore,
     IAccessTokenRefresher accessTokenRefresher = null)
 {
     _accessTokenAccessor  = accessTokenAccessor ?? throw new ArgumentNullException(nameof(accessTokenAccessor));
     _accessTokenStore     = accessTokenStore ?? throw new ArgumentNullException(nameof(accessTokenStore));
     _accessTokenRefresher = accessTokenRefresher;
 }
Exemple #5
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public PostConfigureTokenAuthenticationOptions(IAccessTokenStore accessTokenStore, IOptions <AccessTokenOptions> accessTokenOptions)
        {
            if (accessTokenOptions == null)
            {
                throw new ArgumentNullException(nameof(accessTokenOptions));
            }

            this.accessTokenStore   = accessTokenStore ?? throw new ArgumentNullException(nameof(accessTokenStore));
            this.accessTokenOptions = accessTokenOptions.Value;
        }
 public ValidateConfirmationLinkAction(IOfficeDocumentRepository officeDocumentRepository, IIdentityServerUmaClientFactory identityServerUmaClientFactory,
                                       IOfficeDocumentConfirmationLinkStore officeDocumentConfirmationLinkStore,
                                       IValidateConfirmationLinkParameterValidator validateConfirmationLinkParameterValidator, IAccessTokenStore tokenStore)
 {
     _officeDocumentRepository                   = officeDocumentRepository;
     _identityServerUmaClientFactory             = identityServerUmaClientFactory;
     _officeDocumentConfirmationLinkStore        = officeDocumentConfirmationLinkStore;
     _validateConfirmationLinkParameterValidator = validateConfirmationLinkParameterValidator;
     _tokenStore = tokenStore;
 }
Exemple #7
0
 public LoginCommandHandler(
     IStringLocalizer <LoginCommandHandler> stringLocalizer,
     MoneybirdApiConfiguration apiConfiguration,
     IAccessTokenAcquirer accessTokenAcquirer,
     IAccessTokenStore accessTokenStore)
 {
     _stringLocalizer     = stringLocalizer;
     _apiConfiguration    = apiConfiguration;
     _accessTokenAcquirer = accessTokenAcquirer;
     _accessTokenStore    = accessTokenStore;
 }
Exemple #8
0
        public OAuthDialog(IAccessTokenStore accessTokenStore, ITwitterApplicationCredentials applicationCredentials)
        {
            _accessTokenStore = accessTokenStore;
            _applicationCredentials = applicationCredentials;
            InitializeComponent();

            pinTextBox.Visibility = Visibility.Hidden;
            pinLbl.Visibility = Visibility.Hidden;
            pinInstruction.Visibility = Visibility.Hidden;

            _service = new TwitterService(_applicationCredentials.ConsumerKey,
                                          _applicationCredentials.ConsumerSecret);
        }
Exemple #9
0
        public OAuth2BearerTokenHandler(IAccessTokenStore tokenStore, IAccessTokenProvider tokenProvider)
        {
            if (tokenStore == null)
            {
                throw new ArgumentNullException("tokenStore");
            }
            if (tokenProvider == null)
            {
                throw new ArgumentNullException("tokenProvider");
            }

            this.TokenStore    = tokenStore;
            this.TokenProvider = tokenProvider;
        }
        public OAuth2BearerTokenHandler(IAccessTokenStore tokenStore, IAccessTokenProvider tokenProvider)
        {
            if (tokenStore == null)
            {
                throw new ArgumentNullException("tokenStore");
            }
            if (tokenProvider == null)
            {
                throw new ArgumentNullException("tokenProvider");
            }

            this.TokenStore = tokenStore;
            this.TokenProvider = tokenProvider;
        }
Exemple #11
0
        /// <summary>
        /// 执行用户登录
        /// </summary>
        /// <param name="context">Http上下文</param>
        /// <param name="accessTokenValue">访问令牌值</param>
        /// <returns></returns>
        public static string SignIn(this HttpContext context, string accessTokenValue)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (context.RequestServices == null)
            {
                throw new MissingMemberException("HttpContext.RequestServices is null");
            }

            IAccessTokenStore accessTokenStore = context.RequestServices.GetRequiredService <IAccessTokenStore>();

            return(accessTokenStore.StoreAsync(accessTokenValue).Result);
        }
Exemple #12
0
        /// <summary>
        /// 异步执行用户登出
        /// </summary>
        /// <param name="context">Http上下文</param>
        /// <returns></returns>
        public static async Task SignOutAsync(this HttpContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (context.RequestServices == null)
            {
                throw new MissingMemberException("HttpContext.RequestServices is null");
            }

            IAccessTokenStore accessTokenStore = context.RequestServices.GetRequiredService <IAccessTokenStore>();
            string            accessTokenKey   = GetAccessToken(context);

            if (string.IsNullOrEmpty(accessTokenKey))
            {
                return;
            }

            await accessTokenStore.RemoveAsync(accessTokenKey);
        }
Exemple #13
0
        /// <summary>
        /// 获取当前令牌的访问信息
        /// </summary>
        /// <param name="context">Http上下文</param>
        /// <returns></returns>
        public static Task <string> GetAccessTokenValueAsync(this HttpContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (context.RequestServices == null)
            {
                throw new MissingMemberException("HttpContext.RequestServices is null");
            }

            IAccessTokenStore accessTokenStore = context.RequestServices.GetRequiredService <IAccessTokenStore>();
            string            accessTokenKey   = GetAccessToken(context);

            if (string.IsNullOrEmpty(accessTokenKey))
            {
                throw new UnAuthorizedException();
            }

            return(accessTokenStore.RetrieveAsync(accessTokenKey));
        }
 public DefaultAccessTokenEndPointService(IAccessTokenStore accessTokenStore, IAuthorizationTokenStore authorizationTokenStore)
 {
     this.accessTokenStore        = accessTokenStore;
     this.authorizationTokenStore = authorizationTokenStore;
 }
Exemple #15
0
 public AuthenticationService(IAccessTokenStore accessTokenStore, IAppSettings appSettings)
 {
     _accessTokenStore = accessTokenStore;
     _appSettings      = appSettings;
 }
 public TwitterClientFactory(IAccessTokenStore accessTokenStore, 
     ITwitterApplicationCredentials applicationCredentials)
 {
     _accessTokenStore = accessTokenStore;
     _applicationCredentials = applicationCredentials;
 }
 public AccessTokenManager(IAccessTokenStore accessTokenStore, VendApplication defaultApp)
 {
     VendApplication   = defaultApp;
     _accessTokens     = new Dictionary <string, AccessTokenBag>();
     _accessTokenStore = accessTokenStore;
 }
 public DefaultAccessTokenEndPointService(IAccessTokenStore accessTokenStore, IAuthorizationTokenStore authorizationTokenStore)
 {
     this.accessTokenStore = accessTokenStore;
     this.authorizationTokenStore = authorizationTokenStore;
 }
Exemple #19
0
 public GetOfficeDocumentPermissionsAction(IGetOfficeDocumentAction getOfficeDocumentAction, IIdentityServerUmaClientFactory identityServerUmaClientFactory, IAccessTokenStore accessTokenStore)
 {
     _getOfficeDocumentAction        = getOfficeDocumentAction;
     _identityServerUmaClientFactory = identityServerUmaClientFactory;
     _accessTokenStore = accessTokenStore;
 }