Skip to content

Commit

Permalink
Fixed error in ip-whitelist-authentication caused by wrong type
Browse files Browse the repository at this point in the history
Updated Loopback dependencies in package.json
Rebuilt yarn.lock
  • Loading branch information
mhaswell-bcgov committed Apr 25, 2024
1 parent 94d2f1d commit b471ecc
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildTestPublishContainerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/bcgov/notify-bc:${{ env.notifyBCContainerTag }}
tags: ghcr.io/bcgov/des-notify-bc:${{ env.notifyBCContainerTag }}
build-args: nodeVersion=${{ vars.NODE_VERSION }}
deploy:
if: ${{ github.repository == 'bcgov/des-notifybc' && github.event_name == 'push' }}
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@
"!*/__tests__"
],
"dependencies": {
"@loopback/authentication": "^10.0.0",
"@loopback/boot": "^6.0.0",
"@loopback/core": "^5.0.0",
"@loopback/openapi-v3": "^9.0.0",
"@loopback/repository": "^6.0.0",
"@loopback/rest": "^13.0.0",
"@loopback/rest-explorer": "^6.0.0",
"@loopback/service-proxy": "^6.0.0",
"@loopback/authentication": "^11.0.0",
"@loopback/boot": "^7.0.0",
"@loopback/core": "^6.0.0",
"@loopback/openapi-v3": "^10.0.0",
"@loopback/repository": "^7.0.0",
"@loopback/rest": "^14.0.0",
"@loopback/rest-explorer": "^7.0.0",
"@loopback/security": "0.11.1",
"@loopback/service-proxy": "^7.0.0",
"async": "^3.0.1",
"bcryptjs": "^2.4.3",
"bottleneck": "^2.19.5",
Expand Down Expand Up @@ -97,9 +98,9 @@
"underscore.string": "^3.3.4"
},
"devDependencies": {
"@loopback/build": "^10.0.0",
"@loopback/eslint-config": "^14.0.0",
"@loopback/testlab": "^6.0.0",
"@loopback/build": "^11.0.0",
"@loopback/eslint-config": "^15.0.0",
"@loopback/testlab": "^7.0.0",
"@types/bcryptjs": "^2.4.2",
"@types/lodash": "^4.14.157",
"@types/morgan": "^1.9.2",
Expand Down
7 changes: 3 additions & 4 deletions src/authn-strategies/ip-whitelist-authentication.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import {securityId, UserProfile} from '@loopback/security';
import {ConfigurationRepository} from '../repositories';

export class IpWhitelistAuthenticationStrategy
implements AuthenticationStrategy
{
implements AuthenticationStrategy {
name = 'ipWhitelist';
constructor(
@inject('repositories.ConfigurationRepository')
public configurationRepository: ConfigurationRepository,
@inject(RestBindings.Http.CONTEXT)
protected httpContext: MiddlewareContext,
) {}
) { }

async authenticate(request: Request): Promise<UserProfile | undefined> {
let userProfile: UserProfile | undefined;
Expand All @@ -39,7 +38,7 @@ export class IpWhitelistAuthenticationStrategy
)
) {
userProfile = {
[securityId]: request.ip,
[securityId]: request?.ip ?? '',
authnStrategy: this.name,
};
}
Expand Down
Loading

0 comments on commit b471ecc

Please sign in to comment.