Spring security returns Login Page instead of value | بلاگ

Spring security returns Login Page instead of value

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I added spring security to /api/** url (I have custom filter and custom provider). But of course I did mistake and can't find it: after successful authentication spring security redirects me to login page instead of call /api/sendhellowrold and returns me "Hello World" string. It works if I added successful handler and sendRedirect to page which should return me HTML. This is ok, but not about rest api

this is my configure method

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.antMatcher("/api/**").csrf().disable()
                .authorizeRequests()
                .antMatchers("/api/**").authenticated()
                .and()
                .addFilterAfter(createSsoTokenFilter(), UsernamePasswordAuthenticationFilter.class);
    }

 @Bean
    public SsoTokenFilter createSsoTokenFilter() throws Exception {
        SsoTokenFilter ssoTokenFilter = new SsoTokenFilter();
        ssoTokenFilter.setAuthenticationManager(authenticationManagerBean());
        return ssoTokenFilter;
    }
asked 54 secs ago
FoxNet

...
نویسنده : استخدام کار بازدید : 20 تاريخ : سه شنبه 2 مرداد 1397 ساعت: 22:20