Skip to content

Commit

Permalink
docusaurs 3 upgrade (#205)
Browse files Browse the repository at this point in the history
* docusaurs 3 upgrade

* update CI

* fix build

* fixed markdown warning

---------

Co-authored-by: Omri Gazitt <[email protected]>
  • Loading branch information
gimmyxd and ogazitt authored Nov 6, 2024
1 parent 96d7301 commit 19a53f8
Show file tree
Hide file tree
Showing 13 changed files with 5,242 additions and 6,027 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will do a clean installation of node dependencies, cache/restore them,and build the source code
# This workflow will do a clean installation of node dependencies, cache/restore them,and build the source code
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js build
Expand All @@ -13,12 +13,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- run: yarn build
- run: yarn build
4 changes: 2 additions & 2 deletions .github/workflows/scrape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Read Configuration
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v3
id: vault
with:
url: https://vault.eng.aserto.com/
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20.17.0
6 changes: 3 additions & 3 deletions docs/authorizer-guide/dir.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The Authorizer makes two APIs available to the calling application for the purpo
interacting with the Edge Directory Service:

- `dir/users`
- `dir/users/{id}`
- `dir/users/\{id\}`

Each of these APIs is a `GET` style API.

Expand Down Expand Up @@ -45,9 +45,9 @@ This will return a list of all users in the system.
}
```

## dir/users/{id}
## dir/users/\{id\}

`GET .../api/v1/dir/users/{id}?params`
`GET .../api/v1/dir/users/\{id\}?params`

This will return the details of a user entry in the Edge Directory Service, by its ID.

Expand Down
10 changes: 5 additions & 5 deletions docs/authorizer-guide/policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Authorizer makes three APIs available to the calling application for the pur
interacting with the Policies modules that are loaded in the Authorizer:

- `policies`
- `policies/{id}`
- `policies/\{id\}`

Each of these APIs is a `GET` style API.

Expand All @@ -25,7 +25,7 @@ This will return a list of all the policies loaded in the Authorizer runtime.
`field_mask=<field1>,<field2>`: the set of fields to return (defaults to ALL if unspecified)

Available fields:
* `id`: the id of the policy module (which can be passed into the `policies/{id}` API)
* `id`: the id of the policy module (which can be passed into the `policies/\{id\}` API)
* `raw`: the raw text of the Rego module
* `package_path`: the path of the package
* `ast`: the parsed abstract syntax tree of the package
Expand All @@ -52,11 +52,11 @@ The results contain all the policy modules, with the specified fields. If no `fi
}
```

## policies/{id}
## policies/\{id\}

`GET .../api/v2/policies/{id}?field_mask=<field1>,<field2>`
`GET .../api/v2/policies/\{id\}?field_mask=<field1>,<field2>`

This will return the details for a particular policy module identified by `{id}`, which can be obtained from the `/api/v2/policies` call.
This will return the details for a particular policy module identified by `\{id\}`, which can be obtained from the `/api/v2/policies` call.

### parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/directory-api-reference/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Each of the Aserto [SDKs](/docs/software-development-kits/overview) contains a s

You can also access these APIs over supported protocols directly:
* [GraphQL](graphql)
* [gRPC](GRPC)
* [gRPC](grpc)


2 changes: 1 addition & 1 deletion docs/getting-started/install-onebox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ If you haven't yet, you can install it using `brew` on Mac or Linux.
brew tap aserto-dev/tap && brew install aserto
```

:::Note
:::note
For Windows (or if you want to download it as a zip file), refer to the [CLI installation page](/docs/command-line-interface/aserto-cli/installation).
:::

Expand Down
26 changes: 13 additions & 13 deletions docs/getting-started/peoplefinder/understanding-policies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A Policy is a collection of rules that govern access to the resources within an

## How Aserto Policies are authored and deployed

Aserto Policies contain a collection of *Policy Modules* which are authored in a declarative language called [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/). The PeopleFinder policy adheres to a convention where a Policy Module exists for each API that needs to be authorized.
Aserto Policies contain a collection of *Policy Modules* which are authored in a declarative language called [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/). The PeopleFinder policy adheres to a convention where a Policy Module exists for each API that needs to be authorized.

Each module contains one or more decisions. All the modules within your application are packaged into a *Policy Image* that is stored in a *Policy Repository* (just like a docker repo). A *Policy Registry* is a collection of Policy Repositories (just like a docker registry). Aserto has a native Policy Registry, but can be configured to use any OCIv2-compliant registry.

Expand All @@ -24,7 +24,7 @@ When it comes time to deploy your application, you can run an authorizer instanc

## How PeopleFinder uses Policies

At runtime, PeopleFinder uses Aserto Policies for multiple things, which are represented by three *decisions*:
At runtime, PeopleFinder uses Aserto Policies for multiple things, which are represented by three *decisions*:

* `visible` - whether elements of the UI should appear at all.
* `enabled` - whether elements are enabled or disabled.
Expand All @@ -46,28 +46,28 @@ PeopleFinder has 6 Policy Modules shown here. Each module is named using a conve

|Module |API Request |
|--------------------------------------|---------------------------------------------------|
|peoplefinder.DELETE.api.users.__id | DELETE /api/users/{id} |
|peoplefinder.DELETE.api.users.__id | DELETE /api/users/\{id\} |
|peoplefinder.GET.api.users | GET /api/users |
|peoplefinder.GET.api.users.__id | GET /api/users/{id} |
|peoplefinder.GET.api.users.__id | GET /api/users/\{id\} |
|peoplefinder.POST.api.users | POST /api/users |
|peoplefinder.POST.api.users.__id | POST /api/users/{id} |
|peoplefinder.PUT.api.users.__id | PUT /api/users/{id} |
|peoplefinder.POST.api.users.__id | POST /api/users/\{id\} |
|peoplefinder.PUT.api.users.__id | PUT /api/users/\{id\} |

In the viewer you can select a module on the left and see the policy [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) code. Each of the PeopleFinder Policy Modules has been documented so you can see how they work.

![peoplefinder-policy-3](/peoplefinder-policy-3.png)

This policy runs when a DELETE request is made to the User API or when elements are rendered for issuing the DELETE. Looking through the code you will policies have four main parts.
This policy runs when a DELETE request is made to the User API or when elements are rendered for issuing the DELETE. Looking through the code you will policies have four main parts.

* The `package` statement - Defines the name of the module.
* The `package` statement - Defines the name of the module.
* Imports - Importing external libraries and data. Imports can be aliased, for example here you can see the user's roles are imported as `user_roles`.
* Decision declaration - Decisions are declared with their default values. In this case `allowed`, `visible`, and `enabled` have been declared as `false`.
* Decision declaration - Decisions are declared with their default values. In this case `allowed`, `visible`, and `enabled` have been declared as `false`.
* Rule definition - Rules are code that executes to determine the outcome of the decision.

This table shows the three decisions that are defined by the policy:

|Decision | Rule |
|---------|--------------------------------------------------------------------------------|
|---------|--------------------------------------------------------------------------------|
|allowed | If the user is an admin |
|visible | If the user is an editor or admin |
|enabled | The result of allowed |
Expand Down Expand Up @@ -97,13 +97,13 @@ Using the Policy Evaluator allows you to conveniently test your policy instantly
* For `Identity Context` select `Subject`. In the Subject dropdown choose 'Euan Garden'. This provides the identity of the caller to the API (the logged in user).
* For `Path` choose `peoplefinder.POST.api.users.__id`. This represents the API that we're evaluating.
* Leave `Decisions` with the default.
* For Resource Context, put ```{ "id": "dfdadc39-7335-404d-af66-c77cf13a15f8" }```. This is Euan's id, the resource that we're updating.
* For Resource Context, put ```{ "id": "dfdadc39-7335-404d-af66-c77cf13a15f8" }```. This is Euan's id, the resource that we're updating.

Press the `Play` button in the top to run the evaluation.
Press the `Play` button in the top to run the evaluation.

![peoplefinder-policy-6](/peoplefinder-policy-6.png)

The result is `false` as expected as Euan is not an admin. Now let's try an admin, Kris Johnsen. In `Identity Context` dropdown select `Kris Johnsen` and then press Play again.
The result is `false` as expected as Euan is not an admin. Now let's try an admin, Kris Johnsen. In `Identity Context` dropdown select `Kris Johnsen` and then press Play again.

![/peoplefinder-policy-7](/peoplefinder-policy-7.png)

Expand Down
4 changes: 2 additions & 2 deletions docs/software-development-kits/java/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ E.g.

## Resource
A resource can be any structured data that the authorization policy uses to evaluate decisions.
By default, the middleware extracts resources from the path parameters. For example if we have a mapping of /user/{id}
By default, the middleware extracts resources from the path parameters. For example if we have a mapping of /user/\{id\}
and we get a request to /user/123, the middleware will extract the resource from the path parameter `id` and use it.

This behavior can be changed by implementing the `ResourceMapper` interface and creating a bean that returns it.
Expand Down Expand Up @@ -138,4 +138,4 @@ aserto.authorizer.grpc.caCertPath=${user.home}/.config/topaz/certs/grpc-ca.crt
#aserto.authorizer.apiKey=<api_key>
```

For a minimal example please see the [Spring example](https://github.com/aserto-dev/aserto-spring/tree/main/examples/java-application).
For a minimal example please see the [Spring example](https://github.com/aserto-dev/aserto-spring/tree/main/examples/java-application).
6 changes: 3 additions & 3 deletions docs/software-development-kits/python/flask.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ aserto = AsertoMiddleware(**aserto_options)
@aserto.authorize
def api_user(id: str) -> Response:
# Raises an AuthorizationError if the `GET.api.users.__id`
# policy returns a decision of "allowed = false"
# policy returns a decision of "allowed = false"
...
```

Expand Down Expand Up @@ -166,14 +166,14 @@ def get_resource(asset: str):

```

GetResource(asset) is an http handler function that serves GET request to the `/resource/<asset>` route. The `check` call only authorizes requests if the calling user has the `can_read` permission on an object of type resource with the object name extracted from the route's {asset} parameter.
GetResource(asset) is an http handler function that serves GET request to the `/resource/<asset>` route. The `check` call only authorizes requests if the calling user has the `can_read` permission on an object of type resource with the object name extracted from the route's \{asset\} parameter.

### Check Options
The `check` function accepts options that configure the object, subject, and relation sent to the authorizer.

```py
def check(
self,
self,
objId: Optional[str] = "",
objType: Optional[str] = "",
objIdMapper: Optional[StringMapper] = None,
Expand Down
5 changes: 3 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const lightCodeTheme = require('prism-react-renderer/themes/github')
const darkCodeTheme = require('prism-react-renderer/themes/dracula')
import {themes as prismThemes} from 'prism-react-renderer';
const lightCodeTheme = prismThemes.github;
const darkCodeTheme = prismThemes.dracula;

// With JSDoc @type annotations, IDEs can provide config autocompletion
/** @type {import('@docusaurus/types').DocusaurusConfig} */
Expand Down
35 changes: 23 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,32 @@
"gqlgen": "docusaurus graphql-to-doc"
},
"dependencies": {
"@docusaurus/core": "^2.4.1",
"@docusaurus/plugin-client-redirects": "^2.4.1",
"@docusaurus/plugin-google-tag-manager": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.1",
"@docusaurus/theme-search-algolia": "^2.4.1",
"@algolia/client-search": "^5.12.0",
"@docusaurus/core": "^3.6.0",
"@docusaurus/logger": "^3.6.0",
"@docusaurus/module-type-aliases": "^3.6.0",
"@docusaurus/plugin-client-redirects": "^3.6.0",
"@docusaurus/plugin-google-tag-manager": "^3.6.0",
"@docusaurus/preset-classic": "^3.6.0",
"@docusaurus/theme-search-algolia": "^3.6.0",
"@graphql-markdown/diff": "^1.0.4",
"@graphql-markdown/docusaurus": "^1.16.3",
"@graphql-tools/graphql-file-loader": "^7.5.14",
"@mdx-js/react": "^1.6.21",
"@mdx-js/react": "^3.1.0",
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
"@svgr/webpack": "^5.5.0",
"@svgr/webpack": "^8.1.0",
"acorn": "^8.14.0",
"clsx": "^1.1.1",
"docusaurus2-dotenv": "^1.4.0",
"file-loader": "^6.2.0",
"graphql": "^16.6.0",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-svg": "^16.1.25",
"prism-react-renderer": "^2.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-is": ">= 16.8.0",
"react-loadable": "^5.5.0",
"react-svg": "^16.1.34",
"search-insights": "^2.17.2",
"url-loader": "^4.1.1"
},
"browserslist": {
Expand All @@ -51,7 +58,11 @@
]
},
"devDependencies": {
"prettier": "^2.7.1"
"@docusaurus/tsconfig": "3.0.0",
"@types/react": "^18.3.12",
"prettier": "^2.7.1",
"typescript": "^5.6.3",
"webpack": "^5.96.1"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 19a53f8

Please sign in to comment.