emqx / emqx-auth-jwt

EMQX JWT Authentication Plugin
https://www.emqx.com
Apache License 2.0
29 stars 24 forks source link

Can not set auth.jwt.verify_claims.$name by env var #103

Open alexandrim0 opened 4 years ago

alexandrim0 commented 4 years ago

Hello!

I have working config file for JWT auth plugin wich do well all I need. But I do prefer to use env vars to configure it. I can set all params but not auth.jwt.verify_claims.$name Env var have to be in upper case, but claims in JWT are in lowercase. I had tried to use both EMQX_AUTHJWTVERIFY_CLAIMSUSERNAME=%u and EMQX_AUTHJWTVERIFY_CLAIMSusername=%u but with no luck. I mean, it accept any valid JWT even if claims is not right.

Is it a bug and will be fixed or not?

Thank you!

terry-xiaoyu commented 4 years ago

Are you using emqx in docker?

All the EMQX_ prefixed env variables are converted to config records and then are populated to the config files: https://github.com/emqx/emqx-docker/blob/5a9933d3a0f73ab3593723ce4b8548e3bf6f594e/v3.2/docker-entrypoint.sh#L104

You could attach into the docker and check if the configuration file if they are changed as expected.

alexandrim0 commented 4 years ago

Yes, Im using docker. I did check and I can see no changes in config file for that var. I watch at docker-entrypoint.sh and it makes me cry because of Im not good at bash. But it looks like something wrong with regexp for that case. It wont process and I can`t see this var is populated at starting of container. All vars have correct value inside of container. All vars in config also. Exept auth.jwt.verify_claims.uid witch works fine if it configured with config filee by hands.