Sholo.Web.Security/Authentication/Device/Provider/CacheDeviceAuthenticationTicketProvider.cs
/// <summary>
/// Indicates whether or not the ticket store contains the supplied userAuthenticationTicketKey
/// </summary>
/// <param name="ticketKey">The ticket to check for</param>
/// <returns>True if the ticket is contained in the store</returns>
/// <exception cref="ArgumentNullException">ticketKey is null</exception>
/// <exception cref="ArgumentException">ticketKey is empty</exception>
Indicates whether or not the ticket store contains the supplied userAuthenticationTicketKey
Indicates whether or not the ticket store contains the supplied userAuthenticationTicketKey
public override bool ContainsTicket(string ticketKey)
        {
            if (ticketKey == null)
            {
                throw new ArgumentNullException("ticketKey", "ticketKey parameter cannot be null or empty.");
            }
            if (string.IsNullOrEmpty(ticketKey))
            {
                throw new ArgumentException("ticketKey parameter cannot be null or empty.", "ticketKey");
            }
            IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string currentKey = enumerator.Entry.Key as string;
                if (currentKey != null && currentKey.StartsWith(DeviceTicketKeyPrefix))
                {
                    UserAuthenticationTicket currentAuthTicket = enumerator.Entry.Value as UserAuthenticationTicket;
                    if (currentAuthTicket != null)
                    {
                        if (currentAuthTicket.Key == ticketKey)
                        {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
public override bool ContainsTicket ( string ticketKey ) { if ( ticketKey == null ) { throw new ArgumentNullException ( " " , " " ) ; } if ( string . IsNullOrEmpty ( ticketKey ) ) { throw new ArgumentException ( " " , " " ) ; } IDictionaryEnumerator enumerator = HttpContext . Current . Cache . GetEnumerator ( ) ; while ( enumerator . MoveNext ( ) ) { string currentKey = enumerator . Entry . Key as string ; if ( currentKey != null && currentKey . StartsWith ( DeviceTicketKeyPrefix ) ) { UserAuthenticationTicket currentAuthTicket = enumerator . Entry . Value as UserAuthenticationTicket ; if ( currentAuthTicket != null ) { if ( currentAuthTicket . Key == ticketKey ) { return true ; } } } } return false ; }
Indicates whether or not the ticket store contains the supplied userAuthenticationTicketKey
Indicates whether or not the ticket store contains the supplied userAuthenticationTicketKey
True if the ticket is contained in the store
True if the ticket is contained in the store
ticketKey is null
ticketKey is null
ticketKey is empty
ticketKey is empty
ticketKey
string
The ticket to check for
The ticket to check for