-
Notifications
You must be signed in to change notification settings - Fork 117
feat: apply defaults for customClaims #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Would you mind testing and letting me know if it works? I applied a couple of patches that suggested that it didn't work |
Sure @dbarrosop is there a docker image published or , should I build myself ? |
Use the dev environment in this repo. Once we confirm this is working we can build a beta image. If you don't know how to start the environment you can start in |
with local built image, I am getting 404 error for any of the Auth APIs e.g., curl http://localhost:4000/v1/version
{"status":404,"message":"Route not found","error":"route-not-found"} |
Try without |
not working
|
@dbarrosop need your help. I need to test with my local So tried
[auth]
# version = '0.37.1'
version = '0.0.0-dev'
[[auth.session.accessToken.customClaims]]
key = 'default-org'
value = 'defaultOrg'
[[auth.session.accessToken.customClaims]]
key = 'allowed-orgs'
value = 'allowedOrgs.orgId[]'
[[auth.session.accessToken.customClaims]]
key = 'user-email'
value = 'email'
[[auth.session.accessToken.CustomClaimsDefaults]]
key = 'default-org'
value = '00000000-0000-0000-0000-000000000000'
services:
auth:
image: nhost/hasura-auth:0.0.0-dev
depends_on:
graphql:
condition: service_healthy
postgres:
condition: service_healthy
environment:
AUTH_API_PREFIX: /v1
AUTH_CLIENT_URL: https://console.traefik.me:5173
AUTH_JWT_CUSTOM_CLAIMS: '{"allowed-orgs":"allowedOrgs.orgId[]","default-org":"defaultOrg","user-email":"email"}'
AUTH_JWT_CUSTOM_CLAIMS_DEFAULTS: '{"default-org":"00000000-0000-0000-0000-000000000000"}'
AUTH_PORT: "4000"
AUTH_SERVER_URL: https://local.auth.local.nhost.run/v1
AUTH_SMTP_AUTH_METHOD: LOGIN
...
Please advise if I am doing something wrong. |
No idea, if you are just running that command with the docker compose generated by the CLI GET /v1/version should work. Based on the logs you shared I don't even see the request so make sure you don't have something else running that might be intercepting the request. Otherwise, curl -v output plus auth logs might give some clues |
Sorry too early, I need to apply following schema changes that I used as workaround for setting Update: Got JWT with PR curl 'https://local.auth.local.nhost.run/v1/signin/email-password' \
-H 'content-type: application/json' \
--data-raw '{"email":"[email protected]","password":"xyz"}' {
"exp": 1742784794,
"https://hasura.io/jwt/claims": {
"x-hasura-allowed-orgs": "{}",
"x-hasura-allowed-roles": [
"user",
"me"
],
"x-hasura-default-org": "null",
"x-hasura-default-role": "user",
"x-hasura-user-email": "[email protected]",
"x-hasura-user-id": "cf76daf5-1b6b-4b4c-8585-4ce5c55fb25b",
"x-hasura-user-is-anonymous": "false"
},
"iat": 1742783894,
"iss": "hasura-auth",
"sub": "cf76daf5-1b6b-4b4c-8585-4ce5c55fb25b"
} Still debugging why the PR not setting |
You don't have the flag configured, you have a constant defined but there is no flag defined. Proof of that is that it doesn't show during the initialization process. |
Thanks @dbarrosop fixed it. Also has to check nil and fill with default in if got == nil {
claims[name] = c.defaultOrNil(name)
} else {
claims[name] = got
} |
unfortunately looks like tests for the older node code are not passing : ( |
Thanks, everything looks green. I will try to find some time to review and test a bit more thoroughly. The next 2-3 weeks are a bit packed for us but I will try to squeeze some time. |
Just wanted to let you know I haven't forgotten about this but due to easter and other priorities I haven't had the time yet, sorry. |
Understood , noticed you are working on many commits. |
Hello, Thanks for your patience. Regards |
sure. will do next week. Thanks |
Fixes #610
Before submitting this PR:
Checklist
Breaking changes
Avoid breaking changes and regressions. If you feel it is unavoidable, make it explicit in your PR comment so we can review it and see how to handle it.
Tests
make test
or themake watch
command).Documentation
Please make sure the documentation is updated accordingly, in particular: