小编Sho*_*nja的帖子

所有提供者之后的Spring Security java.lang.StackOverflowError异常

环境:

  • 春季4.1.6
  • Spring Security 4.0.1

我有2个身份验证提供程序 - 一个访问ActiveDirectory,然后一个命中我创建的自定义数据库提供程序.以这些环境中的任何一个用户身份登录都可以完美地运行.用户已通过身份验证,应用程序仍在继续.

但是,当输入无效用户且两个提供程序都无法进行身份验证时,我在页面上收到此异常:

java.lang.StackOverflowError
    org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$UserDetailsServiceDelegator.loadUserByUsername(WebSecurityConfigurerAdapter.java:393)
    org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$UserDetailsServiceDelegator.loadUserByUsername(WebSecurityConfigurerAdapter.java:394)
    org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$UserDetailsServiceDelegator.loadUserByUsername(WebSecurityConfigurerAdapter.java:394)
    org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$UserDetailsServiceDelegator.loadUserByUsername(WebSecurityConfigurerAdapter.java:394)
Run Code Online (Sandbox Code Playgroud)

这是我的WebSecurityConfigurerAdapter配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .csrf().disable()
            .formLogin().loginPage("/login").failureUrl("/login?error").defaultSuccessUrl("/overview").permitAll()
            .and()
                .logout().logoutSuccessUrl("/login?logout").permitAll()
            .and()
                .authorizeRequests()
                .antMatchers("/resources/**").permitAll()
                .antMatchers("/favicon.ico").permitAll()
                .antMatchers("/**").hasRole("AUTH");
}

@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
    authManagerBuilder
            .authenticationProvider(activeDirectoryLdapAuthenticationProvider())
            .userDetailsService(userDetailsService());

    authManagerBuilder
            .authenticationProvider(databaseAuthenticationProvider())
            .userDetailsService(userDetailsService());
}

@Bean
public ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
    ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(DOMAIN, URL);
    provider.setConvertSubErrorCodesToExceptions(true);
    provider.setUseAuthenticationRequestCredentials(true);
    provider.setUserDetailsContextMapper(userDetailsContextMapper());
    return provider;
}

@Bean
public UserDetailsContextMapper userDetailsContextMapper() {
    UserDetailsContextMapper contextMapper = new MyUserDetailsContextMapper();
    return contextMapper;
}

@Bean …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-security

7
推荐指数
1
解决办法
4847
查看次数

在 Gosu 中居中文本

我一直无法将 Gosu 库中的文本居中到屏幕的绝对中间。

require 'gosu'

class GameWindow < Gosu::Window
  def initialize (width=800, height=600, fullscreen=false)
    super
    self.caption = 'Hello'
    @message = Gosu::Image.from_text(
        self, 'HELLO WORLD', Gosu.default_font_name, 45)
  end

  def draw
    @message.draw(377.5,277.5,0)
  end
end

window = GameWindow.new
window.show 
Run Code Online (Sandbox Code Playgroud)


我的第一种方法是取height屏幕的 ,减去文本的高度45,然后除以 2。现在这似乎在垂直对齐时起作用。

在此处输入图片说明

然而,水平是一个不同的故事......它似乎是在文本的左上角并将其居中,而不是文本的中间。

在此处输入图片说明

有人有这个公式吗?我尝试了很多东西,但只差一点。

ruby libgosu

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

PrimeNG TurboTable可排序列分类指示器?

我正在尝试将现有的PrimeNG Datatable转换为新发布的TurboTable规范,并且我已经能够或多或少地完成所有工作,但是我在列标题上丢失了自动生成的排序方向指示符.

列标题上的箭头

是否有内置的解决方案,用于显示基于p-table提供的模板绑定的排序指示器,或者我是否必须附加到p-table的(sort)事件,找出哪个列已排序和方向,然后更新我的模板从组件方法?

sorting angular2-template primeng primeng-turbotable

5
推荐指数
2
解决办法
5032
查看次数

线程C客户端 - 服务器聊天应用程序中SIGSEGV的未知原因

我是软件工程专业的三年级大学生,参加过操作系统课程.

我一直在使用pthreads和套接字在C中使用客户端 - 服务器聊天应用程序.我一直在尝试使用pthread来提升客户端处理的并发性,而不会产生分叉的开销.(如果重要的话,我正在开发Ubuntu 11.04 x86).

而不是存储的一切,静态或全局/局部变量,我创建了两个结构化的数据类型,serverInfo_t并且clientInfo_t,其存储互斥,文件描述符,连接标志,和其他这样的信息.客户端列表实现为存储在serverInfo_t其中的简单单链表,在修改期间锁定和解锁.

在启动服务器应用程序时,我首先调用createServer(),它建立服务器,并最终启动一个子线程,其职责是监听新连接.此函数返回指向新分配serverInfo_t实例的指针,然后将其传递给调用createClient(serverInfo_t* pServer, int out_fd)以创建"admin"客户端,从而允许服务器本身用作客户端.这是我遇到问题的地方,因为它似乎一旦调用它就会产生段错误createClient().(一些修剪过的代码在下面:)

int main(int argc, char** argv)
{
    // ...
    // Get listenPort from argv[1].

    // Initialize the server.
    serverInfo_t* pServer = createServer(listenPort);

    // If createServer() failed, exit.
    if (!pServer) {
        fatal_error("ERROR: Unable to create server!"); // exit program
    }

    // Create and register the admin client.
    clientInfo_t* pAdmin = createClient(pServer, STDOUT_FILENO); // Outputs directly to stdout …
Run Code Online (Sandbox Code Playgroud)

c sockets gdb client-server pthreads

0
推荐指数
1
解决办法
1004
查看次数