Skip to content

Commit

Permalink
Merge pull request #50 from aserto-dev/fix-typos
Browse files Browse the repository at this point in the history
fix cSpell typos
  • Loading branch information
gimmyxd authored Nov 25, 2023
2 parents d9899b6 + 1951aa1 commit 7bc65f5
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"cSpell.words": [
"apikey",
"aserto",
"bufbuild",
"codecov",
"connectrpc",
"displaystatemap",
"keyof",
"morty",
"njwt",
"protobuf",
"rebac",
"Rego",
"Struct",
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ package.
This package provides multiple capabilities:

1. `Middleware` - Provides 2 implementations: `Authz` and `Check` middlewares that sits on a route, and validates a request to authorize access to that route.
2. `Authorizer` - Authorizer Client that provides functions to facilitate comunication with an Authorizer v2 service.
3. `DirectoryServiceV3` - Directory Client that provides functions to facilitate comunication with an Directory v3 service.
4. `DirectoryServiceV2` - Directory Client that provides functions to facilitate comunication with an Directory v2 service.
2. `Authorizer` - Authorizer Client that provides functions to facilitate communication with an Authorizer v2 service.
3. `DirectoryServiceV3` - Directory Client that provides functions to facilitate communication with an Directory v3 service.
4. `DirectoryServiceV2` - Directory Client that provides functions to facilitate communication with an Directory v2 service.
5. `jwtAuthz`(deprecated): middleware that sits on a route, and validates a request to authorize access to that route.
6. `displayStateMap`: middleware that adds an endpoint for returning the display state map for a service, based on its authorization policy.
7. `is`: a function that can be called to make a decision about a user's access to a resource based on a policy.
Expand Down Expand Up @@ -68,11 +68,11 @@ const authClient = new Authorizer({
```ts
import { getSSLCredentials } from "@aserto/aserto-node";

const ssLcredentials = getSSLCredentials(`${process.env.HOME}/.config/topaz/certs/grpc-ca.crt`)
const sslCredentials = getSSLCredentials(`${process.env.HOME}/.config/topaz/certs/grpc-ca.crt`)

const authClient = new Authorizer({
authorizerServiceUrl: "localhost:8282",
}, ssLcredentials);
}, sslCredentials);
```

#### Example:
Expand Down Expand Up @@ -357,7 +357,7 @@ const restMw = new Middleware({
##### Resource

```ts
// provies a custom resource context,
// provides a custom resource context,
type ResourceMapper =
| ResourceContext
| ((req?: Request) => Promise<ResourceContext>);
Expand Down
4 changes: 2 additions & 2 deletions lib/authorizer/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Policy = {
root: string;
name?: string;
instanceLabel?: string;
decission?: string;
decision?: string;
path?: string;
};

Expand Down Expand Up @@ -101,7 +101,7 @@ export class Middleware {
const policyCtx = this.policyMapper
? await this.policyMapper(req)
: policyContext(`${this.policy.root}.check`, [
this.policy.decission || "allowed",
this.policy.decision || "allowed",
]);

let resourceContext: ResourceContext = await checkResourceMapper(
Expand Down
4 changes: 2 additions & 2 deletions lib/authorizer/model/policyInstance.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PolicyInstance } from "@aserto/node-authorizer/pkg/aserto/authorizer/v2/api/policy_instance_pb";

const policyInstance = (instaneName: string, instanceLabel: string) => {
const policyInstance = (instanceName: string, instanceLabel: string) => {
const policyInstance = new PolicyInstance();
policyInstance.setInstanceLabel(instanceLabel);
policyInstance.setName(instaneName);
policyInstance.setName(instanceName);

return policyInstance;
};
Expand Down
16 changes: 8 additions & 8 deletions lib/directory/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class Directory {
nodeOptions: { rejectUnauthorized },
});
}
return baseGrpcTansport;
return baseGrpcTransport;
};

const baseServiceUrl = config.url ?? "directory.prod.aserto.com:8443";
Expand Down Expand Up @@ -171,24 +171,24 @@ export class Directory {
rejectUnauthorized = config.rejectUnauthorized;
}

const baseGrpcTansport = createGrpcTransport({
const baseGrpcTransport = createGrpcTransport({
httpVersion: "2",
baseUrl: `https://${baseServiceUrl}`,
interceptors: [baseServiceHeaders],
nodeOptions: { rejectUnauthorized },
});

const readerGrpcTansport = createTransport(
const readerGrpcTransport = createTransport(
readerServiceUrl,
readerApiKey,
readerTenantId
);
const writerGrpcTansport = createTransport(
const writerGrpcTransport = createTransport(
writerServiceUrl,
writerApiKey,
writerTenantId
);
const importerGrpcTansport = createTransport(
const importerGrpcTransport = createTransport(
importerServiceUrl,
importerApiKey,
importerTenantId
Expand All @@ -199,9 +199,9 @@ export class Directory {
exporterTenantId
);

this.ReaderClient = createPromiseClient(Reader, readerGrpcTansport);
this.WriterClient = createPromiseClient(Writer, writerGrpcTansport);
this.ImporterClient = createPromiseClient(Importer, importerGrpcTansport);
this.ReaderClient = createPromiseClient(Reader, readerGrpcTransport);
this.WriterClient = createPromiseClient(Writer, writerGrpcTransport);
this.ImporterClient = createPromiseClient(Importer, importerGrpcTransport);
this.ExporterClient = createPromiseClient(Exporter, exporterGrpcTransport);
}

Expand Down
16 changes: 8 additions & 8 deletions lib/directory/v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class DirectoryV3 {
nodeOptions: { rejectUnauthorized },
});
}
return baseGrpcTansport;
return baseGrpcTransport;
};

const baseServiceUrl = config.url ?? "directory.prod.aserto.com:8443";
Expand Down Expand Up @@ -140,24 +140,24 @@ export class DirectoryV3 {
rejectUnauthorized = config.rejectUnauthorized;
}

const baseGrpcTansport = createGrpcTransport({
const baseGrpcTransport = createGrpcTransport({
httpVersion: "2",
baseUrl: `https://${baseServiceUrl}`,
interceptors: [baseServiceHeaders],
nodeOptions: { rejectUnauthorized },
});

const readerGrpcTansport = createTransport(
const readerGrpcTransport = createTransport(
readerServiceUrl,
readerApiKey,
readerTenantId
);
const writerGrpcTansport = createTransport(
const writerGrpcTransport = createTransport(
writerServiceUrl,
writerApiKey,
writerTenantId
);
const importerGrpcTansport = createTransport(
const importerGrpcTransport = createTransport(
importerServiceUrl,
importerApiKey,
importerTenantId
Expand All @@ -174,9 +174,9 @@ export class DirectoryV3 {
modelTenantId
);

this.ReaderClient = createPromiseClient(Reader, readerGrpcTansport);
this.WriterClient = createPromiseClient(Writer, writerGrpcTansport);
this.ImporterClient = createPromiseClient(Importer, importerGrpcTansport);
this.ReaderClient = createPromiseClient(Reader, readerGrpcTransport);
this.WriterClient = createPromiseClient(Writer, writerGrpcTransport);
this.ImporterClient = createPromiseClient(Importer, importerGrpcTransport);
this.ExporterClient = createPromiseClient(Exporter, exporterGrpcTransport);
this.ModelClient = createPromiseClient(Model, modelGrpcTransport);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/displayStateMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PolicyMapper,
ResourceMapper,
} from "./authorizer/middleware";
import decissionTreeOptions from "./authorizer/model/decisionTreeOptions";
import decisionTreeOptions from "./authorizer/model/decisionTreeOptions";
import policyContext from "./authorizer/model/policyContext";
import policyInstance from "./authorizer/model/policyInstance";
import { errorHandler } from "./errorHandler";
Expand Down Expand Up @@ -103,7 +103,7 @@ const displayStateMap = (
? policyInstance(instanceName as string, instanceLabel as string)
: undefined;

const decisionTreeOpt = decissionTreeOptions("PATH_SEPARATOR_SLASH");
const decisionTreeOpt = decisionTreeOptions("PATH_SEPARATOR_SLASH");

return client.DecisionTree({
identityContext: identityCtx,
Expand Down

0 comments on commit 7bc65f5

Please sign in to comment.