Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/auth/drivers/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class OAuth2AuthDriver extends BaseOAuthDriver {
email: email,
external_identifier: identifier,
role: this.config['defaultRoleId'],
auth_data: tokenSet.refresh_token && JSON.stringify({ refreshToken: tokenSet.refresh_token }),
auth_data: tokenSet.refresh_token ? JSON.stringify({ refreshToken: tokenSet.refresh_token }) : null,
};

return [tokenSet, userInfo, userPayload];
Expand Down
2 changes: 1 addition & 1 deletion api/src/auth/drivers/openid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class OpenIDAuthDriver extends BaseOAuthDriver {
email: email,
external_identifier: identifier,
role: this.config['defaultRoleId'],
auth_data: tokenSet.refresh_token && JSON.stringify({ refreshToken: tokenSet.refresh_token }),
auth_data: tokenSet.refresh_token ? JSON.stringify({ refreshToken: tokenSet.refresh_token }) : null,
};

return [tokenSet, userInfo, userPayload];
Expand Down
2 changes: 1 addition & 1 deletion api/src/services/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export class AuthorizationService {

for (let i = 0; i < originalItems.length; i++) {
const originalItem: Item = originalItems[i]!;
const emptyItemsToAdd = originalItem[fieldKey].length - field.update?.length - field.delete?.length;
const emptyItemsToAdd = field.update?.length - originalItem[fieldKey].length - field.delete?.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptyItemsToAdd is counting the number of "untouched sub items" during a create / update / delete operation on a specific field here.

const finalArrayToValidate = arrayToValidate.concat(Array(emptyItemsToAdd).fill({}));

// validate partial items until the last key
Expand Down
2 changes: 1 addition & 1 deletion api/src/utils/get-ip-from-req.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import env from '../env.js';
import logger from '../logger.js';

export function getIPFromReq(req: Request): string {
let ip = req.ip;
let ip = req.ip || '';

if (env['IP_CUSTOM_HEADER']) {
const customIPHeaderValue = req.get(env['IP_CUSTOM_HEADER']) as unknown;
Expand Down
12 changes: 12 additions & 0 deletions docs/self-hosted/sso-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ AUTH_KEYCLOAK_ISSUER_URL="http://<your_keycloak_domain>/realms/<your_keycloak_re
AUTH_KEYCLOAK_IDENTIFIER_KEY="email"
```

## Authentik

Ensure RSA signing key

```
AUTH_AUTHENTIK_DRIVER="openid"
AUTH_AUTHENTIK_CLIENT_ID="..."
AUTH_AUTHENTIK_CLIENT_SECRET="..."
AUTH_AUTHENTIK_ISSUER_URL="http://<your_authentik_domain>/application/o/<your_app_name>/.well-known/openid-configuration"
AUTH_AUTHENTIK_SCOPE="openid profile email offline_access" # offline_access is required to get refresh_token
```

## GitHub

```
Expand Down