PostgreSQL上的Spring Security jdbcAuthentication默认方案错误

ikh*_*san 12 spring spring-security postgresql-9.1

在PostgreSQL上使用默认方案弹簧安全真的不可能,部分"varchar_ignorecase" does not exist是不可替代的?

我只是测试默认设置.

auth.jdbcAuthentication()
            .dataSource(dataSource)
            .withDefaultSchema();
Run Code Online (Sandbox Code Playgroud)

以下是错误

auth.jdbcAuthentication()
            .dataSource(dataSource)
            .withDefaultSchema();
Run Code Online (Sandbox Code Playgroud)

ikh*_*san 19

因为默认架构不适合PostgreSQL,我需要创建自己的架构并为用户和权限查询实现自己的查询.

auth.jdbcAuthentication()
                .dataSource(dataSource)
                .usersByUsernameQuery(
                        "select username,password, enabled from users where username=?")
                .authoritiesByUsernameQuery(
                        "select username, role from user_roles where username=?");
Run Code Online (Sandbox Code Playgroud)

  • 您的解决方案也适用于MySQL. (2认同)
  • 为什么该模式“不适合”PostgreSQL 和 MySQL?顺便说一句,它正在工作......tks (2认同)
  • 要避免执行`dll`,必须删除`withDefaultSchema()`句子 (2认同)