I am using basic auth + JWT auth in readonlyrest.yml as follows:
readonlyrest:
access_control_rules:
- name: "Valid JWT token with admin role"
type: allow
jwt_auth:
name: "jwt_provider_1"
roles: ["admin"]
- name: "Require HTTP Basic Auth"
type: allow
auth_key: user:pwd
jwt:
- name: jwt_provider_1
signature_algo: HMAC # can be NONE, RSA, HMAC (default), and EC
signature_key: "my-key"
user_claim: email
roles_claim: roles # JSON-path style
header_name: Authorization
I am able to login as âuserâ through auth_key declaration. But when I pass JWT in header âAuthorizationâ: "Bearer "+token, am getting 401 error.
Header and payload contents of the token:
âheaderâ
{
âalgâ: âHS256â,
âtypâ: âJWTâ
}
âpayloadâ
{
âemailâ: âadmin_userâ,
ârolesâ: [âadminâ]
}
signature_key is the secret key (âmy-keyâ above) is base64 encoded and sent along with payload and header.
I saw in one of the old links that signature_key is initialized to the token itself. Please let me know if signature_key and claims sections are mutually exclusive if itâs the case.
Am using ES7.2 free plugin
I see messages of this type in ES logger.
[2019-07-25T09:07:28,595][INFO ][t.b.r.a.l.AclLoggingDecorator] [ip-172-31-1-64] ^[[36mALLOWED by { name: âRequire HTTP Basic Authâ, policy: ALLOW, rules: [auth_key] req={ ID:2085141796-1885939433#150, TYP:XPackInfoRequest, CGR:N/A, USR:admin, BRS:false, KDX:null, ACT:cluster:monitor/xpack/info, OA:18.217.103.157/32, XFF:null, DA:172.31.1.64/32, IDX:<N/A>, MET:GET, PTH:/_xpack, CNT:<N/A>, HDR:Authorization=, Connection=keep-alive, Content-Length=0, Host=18.191.234.117:9200, HIS:[Valid JWT token with admin role-> RULES:[jwt_auth->false], RESOLVED:[]], [Require HTTP Basic Auth-> RULES:[auth_key->true], RESOLVED:[user=admin]] }^[[0m
Looks like the contents of the header are being ignored. Is there any other setting in readonlyrest.yml or elasticsearch.yml to be made?