CORS在firforx和弹簧安全方面的问题

时间:2017-03-28 09:38:30

标签: spring spring-security cors

我的应用程序代码是用Java和Spring Security编写的。当我尝试登录我的应用程序时,请求被发送到不安全的页面,并且mozilla无法为该页面添加期望,因此我没有收到响应,它继续将请求发送回登录页面。它在Chrome和IE中运行良好,但问题仅在于Mozilla Firefox。我尝试过不同版本的Firefox,但同样的问题仍然存在。任何线索都会有所帮助。

感谢名单。

以下是我目前正在使用的CORS过滤器的代码:

// This snippet uses C++14 features
#include <functional>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

template <typename F, typename... Ts, std::size_t... Is>
void tuple_for_each(std::tuple<Ts...>& tuple, F f, std::index_sequence<Is...>) {
    using expander = int[];
    (void)expander{0, ((void)f(std::get<Is>(tuple)), 0)...};
}

template <typename F, typename... Ts>
void tuple_for_each(std::tuple<Ts...>& tuple, F f) {
    tuple_for_each(tuple, f, std::make_index_sequence<sizeof...(Ts)>());
}

// Missing in this example:
// - full support for std::vector's interface (iterators, exception safety guarantees, etc.);
// - access to individual homogeneous vectors;
// - lots of other things.

template <typename T, typename... Ts>
class soa_vector {
    std::tuple<std::vector<T>, std::vector<Ts>...> data_;

    template <std::size_t>
    void push_back_impl() const {}

    template <std::size_t position, typename Value, typename... Values>
    void push_back_impl(Value&& value, Values&&... values) {
        std::get<position>(data_).push_back(std::forward<Value>(value));
        push_back_impl<position + 1, Values...>(std::forward<Values>(values)...);
    }

    template<std::size_t... Is>
    std::tuple<std::add_lvalue_reference_t<T>, std::add_lvalue_reference_t<Ts>...>
    tuple_at(std::size_t position, std::index_sequence<Is...>) {
        return std::make_tuple(std::ref(std::get<Is>(data_)[position])...);
    }

public:    
    template <typename... Values>
    std::enable_if_t<sizeof...(Values) == sizeof...(Ts) + 1, void>
    push_back(Values&&... values) {
        push_back_impl<0, Values...>(std::forward<Values>(values)...);
    }

    void reserve(std::size_t new_capacity) {
        tuple_for_each(data_, [new_capacity](auto& vec) { vec.reserve(new_capacity); });
    }

    std::size_t size() const { return std::get<0>(data_).size(); }

    std::tuple<std::add_lvalue_reference_t<T>, std::add_lvalue_reference_t<Ts>...>
    operator[](std::size_t position) {
        return tuple_at(position, std::make_index_sequence<sizeof...(Ts) + 1>());
    }
};

以下是我的请求标题:

enter image description here

0 个答案:

没有答案