Skip to content

Commit 38dc01f

Browse files
Fix some issues to obtain a token
using client_credentials with spring
1 parent 7499cb0 commit 38dc01f

File tree

8 files changed

+18
-15
lines changed

8 files changed

+18
-15
lines changed

selenium/suites/authnz-messaging/auth-oauth-backend-with-opaque-tokens.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

55
TEST_CASES_PATH=/authnz-msg-protocols
6-
PROFILES="spring oauth-producer auth-oauth-spring auth_backends-oauth-opaque "
6+
PROFILES="spring oauth-producer auth-oauth-spring auth_backends-opaque-oauth auth-mtls"
77

88
source $SCRIPT/../../bin/suite_template
99
runWith spring
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export SPRING_URL=https://spring:8443/
2-
export OAUTH_PROVIDER_URL=https://spring:8443/
1+
export SPRING_URL=https://spring:8443
2+
export OAUTH_PROVIDER_URL=https://spring:8443
33
export SPRING_CA_CERT=/config/ca_spring_certificate.pem
44
export OAUTH_NODE_EXTRA_CA_CERTS=/config/ca_spring_certificate.pem
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export SPRING_URL=https://localhost:8443
2+
export OAUTH_PROVIDER_URL=https://localhost:8443
3+
export SPRING_CA_CERT=authnz-msg-protocols/spring/ca_spring_certificate.pem
4+
export OAUTH_NODE_EXTRA_CA_CERTS=authnz-msg-protocols/spring/ca_spring_certificate.pem
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export RABBITMQ_AMQP_USERNAME=oauth
12
export OAUTH_CLIENT_ID=producer
23
export OAUTH_CLIENT_SECRET=producer

selenium/test/authnz-msg-protocols/mqtt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe
4444
let oauthProviderUrl = process.env.OAUTH_PROVIDER_URL
4545
let oauthClientId = process.env.OAUTH_CLIENT_ID
4646
let oauthClientSecret = process.env.OAUTH_CLIENT_SECRET
47+
log("Obtening OpenId configuration from " + oauthProviderUrl)
4748
let openIdConfig = openIdConfiguration(oauthProviderUrl)
48-
log("Obtained token_endpoint : " + openIdConfig.token_endpoint)
49+
log("Obtaining token from " + openIdConfig.token_endpoint + " using " + oauthClientId + ":" + oauthClientSecret)
4950
password = tokenFor(oauthClientId, oauthClientSecret, openIdConfig.token_endpoint)
5051
log("Obtained access token : " + password)
5152
}

selenium/test/authnz-msg-protocols/rabbitmq.auth_backends-oauth-opaque.conf renamed to selenium/test/authnz-msg-protocols/rabbitmq.auth_backends-opaque-oauth.conf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
## RabbitMQ configuration with 2 oauth2 resources, rabbit_prod and rabbit_dev,
2-
## rather than a single resource_server_id
3-
## Also, each resource is owned by its own oauth provider, i.e. RabbitMQ is
4-
## accessed by users and clients from two different providers using their dedicated
5-
## resource_server_id.
1+
62
log.console.level = debug
73

84
auth_backends.1 = rabbit_auth_backend_oauth2

selenium/test/authnz-msg-protocols/spring/application.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ spring:
2828
- rabbitmq
2929
authorizationserver:
3030
client:
31-
mgt_api_client:
31+
producer:
3232
registration:
3333
provider: spring
34-
client-id: mgt_api_client
34+
client-id: producer
35+
client-secret: "{noop}producer"
3536
authorization-grant-types:
3637
- client_credentials
3738
client-authentication-methods:
38-
- client_secret_basic
39-
token-settings:
40-
access-token-format: reference
39+
- client_secret_post
40+
# token-settings:
41+
# access-token-format: reference
4142
scopes:
4243
- openid
4344
- profile
4445
- rabbitmq.tag:management
45-
client-name: mgt_api_client
46+
client-name: producer
4647
rabbitmq_client_code:
4748
registration:
4849
provider: spring

0 commit comments

Comments
 (0)