用户和角色之间的数据库认证关系

时间:2018-02-12 21:01:51

标签: database authentication wildfly-11 elytron

我用于校长的查询通过数据库工作,我得到一条记录

select 'role', password from t_user where username = 'jdoe';

但是当我尝试通过jboss-cli.sh

使用它时
./subsystem=elytron/jdbc-realm=jdbc-realm:add(principal-query=[{ \
    data-source=MySqlDSroscam, \
    sql="SELECT 'role', password FROM t_user WHERE username = ?", \
    attribute-mapping=[{index=1, to=Roles}] \
    simple-digest-mapper={algorithm=simple-digest-md5, password-index=2}, \
}])

我收到此错误

{
    "outcome" => "failed",
    "failure-description" => "WFLYCTL0097: Wrong type for 'principal-query'. Expected [LIST] but was OBJECT",
    "rolled-back" => true
}

1 个答案:

答案 0 :(得分:0)

,值后,您只有其他逗号(simple-digest-mapper);)

以下按预期工作:

./subsystem=elytron/jdbc-realm=jdbc-realm:add(principal-query=[{ \
    data-source=MySqlDSroscam, \
    sql="SELECT 'role', password FROM t_user WHERE username = ?", \
    attribute-mapping=[{index=1, to=Roles}], \
    simple-digest-mapper={algorithm=simple-digest-md5, password-index=2} \
}])
相关问题