-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add "authenticated" user roles and permissions, and amend API d…
…efinitions [DEV-2684] (#267) * THe first variant of API auth implementation * Refactoring + chain of responsibility for auth * Modifications: - Injected chain of responsibilities for auth - Renamed `revocation` API endpoint to `credential-status` - Fixed logic when authentication enabled or not. - small refactoring
- Loading branch information
Andrew Nikitin
authored
Jun 26, 2023
1 parent
44c397e
commit 2a6b30f
Showing
21 changed files
with
796 additions
and
177 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,19 @@ | ||
import { Request, Response } from "express"; | ||
import { AbstractAuthHandler } from "./base_auth.js"; | ||
import { IAuthResponse } from "../../types/authentication.js"; | ||
|
||
export class AccountAuthHandler extends AbstractAuthHandler { | ||
|
||
constructor () { | ||
super() | ||
this.registerRoute('/account', 'GET', 'read:account') | ||
this.registerRoute('/account', 'POST', 'create:account') | ||
} | ||
public async handle(request: Request, response: Response): Promise<IAuthResponse> { | ||
if (!request.path.includes('/account')) { | ||
return super.handle(request, response) | ||
} | ||
return this.commonPermissionCheck(request) | ||
} | ||
|
||
} |
Oops, something went wrong.