Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Fix role related failing script
Browse files Browse the repository at this point in the history
  • Loading branch information
isha2040 committed Apr 27, 2021
1 parent d3bbb19 commit 1638109
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
27 changes: 10 additions & 17 deletions bin/register-role.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/bin/sh
## Usage: ./idam-user-token.sh [user] [password]
##
## Options:
## - username: Role assigned to user in generated token. Default to `[email protected]`.
## - password: ID assigned to user in generated token. Default to `Pa55word11`.
##
## Returns a valid IDAM user token for the given username and password.
# Register role in CCD

IMPORTER_USERNAME=${1:-ccd.docker.default@hmcts.net}
IMPORTER_PASSWORD=${2:-Pa55word11}
IDAM_URI="http://localhost:5000"
REDIRECT_URI="http://localhost:3000/oauth2/callback"
CLIENT_ID="xuiwebapp"
CLIENT_SECRET=${OAUTH2_CLIENT_SECRET}
SCOPE="openid%20profile%20roles"
ROLE=$1
USER_TOKEN=$2
SERVICE_TOKEN=$3

curl --silent -H "Content-Type: application/x-www-form-urlencoded" \
-XPOST "${IDAM_URI}/o/token?grant_type=password&redirect_uri=${REDIRECT_URI}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&username=${IMPORTER_USERNAME}&password=${IMPORTER_PASSWORD}&scope=${SCOPE}" -d "" | docker run --rm --interactive stedolan/jq -r .access_token
curl --silent --show-error -XPUT \
http://localhost:4451/api/user-role \
-H "Authorization: Bearer ${USER_TOKEN}" \
-H "ServiceAuthorization: Bearer ${SERVICE_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"role":"'"${ROLE}"'","security_classification":"PUBLIC"}'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/probate-dev-env",
"version": "1.0.46",
"version": "1.0.47",
"description": "Scripts to set up the Probate development environment",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 1638109

Please sign in to comment.