示例#1
0
        public RequestState(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            this.key = key;
        }
        public void Delete(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            lock (SyncRoot) {
                if (states.ContainsKey(key))
                    states.Remove(key);
            }
        }
        /// <summary>
        /// Permanently removes any state stored for the specified <paramref name="key"/>
        /// </summary>
        /// <param name="key">State key</param>
        public void Delete(RequestStateKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            lock (this.SyncRoot)
            {
                HttpContext.Current.Session[GetStringKey(key)] = null;
            }
        }
        public RequestState Get(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            lock (SyncRoot) {
                RequestState state;
                if (!states.TryGetValue(key, out state)) {
                    state = new RequestState(key);
                    Store(state);
                }

                return state;
            }
        }
        /// <summary>
        /// Permanently removes any state stored for the specified <paramref name="key"/>
        /// </summary>
        /// <param name="key">State key</param>
        public void Delete(RequestStateKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            lock (this.SyncRoot)
            {
                if (this.states.ContainsKey(key))
                {
                    this.states.Remove(key);
                }
            }
        }
        /// <summary>
        /// Gets the request state stored for the specified <paramref name="key"/>,
        /// creating a new state object if none is stored.
        /// </summary>
        /// <param name="key">State key</param>
        /// <returns>State</returns>
        public RequestState Get(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            lock (this.SyncRoot)
            {
                if (this.states.ContainsKey(key))
                    return this.states[key];

                var state = new RequestState(key);
                this.Store(state);
                return state;
            }
        }
        /// <summary>
        /// Gets the request state stored for the specified <paramref name="key"/>,
        /// creating a new state object if none is stored.
        /// </summary>
        /// <param name="key">State key</param>
        /// <returns>State</returns>
        public RequestState Get(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            lock (this.SyncRoot)
            {
                var state = HttpContext.Current.Session[GetStringKey(key)] as RequestState;
                if (state != null)
                    return state;

                state = new RequestState(key);
                this.Store(state);
                return state;
            }
        }
        /// <summary>
        /// Gets the request state stored for the specified <paramref name="key"/>,
        /// creating a new state object if none is stored.
        /// </summary>
        /// <param name="key">State key</param>
        /// <returns>State</returns>
        public RequestState Get(RequestStateKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            lock (this.SyncRoot)
            {
                if (this.states.ContainsKey(key))
                {
                    return(this.states[key]);
                }

                var state = new RequestState(key);
                this.Store(state);
                return(state);
            }
        }
        /// <summary>
        /// Gets the request state stored for the specified <paramref name="key"/>,
        /// creating a new state object if none is stored.
        /// </summary>
        /// <param name="key">State key</param>
        /// <returns>State</returns>
        public RequestState Get(RequestStateKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            lock (this.SyncRoot)
            {
                var state = HttpContext.Current.Session[GetStringKey(key)] as RequestState;
                if (state != null)
                {
                    return(state);
                }

                state = new RequestState(key);
                this.Store(state);
                return(state);
            }
        }
示例#10
0
		internal OAuthRequest(OAuthClientContext context, OAuthEndPoint resourceEndPoint, string verifier, RequestStateKey stateKey) {
			this.context = context;
			this.resourceEndPoint = resourceEndPoint;
			this.verifier = verifier;
			state = context.RequestStateStore.Get(stateKey);
		}
示例#11
0
 public void Delete(RequestStateKey key)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public RequestState Get(RequestStateKey key)
 {
     throw new NotImplementedException();
 }
示例#13
0
        protected OAuthRequest(
            EndPoint resourceEndPoint,
            OAuthService settings,
            string verifier,
            IRequestStateStore stateStore,
            RequestStateKey stateKey)
        {
            this.ResourceEndPoint = resourceEndPoint;
            this.Service = settings;
            this.RequestTokenVerifier = verifier;

            this.stateStore = stateStore;
            this.state = stateStore.Get(stateKey);
        }
 private static string GetStringKey(RequestStateKey key)
 {
     return(KeyPrefix + key.ServiceRealm + '/' + key.ConsumerKey + '/' + (key.EndUserId ?? string.Empty));
 }
        /// <summary>
        /// Permanently removes any state stored for the specified <paramref name="key"/>
        /// </summary>
        /// <param name="key">State key</param>
        public void Delete(RequestStateKey key)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            lock (this.SyncRoot)
            {
                HttpContext.Current.Session[GetStringKey(key)] = null;
            }
        }
 private static string GetStringKey(RequestStateKey key)
 {
     return KeyPrefix + key.ServiceRealm + '/' + key.ConsumerKey + '/' + (key.EndUserId ?? string.Empty);
 }