我的应用程序有两种不同的安全配置。一个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) 我正在使用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在不重复消息的情况下创建附加文件?