Joe
Joe

Reputation: 7919

Database authentication relation between user and roles

The query I use to principals it works through database and I get a record

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

but when I try to use it through 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}, \
}])

I get this error

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

Upvotes: 0

Views: 528

Answers (1)

Tharok
Tharok

Reputation: 1041

You have just additional comma (,) after simple-digest-mapper value ;)

Following works as expected:

./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} \
}])

Upvotes: 1

Related Questions