public SeasonAddViewModel(HandicapStatusViewModel handicapStatus, IList<Navigation.BreadcrumbNavItem> breadcrumb, AntiforgeryTokenSet tokenSet, SeasonAddEnteredData seasonAddEnteredData)
 {
     HandicapStatus = handicapStatus;      
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
     EnteredData = seasonAddEnteredData;
 }
Exemple #2
0
        /// <inheritdoc />
        public void ValidateTokens([NotNull] HttpContext context, AntiforgeryTokenSet antiforgeryTokenSet)
        {
            CheckSSLConfig(context);

            if (string.IsNullOrEmpty(antiforgeryTokenSet.CookieToken))
            {
                throw new ArgumentException(
                    Resources.Antiforgery_CookieToken_MustBeProvided_Generic,
                    nameof(antiforgeryTokenSet));
            }

            if (string.IsNullOrEmpty(antiforgeryTokenSet.FormToken))
            {
                throw new ArgumentException(
                    Resources.Antiforgery_FormToken_MustBeProvided_Generic,
                    nameof(antiforgeryTokenSet));
            }

            // Extract cookie & form tokens
            var deserializedCookieToken = _tokenSerializer.Deserialize(antiforgeryTokenSet.CookieToken);
            var deserializedFormToken = _tokenSerializer.Deserialize(antiforgeryTokenSet.FormToken);

            // Validate
            _tokenGenerator.ValidateTokens(
                context,
                deserializedCookieToken,
                deserializedFormToken);
        }
Exemple #3
0
        /// <inheritdoc />
        public void ValidateTokens(HttpContext context, AntiforgeryTokenSet antiforgeryTokenSet)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            CheckSSLConfig(context);

            if (string.IsNullOrEmpty(antiforgeryTokenSet.CookieToken))
            {
                throw new ArgumentException(
                          Resources.Antiforgery_CookieToken_MustBeProvided_Generic,
                          nameof(antiforgeryTokenSet));
            }

            if (string.IsNullOrEmpty(antiforgeryTokenSet.FormToken))
            {
                throw new ArgumentException(
                          Resources.Antiforgery_FormToken_MustBeProvided_Generic,
                          nameof(antiforgeryTokenSet));
            }

            // Extract cookie & form tokens
            var deserializedCookieToken = _tokenSerializer.Deserialize(antiforgeryTokenSet.CookieToken);
            var deserializedFormToken   = _tokenSerializer.Deserialize(antiforgeryTokenSet.FormToken);

            // Validate
            _tokenGenerator.ValidateTokens(
                context,
                deserializedCookieToken,
                deserializedFormToken);
        }
 public NewsFeedViewModel(HandicapStatusViewModel handicapStatus,
                       IList<Navigation.BreadcrumbNavItem> breadcrumb,
                       AntiforgeryTokenSet tokenSet)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
 }
 public RoundAddViewModel(HandicapStatusViewModel handicapStatus, IList<Navigation.BreadcrumbNavItem> breadcrumb, IEnumerable<SelectListItem> stateListing, AntiforgeryTokenSet tokenSet, RoundAddEnteredData roundEnteredData)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     StateListing = stateListing;
     TokenSet = tokenSet;
     RoundEnteredData = roundEnteredData;
 }
 public CourseAddViewModel(HandicapStatusViewModel handicapStatus, IList<Navigation.BreadcrumbNavItem> breadcrumb, IEnumerable<SelectListItem> stateListing, CourseAddEnteredData courseAddUserEntered, AntiforgeryTokenSet tokenSet)
 {
     HandicapStatus = handicapStatus;
     CourseAddUserEntered = courseAddUserEntered;
     Breadcrumb = breadcrumb;
     StateListing = stateListing;
     TokenSet = tokenSet;
 }
 public SeasonListingViewModel(HandicapStatusViewModel handicapStatus,
                               IList<Navigation.BreadcrumbNavItem> breadcrumb,
                               AntiforgeryTokenSet tokenSet,
                               int currentSeasonId)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
     CurrentSeasonId = currentSeasonId;
 }
 public IndexViewModel(HandicapStatusViewModel handicapStatus,
                       IList<Navigation.BreadcrumbNavItem> breadcrumb,
                       AntiforgeryTokenSet tokenSet,
                       DashboardViewType.DashboardViewTypeEnum viewType)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
     ViewType = viewType;
 }
Exemple #9
0
        /// <inheritdoc />
        public void ValidateTokens([NotNull] HttpContext context, AntiforgeryTokenSet antiforgeryTokenSet)
        {
            CheckSSLConfig(context);

            // Extract cookie & form tokens
            var deserializedCookieToken = DeserializeToken(antiforgeryTokenSet.CookieToken);
            var deserializedFormToken   = DeserializeToken(antiforgeryTokenSet.FormToken);

            // Validate
            _tokenGenerator.ValidateTokens(
                context,
                deserializedCookieToken,
                deserializedFormToken);
        }
 public CourseStatsViewModel(HandicapStatusViewModel handicapStatus,
                             IList<Navigation.BreadcrumbNavItem> breadcrumb,
                             AntiforgeryTokenSet tokenSet,
                             CourseStatsModel course,
                             IEnumerable<SelectListItem> userSeasons,
                             IEnumerable<SelectListItem> teeBoxLocations,
                             CourseStatsQueryResponse condensedStats)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
     CourseRecord = course;
     UserSeasons = userSeasons;
     TeeBoxLocations = teeBoxLocations;
     CondensedStats = condensedStats;
 }
Exemple #11
0
        public void ValidateTokens_MissingCookieInTokenSet_Throws()
        {
            // Arrange
            var context     = CreateMockContext(new AntiforgeryOptions());
            var antiforgery = GetAntiforgery(context);

            var tokenSet = new AntiforgeryTokenSet("hi", cookieToken: null);


            // Act
            var exception = Assert.Throws <ArgumentException>(
                () => antiforgery.ValidateTokens(context.HttpContext, tokenSet));

            // Assert
            var trimmed = exception.Message.Substring(0, exception.Message.IndexOf(Environment.NewLine));

            Assert.Equal("The cookie token must be provided.", trimmed);
        }
 public RoundListingViewModel(HandicapStatusViewModel handicapStatus,
                              IList<Navigation.BreadcrumbNavItem> breadcrumb,
                              //IEnumerable<SelectListItem> stateListing,
                              AntiforgeryTokenSet tokenSet,
                              //string usersDefaultState,
                              //int totalNumberofPages,
                              //int totalNumberOfRounds,
                              IList<SortOrderViewModel> sortOrder,
                              int defaultRoundsPerPage,
                              IEnumerable<int> roundsPerPage,
                              IEnumerable<SelectListItem> userSeasons)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     //StateListing = stateListing;
     TokenSet = tokenSet;
     //UsersDefaultState = usersDefaultState;
     //TotalNumberofPages = totalNumberofPages;
     SortOrder = sortOrder;
     DefaultRoundsPerPage = defaultRoundsPerPage;
     RoundsPerPage = roundsPerPage;
     UserSeasons = userSeasons;
     //TotalNumberOfRounds = totalNumberOfRounds;
 }
 public CourseListingViewModel(HandicapStatusViewModel handicapStatus,
                               IList<Navigation.BreadcrumbNavItem> breadcrumb,
                               AntiforgeryTokenSet tokenSet,
                               //int totalPagesOfCourses,
                               //int totalNumberOfCourses,
                               IEnumerable<SortOrderViewModel> sortOrder,
                               IEnumerable<SelectListItem> stateListing,
                               string userStatePreference,
                               int defaultCoursesPerPage,
                               IEnumerable<int> coursesPerPage,
                               string courseNameFilter)
 {
     HandicapStatus = handicapStatus;
     Breadcrumb = breadcrumb;
     TokenSet = tokenSet;
     //TotalPagesOfCourses = totalPagesOfCourses;
     SortOrder = sortOrder;
     StateListing = stateListing;
     UserStatePreference = userStatePreference;
     DefaultCoursesPerPage = defaultCoursesPerPage;
     CoursesPerPage = coursesPerPage;
     CourseNameFilter = courseNameFilter;
     //TotalNumberOfCourses = totalNumberOfCourses;
 }
        /// <inheritdoc />
        public void ValidateTokens([NotNull] HttpContext context, AntiforgeryTokenSet antiforgeryTokenSet)
        {
            CheckSSLConfig(context);

            // Extract cookie & form tokens
            var deserializedCookieToken = DeserializeToken(antiforgeryTokenSet.CookieToken);
            var deserializedFormToken = DeserializeToken(antiforgeryTokenSet.FormToken);

            // Validate
            _tokenGenerator.ValidateTokens(
                context,
                deserializedCookieToken,
                deserializedFormToken);
        }