小编Vla*_*rov的帖子

如何在spring-security中在另一个过滤器之前添加过滤器?

我的应用程序有两种不同的安全配置。一个OAuth2SecurityConfiguration是另一个LdapSecurityConfiguration。在OAuth2SecurityConfiguration我有以下带有2个过滤器的安全配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .csrf().disable()
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .and()
                .authorizeRequests()
                .antMatchers(OAUTH_ENDPOINT).permitAll()
                .anyRequest().authenticated()
            .and()
                .logout()
                .logoutUrl(LOGOUT_ENDPOINT)
                .logoutSuccessUrl("/")
                .addLogoutHandler(oAuthLogoutHandler)
            .and()
                .addFilterAfter(oAuth2ClientContextFilter, ExceptionTranslationFilter.class)
                .addFilterBefore(oAuth2AuthenticationProcessingFilter, FilterSecurityInterceptor.class)
                // anonymous login must be disabled,
                // otherwise an anonymous authentication will be created,
                // and the UserRedirectRequiredException will not be thrown,
                // and the user will not be redirected to the authorization server
                .anonymous().disable();
}
Run Code Online (Sandbox Code Playgroud)

LdapSecurityConfiguration 安全配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

5
推荐指数
1
解决办法
8241
查看次数

如何使用 JDA 将带有消息的文件发送到 Discord?

我正在使用JDA lib 创建我的不和谐机器人,但遇到了一个问题:为了使用文件发送消息,我应该使用现有消息:

RestAction<Message> sendFile(File file, Message message)
RestAction<Message> sendFile(File file, String fileName, Message message)
RestAction<Message> sendFile(InputStream data, String fileName, Message message)
Run Code Online (Sandbox Code Playgroud)

没有使用简单字符串消息发送文件的实现。因此,当我尝试发送文件并向其传递消息时,我收到了重复的消息。

所以问题是:如何Message在不重复消息的情况下创建附加文件?

java discord discord-jda

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×2

discord ×1

discord-jda ×1

spring ×1

spring-security ×1