コード例 #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;
 }
コード例 #3
0
ファイル: Authorizer.cs プロジェクト: GraemeF/Twiddler
 public Authorizer(ITwitterApplicationCredentials applicationCredentials, 
     IAccessTokenStore accessTokenStore,
     Factories.UserFactory userFactory)
 {
     _applicationCredentials = applicationCredentials;
     _accessTokenStore = accessTokenStore;
     _userFactory = userFactory;
 }
コード例 #4
0
 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;
 }
コード例 #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;
 }
コード例 #7
0
 public LoginCommandHandler(
     IStringLocalizer <LoginCommandHandler> stringLocalizer,
     MoneybirdApiConfiguration apiConfiguration,
     IAccessTokenAcquirer accessTokenAcquirer,
     IAccessTokenStore accessTokenStore)
 {
     _stringLocalizer     = stringLocalizer;
     _apiConfiguration    = apiConfiguration;
     _accessTokenAcquirer = accessTokenAcquirer;
     _accessTokenStore    = accessTokenStore;
 }
コード例 #8
0
ファイル: OAuthDialog.xaml.cs プロジェクト: GraemeF/Twiddler
        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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #14
0
 public DefaultAccessTokenEndPointService(IAccessTokenStore accessTokenStore, IAuthorizationTokenStore authorizationTokenStore)
 {
     this.accessTokenStore        = accessTokenStore;
     this.authorizationTokenStore = authorizationTokenStore;
 }
コード例 #15
0
 public AuthenticationService(IAccessTokenStore accessTokenStore, IAppSettings appSettings)
 {
     _accessTokenStore = accessTokenStore;
     _appSettings      = appSettings;
 }
コード例 #16
0
 public TwitterClientFactory(IAccessTokenStore accessTokenStore, 
     ITwitterApplicationCredentials applicationCredentials)
 {
     _accessTokenStore = accessTokenStore;
     _applicationCredentials = applicationCredentials;
 }
コード例 #17
0
 public AccessTokenManager(IAccessTokenStore accessTokenStore, VendApplication defaultApp)
 {
     VendApplication   = defaultApp;
     _accessTokens     = new Dictionary <string, AccessTokenBag>();
     _accessTokenStore = accessTokenStore;
 }
コード例 #18
0
 public DefaultAccessTokenEndPointService(IAccessTokenStore accessTokenStore, IAuthorizationTokenStore authorizationTokenStore)
 {
     this.accessTokenStore = accessTokenStore;
     this.authorizationTokenStore = authorizationTokenStore;
 }
コード例 #19
0
 public GetOfficeDocumentPermissionsAction(IGetOfficeDocumentAction getOfficeDocumentAction, IIdentityServerUmaClientFactory identityServerUmaClientFactory, IAccessTokenStore accessTokenStore)
 {
     _getOfficeDocumentAction        = getOfficeDocumentAction;
     _identityServerUmaClientFactory = identityServerUmaClientFactory;
     _accessTokenStore = accessTokenStore;
 }