Replies: 6 comments 15 replies
-
|
Can this be turned into an executable example? This error is returned by a function that decodes and validates the token but it's not really possible to tell what specifically failed without having a way to try it We don't use issues for troubleshooting, so this belongs to discussion without further evidence. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry, Thank for your answer. But I did not understand your comment ? I gave you a detailed explanation for this issues. |
Beta Was this translation helpful? Give feedback.
-
|
Our OAuth expert, @MarcialRosales, has this to say:
|
Beta Was this translation helpful? Give feedback.
-
|
I tested RabbitMQ with Keycloak and "scope" attribute in the token claims, but I found the same error : RabbitMQ advanced.config :[
{rabbit, [
{auth_backends, [rabbit_auth_backend_oauth2, rabbit_auth_backend_internal]},
{log, [
{console, [
{level, debug},
{enabled, true}
]}
]}
]},
{rabbitmq_management, [
{enable_uaa, false}
]},
{rabbitmq_auth_backend_oauth2, [
{resource_server_id, <<"rabbitmq">>},
{key_config, [
{default_key, <<"KYujHrfcS_mJksSbahNGJJABP5sX4Vbdp8xwoQDS3tQ">>},
{signing_keys,
#{<<"KYujHrfcS_mJksSbahNGJJABP5sX4Vbdp8xwoQDS3tQ">> => {pem, <<"-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAjBvT5wM3/akhAIAz7DW6Awc1ZO5mec3S7maFDtebmTIHWuukKnLU
VeC6nNXWvBX/JERbNdGmxAEf8NF207hauuu8LYGUhpzo/z2V4fonT1Nv0lQVQH+d
g1SHsfyBcLNg+Mjb1cuudM3zcid8lRlFbHOZ4WKBJDhtG+s4Tj1e/0rKnkYMIJ36
ZmMoyV+Nqp1XbGYlh2rSuT9QmQbFVIzN44LsWG4MnlRXmb95+a7u8Uu/gz0BRwyH
gaJHW9M6r/OZhOgeu2U7ocxRyVLaf5N8JYsQO+DZPLONyAxAHqgkdAdLl3stHTKI
e/lLBYzad601ZktTQCu3Z74E5svHOd1dzwIDAQAB
-----END RSA PUBLIC KEY-----">>}
}
}]
}
]}
].Keycloak token claims{
"exp": 1648215668,
"iat": 1648215608,
"jti": "JTI ID",
"iss": "http://keycloak:8080/auth/realms/master",
"aud": [
"rabbitmq"
],
"sub": "CLIENT ID",
"scope": "rabbitmq.write:*/* rabbitmq.tag:administrator email profile rabbitmq.configure:*/* rabbitmq.read:*/*",
"clientId": "CLIENT ID"
} |
Beta Was this translation helpful? Give feedback.
-
|
A token with claim aud in a string format without brackets [] (array format) has a correct claim specification ?: |
Beta Was this translation helpful? Give feedback.
-
|
@azenakhi are you able to validate JWT token by rabbitmq now ? I am facing the similar issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Project description
Implement message architecture using RabbitMQ as brocker & OAuth2
Issue description
Authentication using an OAuth 2/JWT token failed: provided token is invalid
Use case
Tools & Versions
RabbitMQ
Advanced config
[ {rabbit, [ {auth_backends, [rabbit_auth_backend_oauth2, rabbit_auth_backend_internal]}, {log, [ {console, [ {level, debug}, {enabled, true} ]} ]} ]}, {rabbitmq_management, [ {enable_uaa, false} ]}, {rabbitmq_auth_backend_oauth2, [ {resource_server_id, <<"rabbitmq">>}, {key_config, [ {default_key, <<"a-key-ID">>}, {signing_keys, #{<<"a-key-ID">> => {pem, <<"PUBLIC-KEY">>} } }] } ]} ].Keycloak token format
HEADER:ALGORITHM & TOKEN TYPE
{ "alg": "RS256", "typ": "JWT", "kid": "a-key-ID" }PAYLOAD:DATA
{ "exp": 1648215668, "iat": 1648215608, "jti": "JTI ID", "iss": "http://keycloak:8080/auth/realms/master", "aud": [ "rabbitmq" ], "sub": "CLIENT ID", "scope": "rabbitmq.write:*/* rabbitmq.tag:administrator email profile rabbitmq.configure:*/* rabbitmq.read:*/*", "clientId": "CLIENT ID" }Okta token format
HEADER:ALGORITHM & TOKEN TYPE
{ "alg": "RS256", "typ": "JWT", "kid": "a-key-ID" }PAYLOAD:DATA
{ "ver": 1, "jti": "THE JTI", "iss": "https://OKTA ISSUER", "aud": "api://aud", # Our audience format "iat": 1648220736, "exp": 1648224336, "cid": "CLIENT ID", "scp": [ "rabbitmq.read:*/*", "rabbitmq.configure:*/*" ], "sub": "CLIENT ID" }Python client communicate with RabbitMQ using Jwt Tokan
Trace log client
Trace log RabbitMQ
Thanks for your help.
Best regards
Beta Was this translation helpful? Give feedback.
All reactions