Skip to content

Handy Scripts

Lewis Birks edited this page Mar 6, 2020 · 3 revisions

Obtaining Service Auth Token

#!/usr/bin/env bash
set -eu
​
secret=${1:-36ZBBTC7E3YWORUO}
microservice=${2:-"fpl_case_service"}
s2s_host=${3:-"http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"}
​
otp=$(oathtool -b --totp $secret)export http_proxy=proxyout.reform.hmcts.net:8080
curl --insecure --fail --show-error -X POST "${s2s_host}/lease" -H "Content-Type: application/json" -d '{"microservice": "'${microservice}'","oneTimePassword": "'${otp}'"}'

Fixing Preview Login Issue

This script may fix an issue where your build on the preview environment fails due to be unable to log in with a valid username and password. The issue occurs because the redirect URI does not get set properly. Make sure that the VPN is up whilst running this script.

Usage

Either replace '"$1"' with your PR number or save the script (such as letMeLogin.sh) and call it using:

./letMeLogin <PR_NUM>

Script

#!/usr/bin/env bashexport https_proxy=proxyout.reform.hmcts.net:8080
​
curl -X PATCH \
  https://idam-api.aat.platform.hmcts.net/testing-support/services/CCD \
  -H 'Content-Type: application/json' \
  -d '[ {
    "operation": "add",
    "field": "redirect_uri",
    "value": "https://case-management-web-fpl-case-service-pr-'"$1"'.service.core-compute-preview.internal/oauth2redirect"
    } ]'export https_proxy=