Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

feat: local authentication #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nictownsend
Copy link
Contributor

  • introduce passport
  • add a passport local strategy for authentication
  • introduce Authentication interface to contain the multiple
    auth checks (authenticate, checkAuth, logout)

Contributes to: #106

Signed-off-by: Nic Townsend [email protected]

@nictownsend
Copy link
Contributor Author

nictownsend commented Nov 23, 2020

Work to be done:

  • Further integration tests
  • MockAPI for /login purpose

@github-actions
Copy link

github-actions bot commented Nov 23, 2020

PR Report

Bundle Sizes

Test Coverage

View test coverage
File Lines Statement Functions Branches
Total 100% 100% 100% 100%
client/Bootstrap/Navigation/useRouteConfig/useRouteConfig.hook.ts 100% 100% 100% 100%
client/Contexts/ConfigFeatureFlag/Context.tsx 100% 100% 100% 100%
client/Contexts/ConfigFeatureFlag/FeatureFlag.view.tsx 100% 100% 100% 100%
client/Contexts/Introspect/Introspection.ts 100% 100% 100% 100%
client/Contexts/Logging/Context.tsx 100% 100% 100% 100%
client/Hooks/useConfigFeatureFlag/useConfigFeatureFlag.ts 100% 100% 100% 100%
client/Hooks/useLogger/Hook.ts 100% 100% 100% 100%
client/Panels/Home/Home.tsx 100% 100% 100% 100%
client/Utils/sanitise/sanitise.ts 100% 100% 100% 100%
client/Utils/window/window.ts 100% 100% 100% 100%
File Lines Statement Functions Branches
Total 100% 100% 100% 100%
server/api/controller.ts 100% 100% 100% 100%
server/api/router.ts 100% 100% 100% 100%
server/client/controller.ts 100% 100% 100% 100%
server/client/router.ts 100% 100% 100% 100%
server/config/controller.ts 100% 100% 100% 100%
server/config/router.ts 100% 100% 100% 100%
server/core/app.ts 100% 100% 100% 100%
server/core/modules.ts 100% 100% 100% 100%
server/log/router.ts 100% 100% 100% 100%
server/mockapi/data.ts 100% 100% 100% 100%
server/mockapi/router.ts 100% 100% 100% 100%
server/security/bootstrap.ts 100% 100% 100% 100%
server/security/routeConfig.ts 100% 100% 100% 100%
server/security/router.ts 100% 100% 100% 100%
server/security/strategy/strategyFactory.ts 100% 100% 100% 100%
server/security/strategy/scram/scramAuthenticator.ts 100% 100% 100% 100%

Triggered by commit: 8d00115

@nictownsend nictownsend marked this pull request as ready for review November 30, 2020 17:30
@nictownsend nictownsend force-pushed the 106-passport-local branch 7 times, most recently from faddc8d to ef8a510 Compare December 2, 2020 09:26
@matthew-chirgwin matthew-chirgwin linked an issue Dec 3, 2020 that may be closed by this pull request
linting/eslint.config.js Show resolved Hide resolved
Scenario Outline: If assets can be served without authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
Given a server with a 'client' configuration
And There are files to serve
And authentication type 'none' is required
Copy link
Member

Choose a reason for hiding this comment

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

Being picky, behaviourally/grammatically, would it be better to have three seperate cases?

  • And no authentication of the user is required
  • And authentication via an identity provider 'type' of the user is required
  • And username/password authentication of the user is required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought I had different scenarios to cover that below?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I was more refering to the definition of the step - does a user care authentication type is none, or that they are/have been authenticated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My opinion is that in these steps you're a "user" of the server. So you care around the config you have used to create the server.

server/client/client.feature Show resolved Hide resolved
server/client/controller.ts Show resolved Hide resolved
server/placeholderFunctionsToReplace.ts Outdated Show resolved Hide resolved
server/security/router.ts Outdated Show resolved Hide resolved
server/security/security.feature Outdated Show resolved Hide resolved
server/security/security.steps.ts Show resolved Hide resolved
@nictownsend nictownsend force-pushed the 106-passport-local branch 2 times, most recently from f7f6048 to 3a8e903 Compare December 7, 2020 16:20
Scenario Outline: If assets can be served without authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
Given a server with a 'client' configuration
And There are files to serve
And authentication type 'none' is required
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I was more refering to the definition of the step - does a user care authentication type is none, or that they are/have been authenticated

server/placeholderFunctionsToReplace.ts Outdated Show resolved Hide resolved
server/security/security.steps.ts Show resolved Hide resolved
utils/dev_config/server.dev.config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@pmuir pmuir left a comment

Choose a reason for hiding this comment

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

There seem to be some unrelated changes caught up in this PR. Please can you remove them and submit them separately.

@nictownsend
Copy link
Contributor Author

nictownsend commented Dec 10, 2020

@pmuir sorted - they were whitespace changed from linting whole repo instead of staged files

- introduce passport
- add a passport local strategy for authentication
- introduce Authentication interface to contain the multiple
auth checks (authenticate, checkAuth, logout)
- scram router module for authentication, logout, and auth check
- no op for no auth
- extend auth support to provide additional functions to all modules
for checking auth, logging out
- remove empty placeholder file

Contributes to: strimzi#106

Signed-off-by: Nic Townsend <[email protected]>
Base automatically changed from master to main March 25, 2021 11:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Passport.js with local strategy for authentication
3 participants