mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
* fix(auth): make createAccessToken api backward compatible [EE-6818] * fix(api): api error message [EE-6818] * fix messages
67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
package testhelpers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
"github.com/portainer/portainer/api/dataservices"
|
|
)
|
|
|
|
type testRequestBouncer struct{}
|
|
|
|
// NewTestRequestBouncer creates new mock for requestBouncer
|
|
func NewTestRequestBouncer() *testRequestBouncer {
|
|
return &testRequestBouncer{}
|
|
}
|
|
|
|
func (testRequestBouncer) AuthenticatedAccess(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) AdminAccess(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) RestrictedAccess(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) PublicAccess(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) TeamLeaderAccess(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) EdgeComputeOperation(h http.Handler) http.Handler {
|
|
return h
|
|
}
|
|
|
|
func (testRequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
|
return nil
|
|
}
|
|
|
|
func (testRequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
|
return nil
|
|
}
|
|
|
|
func (testRequestBouncer) TrustedEdgeEnvironmentAccess(tx dataservices.DataStoreTx, endpoint *portainer.Endpoint) error {
|
|
return nil
|
|
}
|
|
|
|
func (testRequestBouncer) CookieAuthLookup(r *http.Request) (*portainer.TokenData, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (testRequestBouncer) JWTAuthLookup(r *http.Request) (*portainer.TokenData, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// AddTestSecurityCookie adds a security cookie to the request
|
|
func AddTestSecurityCookie(r *http.Request, jwt string) {
|
|
r.AddCookie(&http.Cookie{
|
|
Name: portainer.AuthCookieKey,
|
|
Value: jwt,
|
|
})
|
|
}
|