Skip to content
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

SDI-88: 🚨 Fix querystring warning #87

Merged
merged 2 commits into from
May 12, 2022

Conversation

petergphillips
Copy link
Contributor

No description provided.

)

return superagent
.post(`${hmppsAuthUrl}/oauth/token`)
.set('Authorization', clientToken)
.set('content-type', 'application/x-www-form-urlencoded')
.send(authRequest)
.send(new URLSearchParams(grantRequest).toString())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to url search params instead

@@ -44,17 +42,17 @@ export interface UserRole {
export default class HmppsAuthClient {
constructor(private readonly tokenStore: TokenStore) {}

private restClient(token: string): RestClient {
private static restClient(token: string): RestClient {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intellij suggestion as could be static


logger.info(
`HMPPS Auth request '${authRequest}' for client id '${config.apis.hmppsAuth.systemClientId}' and user '${username}'`
`HMPPS Auth request '${grantRequest}' for client id '${config.apis.hmppsAuth.systemClientId}' and user '${username}'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related I know, but maybe move grantRequest to be the first param? I think these ${} placeholders just emit 'object' or similar if it is an oject rather than a string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it will potentially include username twice?, or username undefined

That message is a bit weird generally

Copy link
Contributor Author

@petergphillips petergphillips May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot @steverendell. Now fixed to output

13:28:37.135Z  INFO: grant_type=client_credentials&username=Bob HMPPS Auth request for client id 'clientid''
13:28:37.139Z  INFO: grant_type=client_credentials HMPPS Auth request for client id 'clientid''

steverendell
steverendell previously approved these changes May 11, 2022
Copy link
Contributor

@steverendell steverendell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment

Copy link
Contributor

@steverendell steverendell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@petergphillips petergphillips merged commit 6676e3a into main May 12, 2022
@petergphillips petergphillips deleted the pgp-SDI-88-remove-querystring branch May 12, 2022 13:40
tpmcgowan added a commit to ministryofjustice/book-a-prison-visit-staff-ui that referenced this pull request May 17, 2022
psoleckimoj pushed a commit to ministryofjustice/book-a-prison-visit-staff-ui that referenced this pull request May 18, 2022
* Fix query string warning

From ministryofjustice/hmpps-template-typescript#87

* Remove stray @types/cookie-session dev dependency

* Tidy up mocks and switch to multiplatform builds

From ministryofjustice/hmpps-template-typescript#89

* Allow async get to take an array of path strings

From ministryofjustice/hmpps-template-typescript#90

* Switch to using AppInsights connection string

From ministryofjustice/hmpps-template-typescript#91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants