Skip to content

Commit

Permalink
fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
vzakharchenko committed Jul 18, 2021
1 parent 8911b7c commit 9a66e87
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 35 deletions.
56 changes: 28 additions & 28 deletions Adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
AdapterDependencies,
AdapterContent,
updateOptions,
} from './typescript/Options';
import { SecurityAdapter } from './typescript/adapters/SecurityAdapter';
import { ApigatewayAdapter, DefaultApigatewayAdapter } from './typescript/adapters/ApigatewayAdapter';
import { ServiceAccount } from './typescript/serviceaccount/ServiceAccount';
import { DefaultMiddlewareAdapter, MiddlewareAdapter } from './typescript/adapters/MiddlewareAdapter';
import { JWKS } from './typescript/jwks/JWKS';
} from './src/Options';
import {SecurityAdapter} from './src/adapters/SecurityAdapter';
import {ApigatewayAdapter, DefaultApigatewayAdapter} from './src/adapters/ApigatewayAdapter';
import {ServiceAccount} from './src/serviceaccount/ServiceAccount';
import {DefaultMiddlewareAdapter, MiddlewareAdapter} from './src/adapters/MiddlewareAdapter';
import {JWKS} from './src/jwks/JWKS';

export interface KeycloakAdapter {
getDefaultAdapter(): SecurityAdapter;
Expand All @@ -23,33 +23,33 @@ export interface KeycloakAdapter {
}

export default class DefaultKeycloakAdapter implements KeycloakAdapter {
options: AdapterContent;
options: AdapterContent;

constructor(options: AdapterDependencies) {
this.options = updateOptions(options);
}
constructor(options: AdapterDependencies) {
this.options = updateOptions(options);
}

getJWKS(): JWKS {
return this.options.jwks;
}
getJWKS(): JWKS {
return this.options.jwks;
}

getServiceAccount(): ServiceAccount {
return this.options.serviceAccount;
}
getServiceAccount(): ServiceAccount {
return this.options.serviceAccount;
}

getAPIGateWayAdapter(): ApigatewayAdapter {
return new DefaultApigatewayAdapter(this.options);
}
getAPIGateWayAdapter(): ApigatewayAdapter {
return new DefaultApigatewayAdapter(this.options);
}

getAWSLambdaAdapter(): ApigatewayAdapter {
return this.getAPIGateWayAdapter();
}
getAWSLambdaAdapter(): ApigatewayAdapter {
return this.getAPIGateWayAdapter();
}

getDefaultAdapter(): SecurityAdapter {
return this.options.securityAdapter;
}
getDefaultAdapter(): SecurityAdapter {
return this.options.securityAdapter;
}

getExpressMiddlewareAdapter(): MiddlewareAdapter {
return new DefaultMiddlewareAdapter(this.options);
}
getExpressMiddlewareAdapter(): MiddlewareAdapter {
return new DefaultMiddlewareAdapter(this.options);
}
}
2 changes: 1 addition & 1 deletion examples/keycloak-authorizer/serverless-jwks/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import fs from 'fs';

import jsonwebtoken from 'jsonwebtoken';
import KeycloakAdapter from 'keycloak-lambda-authorizer';
import {AdapterContent, KeycloakJsonStructure, RequestContent} from "keycloak-lambda-authorizer/dist/src/Options";

import {getAuthentication} from '../serverless/authorizerUtil';
import {AdapterContent, KeycloakJsonStructure, RequestContent} from "../../../typescript/Options";

import {publicKey, privateKey} from './rsaUtils';

Expand Down
3 changes: 1 addition & 2 deletions examples/keycloak-authorizer/serverless/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import fs from 'fs';

import jsonwebtoken from 'jsonwebtoken';
import KeycloakAdapter from 'keycloak-lambda-authorizer';

import {AdapterContent, KeycloakJsonStructure, RequestContent} from '../../../typescript/Options';
import {AdapterContent, KeycloakJsonStructure, RequestContent} from 'keycloak-lambda-authorizer/dist/src/Options';

import {getAuthentication} from './authorizerUtil';

Expand Down
6 changes: 6 additions & 0 deletions examples/keycloak-authorizer/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ app.set('views', path.join(__dirname, 'views'));

function renderUI(request:any, response:any, data:any) {
response.render('home', {
// eslint-disable-next-line no-process-env
host: process.env.LAMBDA_URL,
// eslint-disable-next-line no-process-env
hostJwks: process.env.LAMBDA_JWKS_URL,
...data,
});
Expand Down Expand Up @@ -75,6 +77,7 @@ app.post('/lambda', keycloak.protect(), keycloak.enforcer(['uiResource']), async
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-process-env
const res = await fetchData(process.env.LAMBDA_URL, 'GET', {
Authorization: `Bearer ${lambdaJWT.access_token}`,
});
Expand All @@ -98,6 +101,7 @@ app.post('/lambdaEnt', keycloak.protect(), keycloak.enforcer(['uiResource']), as
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-process-env
const res = await fetchData(process.env.LAMBDA_URL, 'GET', {
Authorization: `Bearer ${lambdaJWT.access_token}`,
});
Expand All @@ -121,6 +125,7 @@ app.post('/lambdaJwks', keycloak.protect(), keycloak.enforcer(['uiResource']), a
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-process-env
const res = await fetchData(process.env.LAMBDA_JWKS_URL, 'GET', {
Authorization: `Bearer ${lambdaJWT.access_token}`,
});
Expand All @@ -143,6 +148,7 @@ app.post('/lambdaJwksEnt', keycloak.protect(), keycloak.enforcer(['uiResource'])
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-process-env
const res = await fetchData(process.env.LAMBDA_JWKS_URL, 'GET', {
Authorization: `Bearer ${lambdaJWT.access_token}`,
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"scripts": {
"test": "jest --verbose --maxWorkers=2 --coverage --coverageDirectory=.coverage/",
"build": "tsc --build",
"lint": "eslint --quiet --ext .ts typescript",
"lint:fix": "eslint --fix --quiet --ext .ts typescript"
"lint": "eslint --quiet --ext .ts src",
"lint:fix": "eslint --fix --quiet --ext .ts src"
},
"repository": {
"type": "git",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
},
"exclude": [
"examples/**",
"example/**",
"src",
"__tests__",
]
}

0 comments on commit 9a66e87

Please sign in to comment.