Skip to content

Conversation

@nguyer
Copy link
Contributor

@nguyer nguyer commented Jul 8, 2022

This PR adds basic auth support for:

  • HTTP listeners
  • All HTTP requests within a namespace (including WebSocket upgrades)
  • start requests over an open WebSocket connection

Example config:

plugins:
  auth:
  - name: basicauth
    type: basic
      basic:
        passwordfile: /etc/firefly/allowed_users

Where passwordfile: /etc/firefly/allowed_users is a file created with htpasswd using bcrypt hashed passwords. For example, you can create such a file by running:

htpasswd -cB allowed_users firefly

Prerequisites for merge:

Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
@codecov-commenter
Copy link

Codecov Report

Merging #894 (e8cad05) into main (68a7c47) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##             main     #894    +/-   ##
========================================
  Coverage   99.96%   99.96%            
========================================
  Files         298      298            
  Lines       19255    19405   +150     
========================================
+ Hits        19249    19399   +150     
  Misses          5        5            
  Partials        1        1            
Impacted Files Coverage Δ
internal/coreconfig/coreconfig.go 100.00% <ø> (ø)
internal/apiserver/server.go 100.00% <100.00%> (ø)
internal/events/websockets/websocket_connection.go 100.00% <100.00%> (ø)
internal/events/websockets/websockets.go 100.00% <100.00%> (ø)
internal/namespace/manager.go 100.00% <100.00%> (ø)
internal/orchestrator/orchestrator.go 100.00% <100.00%> (ø)
internal/blockchain/fabric/fabric.go 100.00% <0.00%> (ø)
internal/blockchain/ethereum/ethereum.go 100.00% <0.00%> (ø)
internal/blockchain/fabric/eventstream.go 100.00% <0.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68a7c47...e8cad05. Read the comment docs.

return plugins, err
}

func (nm *namespaceManager) Authorize(ctx context.Context, authReq *fftypes.AuthReq) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Who calls this? I see that the routes in the apiserver also call directly to orchestrator.

Copy link
Contributor

@awrichar awrichar Jul 12, 2022

Choose a reason for hiding this comment

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

Oh looks like websocketConnection calls here.

@nguyer nguyer merged commit 09d431f into hyperledger:main Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants