-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
server/data/hmppsAuthClient.ts
Outdated
) | ||
|
||
return superagent | ||
.post(`${hmppsAuthUrl}/oauth/token`) | ||
.set('Authorization', clientToken) | ||
.set('content-type', 'application/x-www-form-urlencoded') | ||
.send(authRequest) | ||
.send(new URLSearchParams(grantRequest).toString()) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
server/data/hmppsAuthClient.ts
Outdated
|
||
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}'` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment
cf8094f
to
6d0cb5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* 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
No description provided.