knife4j icon indicating copy to clipboard operation
knife4j copied to clipboard

请问springboot security怎么加登录的接口说明?

Open JakeWoki opened this issue 4 years ago • 0 comments

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .formLogin()
                .loginProcessingUrl("/api/login")
                .usernameParameter("username")
                .passwordParameter("password")
                .successHandler(new CustomAuthenticationSuccessHandler())
                .failureHandler(new CustomAuthenticationFailureHandler())
                .permitAll()
                .and()
            .logout()
                .logoutUrl("/api/logout")
                .logoutSuccessHandler(new CustomLogoutSuccessHandler())
                .deleteCookies("JSESSIONID")
                .permitAll()
                .and()
            .csrf()
                .disable()
            .exceptionHandling()
                .authenticationEntryPoint(new CustomAuthenticationEntryPoint())
                .and()
            .authorizeRequests()
            .and()
                .headers()
                .frameOptions()
                .disable();
}

比如这样?怎么加接口说明呢?按这个来Documenting Spring's login/logout API in Swagger也没有生成对应的文档

JakeWoki avatar Jul 05 '21 03:07 JakeWoki