Skip to content

Commit

Permalink
Merge branch 'master' into august-blog
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Sep 3, 2024
2 parents dc3ff1f + dd0a977 commit a921a44
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 544 deletions.
40 changes: 40 additions & 0 deletions config/AMBASSADORS_MEMBERS.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,5 +686,45 @@
"link": "https://www.asyncapi.com/casestudies/hdiglobal"
}
]
},
{
"name": "Lorna Mitchell",
"bio": "Lorna is based in Yorkshire, UK; she is a technology leader and expert in developer experience, passionate about enhancing APIs and developer tools. In her day job as VP of Developer Experience at Redocly, she works on API and documentation tools for technical teams. Lorna is a published author and a regular speaker at conferences, sharing her insights on a variety of tech-related topics. Lorna serves on the OpenUK board, is on the Technical Steering Committee for OpenAPI specification, and maintains open source projects. To learn more about Lorna's activities, visit her website at https://lornajane.net.",
"title": "APIs and Open Source",
"img": "https://lornajane.net/wp-content/uploads/2011/08/IMG_9410-smaller.jpg",
"github": "lornajane",
"twitter": "lornajane",
"linkedin": "lornajane",
"company": "Redocly",
"country": "UK",
"contributions": [
{
"type": "presentation",
"title": "API Governance for AsyncAPI",
"date": {
"year": 2023,
"month": "September"
},
"link": "https://noti.st/lornajane/aOuXwe/api-governance-for-asyncapi"
},
{
"type": "presentation",
"title": "AsyncAPI for Apache Kafka",
"date": {
"year": 2021,
"month": "May"
},
"link": "https://videos.confluent.io/watch/hzjXP8QmLtYRNPukNFUu2D?"
},
{
"type": "article",
"title": "Lint AsyncAPI with Redocly CLI",
"date": {
"year": 2023,
"month": "August"
},
"link": "https://redocly.com/docs/cli/guides/lint-asyncapi"
}
]
}
]
47 changes: 46 additions & 1 deletion config/finance/2024/Expenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ January:
- Category: AsyncAPI Conf on Tour 2023
Amount: '318.98'
February:
- Category: Bounty Program
Amount: '400.00'
- Category: JSON Schema Sponsorship
Amount: '250.00'
- Category: Community Manager
Expand Down Expand Up @@ -50,4 +52,47 @@ May:
- Category: Mentorship Program 2023
Amount: '825.00'
- Category: Swag Store
Amount: '526.51'
Amount: '526.51'
- Category: Bounty Program
Amount: '800.00'
- Category: Community Marketing Specialist
Amount: '1000.00'
June:
- Category: JSON Schema Sponsorship
Amount: '250.00'
- Category: Community Manager
Amount: '2000.00'
- Category: Community Marketing Specialist
Amount: '2000.00'
- Category: Bounty Program
Amount: '800.00'
- Category: Swag Store
Amount: '526.51'
July:
- Category: JSON Schema Sponsorship
Amount: '250.00'
- Category: Community Manager
Amount: '2000.00'
- Category: Bounty Program
Amount: '1000.00'
- Category: Swag Store
Amount: '526.51'
- Category: Community Marketing Specialist
Amount: '2000.00'
- Category: AsyncAPI Conf on Tour 2024
Amount: '2083.41'
August:
- Category: JSON Schema Sponsorship
Amount: '250.00'
- Category: Community Manager
Amount: '2000.00'
- Category: Bounty Program
Amount: '1600.00'
- Category: Swag Store
Amount: '2556.42'
- Category: Community Marketing Specialist
Amount: '2000.00'
- Category: 3rd Party Services
Amount: '1354.35'
- Category: AsyncAPI Conf on Tour 2024
Amount: '1384.70'
5 changes: 4 additions & 1 deletion config/finance/2024/ExpensesLink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@
link: "https://github.com/orgs/asyncapi/discussions/689"

- category: "JSON Schema Sponsorship"
link: "https://github.com/orgs/asyncapi/discussions/1017"
link: "https://github.com/orgs/asyncapi/discussions/1017"

- category: "Community Marketing Specialist"
link: "https://github.com/orgs/asyncapi/discussions/1176"
5 changes: 5 additions & 0 deletions markdown/docs/tools/cli/metrics_collection.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: 'Metrics Collection'
weight: 60
---

# Metrics collection guideline

AsyncAPI **anonymously** tracks command executions to improve the specification and tools, ensuring no sensitive data reaches our servers. It aids in comprehending how AsyncAPI tools are used and adopted, facilitating ongoing improvements to our specifications and tools.
Expand Down
97 changes: 47 additions & 50 deletions markdown/docs/tools/glee/authentication.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
---
title: 'Authentication functions'
title: 'Authentication Functions'
weight: 70
---

# Getting started with Authentication functions
# Getting Started with Authentication Functions

Authentication in Glee can be done using authentication functions. Authentication functions are files that export either one or both of the `clientAuth` and `serverAuth` Node.js functions:
Authentication in Glee can be implemented using authentication functions. These functions are files that export one or both of the following Node.js functions: `clientAuth` and `serverAuth`:

```js
/* websocket.js */

export async function serverAuth({ authProps, done }) {
//server auth logic
// Server authentication logic
}

export async function clientAuth({ parsedAsyncAPI, serverName }) {
//client auth logic
// Client authentication logic
}
```

Glee looks for authentication files in the `auth` directory by default but it can be configured using [glee config file](env-vars-config).
The name of the authentication file should be the name of the targeted server that the authentication logic should work for.
Glee searches for authentication files in the `auth` directory by default. However, this can be configured using the [glee config file](env-vars-config). The authentication file's name should match the targeted server for which the authentication logic is intended.

## Supported Authentication Values in asyncapi.yaml file
## Supported Authentication Values in the asyncapi.yaml File

AsyncAPI currently supports a variety of authentication formats as specified in the [documentation](https://www.asyncapi.com/docs/reference/specification/v3.0.0#securitySchemeObject), however Glee supports the following authentication schemas.
AsyncAPI supports a variety of authentication formats as specified in its [documentation](https://www.asyncapi.com/docs/reference/specification/v3.0.0#securitySchemeObject). Glee, however, supports the following authentication schemas:

- userPassword
- http ("bearer")
- httpApiKey
- Oauth2

A sample `asyncapi.yaml` for a **server** with security requirements and a `userPassword` security schemes is shown below:
Below is an example of a `asyncapi.yaml` file for a **server** with security requirements and a `userPassword` security scheme:

```yaml
##server asyncAPI schema
## Server AsyncAPI Schema
asyncapi: 3.0.0
info:
title: AsyncAPI IMDB server
title: AsyncAPI IMDB Server
version: 1.0.0
description: This app is a dummy server that would stream the trending/upcoming anime.
description: This app is a dummy server that streams trending/upcoming anime.
servers:
trendingAnimeServer:
host: 'localhost:8081'
Expand All @@ -53,13 +52,12 @@ components:
securitySchemes:
userPass:
type: userPassword

```
A sample `asyncapi.yaml` for a **client** that implements some of the requirements of the server above is as follows:
Here's an example for a **client** that implements some requirements of the server mentioned above:
```yaml
##client asyncAPI schema
## Client AsyncAPI Schema
servers:
trendingAnime:
host: localhost:8081
Expand All @@ -78,29 +76,28 @@ components:
securitySchemes:
userPass:
type: userPassword

```
Glee can act as both a server and a client. So the need for `serverAuth` and `clientAuth`. Glee acts as a client when the server name is included in the `x-remoteServers` property in the `asyncapi.yaml` file.
Glee can function as both a server and a client. Hence, the need for both `serverAuth` and `clientAuth` functions arises. Glee acts as a client when the server name is included in the `x-remoteServers` property in the `asyncapi.yaml` file.

When Glee acts as a client, it can connect to a Glee server, and when Glee acts as a server it accepts connections from other Glee clients. Hence a Glee application can both accept connections from clients while also sending requests to other Glee applications (servers) at the same time.
When Glee operates as a client, it can connect to a Glee server. Conversely, as a server, it accepts connections from other Glee clients. Thus, a Glee application can accept connections from clients while also sending requests to other Glee servers.

When a security requirement is specified in the `asyncapi.yaml` file and Glee acts as a server, the `serverAuth` function should be implemented, if Glee acts as a client then the `clientAuth` function should be implemented. If Glee is being used as both client and server, then it should have both the `clientAuth` and `serverAuth` functions.
If a security requirement is specified in the `asyncapi.yaml` file, and Glee acts as a server, the `serverAuth` function should be implemented. If Glee acts as a client, then `clientAuth` should be implemented. If Glee is used as both client and server, both functions are necessary.

## Server Authentication in Glee

The `serverAuth` function takes an argument that can be destructured as follows
The `serverAuth` function takes an argument that can be destructured as follows:

| Attribute | Description |
| ---------- | --------------------------------------------------------------- |
| done | The done function that tells the server to proceed. |
| authProps | The authentication parameters recieved from the client. |
| serverName | The name of the server/broker from which the event was emitted. |
| doc | The parsedAsyncAPI schema |
| done | The function that signals the server to proceed. |
| authProps | The authentication parameters received from the client. |
| serverName | The name of the server/broker emitting the event. |
| doc | The parsed AsyncAPI schema. |

#### done() function
#### done() Function

The `done()` parameter in the `serverAuth` function allows the broker/server to know what to do next depending on the boolean value you pass to it.
The `done()` parameter in the `serverAuth` function signals to the broker/server what action to take next, based on the boolean value passed.

```js
/* websocket.js */
Expand All @@ -113,22 +110,22 @@ export async function serverAuth({ authProps, done }) {
}
}
```

**Parameters for done():**

*Authentication Result (Boolean): true for success, false for failure.*
- Authentication Result (Boolean): `true` for success, `false` for failure.

When `true` is passed to the done parameter, the server/broker knows to go ahead and allow the client to connect, which means authentication has succeeded. However if the `done` parameter is called with `false` then the server knows to throw an error message and reject the client, which means authentication has failed.
Passing `true` to the `done` parameter indicates that authentication has succeeded, and the server/broker can proceed to allow the client to connect. Conversely, if `false` is passed, the server will reject the client, indicating failed authentication.

`done()` should always be the last thing called in a `serverAuth` function, Glee won't execute any logic beyond the `done()` call.
The `done()` call should always be the last in the `serverAuth` function, as Glee will not execute any logic beyond this call.

#### authProps

`authProps` implements a couple of methods that allows the server to retrieve the authentication parameters from the client, below are the current available methods;
The `authProps` parameter includes methods for the server to retrieve authentication parameters from the client. The current available methods are as follows:

```js
export async function serverAuth({ authProps, done }) {
//some network request

// Some network request
authProps.getOauthToken()
authProps.getHttpAPIKeys('api_key')
authProps.getToken()
Expand All @@ -140,23 +137,23 @@ export async function serverAuth({ authProps, done }) {

| Method | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------ |
| `getOauthToken()` | returns the oauth authentication parameter |
| `getHttpAPIKeys(name)` | returns the HttpAPIKeys parameter with the specified name from either headers or query parameter |
| `getToken()` | returns the http bearer token parameter |
| `getUserPass()` | returns username and password parameters |
| `getOauthToken()` | Returns the OAuth authentication parameter. |
| `getHttpAPIKeys(name)` | Returns the HttpAPIKeys parameter with the specified name from either headers or query parameter |
| `getToken()` | Returns the HTTP bearer token parameter. |
| `getUserPass()` | Returns username and password parameters. |

## Client Authentication in Glee

The `clientAuth` function also takes an argument, and it's argument can be destructured as follows
The `clientAuth` function also takes an argument that can be destructured as follows:

| Attribute | Description |
| -------------- | ------------------------------------------------------------------------------------- |
| parsedAsyncAPI | The parsedAsyncAPI schema. |
| serverName | The name of the server/broker from with the authentication parameters are being sent. |
| parsedAsyncAPI | The parsed AsyncAPI schema. |
| serverName | The server/broker's name from which the authentication parameters are being sent. |

### Possible authentication parameters
### Possible Authentication Parameters

The possible authentication parameters are shown in the code snippet below:
The code snippet below illustrates the possible authentication parameters:

```js
export async function clientAuth({ serverName }) {
Expand All @@ -165,18 +162,18 @@ export async function clientAuth({ serverName }) {
oauth: process.env.OAUTH2,
apiKey: process.env.APIKEY,
userPass: {
user: process.env.user,
password: process.env.password,
user: process.env.USER,
password: process.env.PASSWORD,
},
}
}
```

The name of the authentication parameters should be the same as **the names specified in the `asyncapi.yaml` file.**
The names of the authentication parameters should match **the names specified in the `asyncapi.yaml` file**.

| auth type | values |
| Auth Type | Values |
| ------------------------------------- | ---------------------------------------------------------------------- |
| http bearer (JWT) | Value should be a JWT string |
| Oauth2 | The value should should be a string |
| httpApiKey in headers or query params | The value should be a string |
| userPass | The value should be an object with the user and password as properties |
| HTTP bearer (JWT) | Value should be a JWT string. |
| OAuth2 | Value should be a string. |
| httpApiKey in headers or query params | Value should be a string. |
| userPass | Value should be an object with the user and password as properties. |
Loading

0 comments on commit a921a44

Please sign in to comment.