generated from Ed-Fi-Exchange-OSS/Template-for-GitHub
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RND-422] Client Management API: authentication and token management …
…with PostgreSQL (#301) * [BIA-422] Client Management API: authentication and token management with PostgreSQL Update functions to move sql scripts to SqlHelper. Add tests * Add @edfi/meadowlark-authz-server * Update SqlHelper.ts Fix linting error * Update test and fix problems * Update CreateAuthorizationClient.test.ts Update test * [RND-422] add contributor * Update e2e to use authorization Update NoAuthorizationDocument to use Object.freeze. Update e2e to use AUTHORIZATION_STORE_PLUGIN with postgres * Update on-pullrequest.yml Fix typo * Update to add to env postgres or mongo authorization (e2e test). * Update SqlHelper.ts Update bootstrap validation * Update SqlHelper.ts * Update max pool size * Release pg connection * Update code to fix test errors * Fix integration tests --------- Co-authored-by: Brad Banister <[email protected]>
- Loading branch information
1 parent
4b452e4
commit f339095
Showing
23 changed files
with
1,165 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -9,3 +9,6 @@ contributors | |
graph](https://github.com/Ed-Fi-Exchange-OSS/Meadowlark/network/dependencies). | ||
New contributors should add their name and e-mail address or link to GitHub | ||
profile to this file with their first pull request. | ||
|
||
Max Paulson <[email protected]> | ||
|
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
69 changes: 69 additions & 0 deletions
69
Meadowlark-js/backends/meadowlark-postgresql-backend/src/model/AuthorizationDocument.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,69 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
// Copied from mongodb backend by MaxP | ||
import { AuthorizationClientRole, CreateAuthorizationClientRequest } from '@edfi/meadowlark-authz-server'; | ||
|
||
export interface AuthorizationDocument { | ||
/** | ||
* The clientId uuid. This field replaces the built-in MongoDB _id. | ||
*/ | ||
_id: string; | ||
|
||
/** | ||
* A SHAKE-256 hex hash of the client secret. | ||
*/ | ||
clientSecretHashed: string; | ||
|
||
/** | ||
* The client name | ||
*/ | ||
clientName: string; | ||
|
||
/** | ||
* A list of client roles | ||
*/ | ||
roles: AuthorizationClientRole[]; | ||
|
||
/** | ||
* Whether this is the initial admin account created by bootstrapping | ||
*/ | ||
isBootstrapAdmin: boolean; | ||
|
||
/** | ||
* Whether a client is active or not | ||
*/ | ||
active: boolean; | ||
} | ||
|
||
export function authorizationDocumentFromCreate( | ||
request: CreateAuthorizationClientRequest, | ||
isBootstrapAdmin: boolean = false, | ||
): AuthorizationDocument { | ||
return { | ||
_id: request.clientId, | ||
clientSecretHashed: request.clientSecretHashed, | ||
clientName: request.clientName, | ||
roles: request.roles, | ||
active: request.active, | ||
isBootstrapAdmin, | ||
}; | ||
} | ||
|
||
export function bootstrapAdminDocumentFromCreate(request: CreateAuthorizationClientRequest): AuthorizationDocument { | ||
return authorizationDocumentFromCreate(request, true); | ||
} | ||
|
||
export /** | ||
* Creates a new empty newMeadowlarkDocument object | ||
*/ | ||
const NoAuthorizationDocument: AuthorizationDocument = Object.freeze({ | ||
_id: '', | ||
clientSecretHashed: '', | ||
clientName: '', | ||
roles: [], | ||
isBootstrapAdmin: false, | ||
active: false, | ||
}); |
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
Oops, something went wrong.