-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #280 from atls/feat/bump-keto-dependencies-versions
Update keto dependencies versions
- Loading branch information
Showing
163 changed files
with
1,309 additions
and
2,757 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-123 KB
.yarn/cache/@apollo-query-planner-npm-0.2.3-66297845b0-6bb0d5833d.zip
Binary file not shown.
Binary file removed
BIN
-17.4 KB
.yarn/cache/@ardatan-aggregate-error-npm-0.0.6-0f1d22ed0c-203e254952.zip
Binary file not shown.
Binary file removed
BIN
-134 KB
.yarn/cache/@graphql-tools-merge-npm-6.2.14-5b9e215cc7-4be40aa42c.zip
Binary file not shown.
Binary file removed
BIN
-92.9 KB
.yarn/cache/@graphql-tools-schema-npm-7.1.5-8ccd3263e7-17e7ec8fb8.zip
Binary file not shown.
Binary file removed
BIN
-401 KB
.yarn/cache/@graphql-tools-utils-npm-7.10.0-475b037855-c80b4866d0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-12.7 KB
.yarn/cache/@nestjs-mapped-types-npm-0.4.1-29e5471964-818d5a8485.zip
Binary file not shown.
Binary file added
BIN
+33.9 KB
.yarn/cache/@ory-keto-client-npm-0.11.0-alpha.0-defb7469db-a58f56632f.zip
Binary file not shown.
Binary file removed
BIN
-176 KB
.yarn/cache/@oryd-keto-client-npm-0.5.6-alpha.1-98dd6315f3-fe7855a018.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-4.55 KB
.yarn/cache/@types-tough-cookie-npm-4.0.1-3e523463ac-82906e88f7.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-16.2 KB
.yarn/cache/apollo-server-env-npm-3.2.0-rc.0-031066cfd1-af4228daaa.zip
Binary file not shown.
Binary file removed
BIN
-35.5 KB
.yarn/cache/apollo-server-testing-npm-2.25.2-85a171c5be-8bafae85be.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-8.2 KB
.yarn/cache/babel-plugin-transform-es2015-block-scoping-npm-6.26.0-e105a6ceb3-406255c6ec.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-8.97 KB
.yarn/cache/regenerator-runtime-npm-0.11.1-a31e4f8dcd-14664043fb.zip
Binary file not shown.
Binary file removed
BIN
-13.9 KB
.yarn/cache/regexp.prototype.flags-npm-1.3.1-f0c34f894f-764bd6e49c.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-25.5 KB
.yarn/cache/source-map-support-npm-0.4.18-cf66202fc8-a2d71e33f3.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.27 MB
.yarn/cache/web-streams-polyfill-npm-3.2.1-835bd3857e-d0b6246240.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/dataloader/src/interfaces/nest-dataloader.interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import DataLoader from 'dataloader' | ||
|
||
export interface NestDataLoader { | ||
generateDataLoader(): DataLoader<any,any> | ||
generateDataLoader(): DataLoader<any, any> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from './guarded-by-keto.decorator' | ||
export { GuardedByKetoFunction } from './guarded-by-keto.interfaces' | ||
export * from './guarded-by-keto.decorator' | ||
export { GuardedByKetoFunction } from './guarded-by-keto.interfaces' | ||
export { GetGuardingRelationTuple } from './guarded-by-keto.interfaces' | ||
export { GUARDED_BY_METADATA_KEY } from './guarded-by-keto.constants' | ||
export { GUARDED_BY_METADATA_KEY } from './guarded-by-keto.constants' | ||
export { getGuardingRelationTuple } from './get-guarding-relation.helper' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './keto-integration.module' |
21 changes: 21 additions & 0 deletions
21
packages/keto/integration/src/keto-integration.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { UseGuards } from '@nestjs/common' | ||
import { Controller } from '@nestjs/common' | ||
import { Get } from '@nestjs/common' | ||
|
||
import { GuardedByKeto } from '../../src' | ||
import { KetoGuard } from '../../src' | ||
|
||
@Controller() | ||
export class KetoIntegrationController { | ||
@Get('/allowed') | ||
async allow() { | ||
return true | ||
} | ||
|
||
@Get('/protected-by-keto') | ||
@GuardedByKeto((user) => `Group:admin#members@${user}`) | ||
@UseGuards(KetoGuard) | ||
async protect() { | ||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Module } from '@nestjs/common' | ||
|
||
import { KetoModule } from '../../src' | ||
import { KetoIntegrationController } from './keto-integration.controller' | ||
|
||
@Module({ | ||
imports: [ | ||
KetoModule.register({ | ||
basePath: '127.0.0.1:4466', | ||
}), | ||
], | ||
controllers: [KetoIntegrationController], | ||
}) | ||
export class KetoIntegrationModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import { INestApplication } from '@nestjs/common' | ||
import { TestingModule } from '@nestjs/testing' | ||
import { Test } from '@nestjs/testing' | ||
import getPort from 'get-port' | ||
|
||
import request from 'supertest' | ||
import { Network } from 'testcontainers' | ||
import { Wait } from 'testcontainers' | ||
import { StartedTestContainer } from 'testcontainers' | ||
import { GenericContainer } from 'testcontainers' | ||
|
||
import { KETO_MODULE_CONFIGURATION } from '../../src' | ||
import { KetoIntegrationModule } from '../src' | ||
import { KETO_WRITE_PORT } from './test.constants' | ||
import { KETO_READ_PORT } from './test.constants' | ||
import { KETO_FILES } from './test.constants' | ||
import { KETO_ENVIRONMENT } from './test.constants' | ||
import { DB_PORT } from './test.constants' | ||
import { DB_ENVIRONMENT } from './test.constants' | ||
import { KETO_START_COMMAND } from './test.constants' | ||
import { KETO_INIT_COMMAND } from './test.constants' | ||
import { KETO_MIGRATE_COMMAND } from './test.constants' | ||
|
||
jest.setTimeout(25000) | ||
|
||
describe('Keto read client', () => { | ||
let app: INestApplication | ||
let url: string | ||
let module: TestingModule | ||
|
||
let dbContainer: StartedTestContainer | ||
let ketoContainer: StartedTestContainer | ||
|
||
beforeAll(async () => { | ||
const port = await getPort() | ||
|
||
const network = await new Network().start() | ||
|
||
dbContainer = await new GenericContainer('bitnami/postgresql') | ||
.withWaitStrategy(Wait.forLogMessage('database system is ready to accept connections')) | ||
.withEnvironment(DB_ENVIRONMENT) | ||
.withNetwork(network) | ||
.withNetworkAliases('db') | ||
.withExposedPorts(DB_PORT) | ||
.start() | ||
|
||
await new GenericContainer('oryd/keto') | ||
.withEnvironment(KETO_ENVIRONMENT) | ||
.withCopyFilesToContainer(KETO_FILES) | ||
.withNetwork(network) | ||
.withCommand(KETO_MIGRATE_COMMAND) | ||
.start() | ||
|
||
ketoContainer = await new GenericContainer('oryd/keto') | ||
.withEnvironment(KETO_ENVIRONMENT) | ||
.withCopyFilesToContainer(KETO_FILES) | ||
.withNetwork(network) | ||
.withExposedPorts(KETO_READ_PORT, KETO_WRITE_PORT) | ||
.withCommand(KETO_START_COMMAND) | ||
.start() | ||
|
||
await ketoContainer.exec(KETO_INIT_COMMAND) | ||
|
||
module = await Test.createTestingModule({ | ||
imports: [KetoIntegrationModule], | ||
}) | ||
.overrideProvider(KETO_MODULE_CONFIGURATION) | ||
.useValue({ | ||
basePath: `http://${ketoContainer.getHost()}:${ketoContainer.getMappedPort(KETO_READ_PORT)}`, | ||
}) | ||
.compile() | ||
|
||
app = module.createNestApplication() | ||
|
||
await app.init() | ||
await app.listen(port) | ||
|
||
url = await app.getHttpServer() | ||
}) | ||
|
||
afterAll(async () => { | ||
await app.close() | ||
|
||
await dbContainer.stop() | ||
await ketoContainer.stop() | ||
}) | ||
|
||
it('allowed', async () => request(url).get('/allowed').expect(200)) | ||
|
||
it('allows if relation tuple is ok', async () => | ||
request(url).get('/protected-by-keto').set('x-user', 'testUser').expect(200)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: v0.11.1-alpha.0 | ||
|
||
dsn: memory | ||
|
||
serve: | ||
read: | ||
host: 0.0.0.0 | ||
cors: | ||
enabled: false | ||
allow_credentials: true | ||
debug: true | ||
write: | ||
host: 0.0.0.0 | ||
cors: | ||
enabled: false | ||
allow_credentials: true | ||
debug: true | ||
|
||
opl: | ||
host: localhost | ||
cors: | ||
enabled: false | ||
allow_credentials: true | ||
debug: true | ||
|
||
namespaces: | ||
location: file:///home/ory/namespaces.keto.ts | ||
|
||
log: | ||
level: debug | ||
format: text | ||
leak_sensitive_values: true | ||
|
||
$schema: file:///config/keto/schema.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
|
||
// @ts-ignore | ||
class User implements Namespace {} | ||
|
||
// @ts-ignore | ||
class Group implements Namespace { | ||
related: { | ||
members: User[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"namespace": "Group", | ||
"object": "admin", | ||
"relation": "members", | ||
"subject_id": "testUser" | ||
} |
Oops, something went wrong.