mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 12:08:19 +02:00
proxy: add route portal json (#5428)
* proxy: add route portal json * fix 405 issue * add link to issue * Update proxy/portal/filter_test.go Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com> --------- Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
This commit is contained in:
parent
6e1fabec0b
commit
e816cef2a1
10 changed files with 628 additions and 5 deletions
71
proxy/portal/portal_test.go
Normal file
71
proxy/portal/portal_test.go
Normal file
|
@ -0,0 +1,71 @@
|
|||
package portal_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/pomerium/pomerium/config"
|
||||
"github.com/pomerium/pomerium/proxy/portal"
|
||||
)
|
||||
|
||||
func TestRouteFromConfigRoute(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
to1, err := config.ParseWeightedUrls("https://to.example.com")
|
||||
require.NoError(t, err)
|
||||
to2, err := config.ParseWeightedUrls("tcp://postgres:5432")
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, []portal.Route{
|
||||
{
|
||||
ID: "4e71df99c0317efb",
|
||||
Name: "from",
|
||||
Type: "http",
|
||||
From: "https://from.example.com",
|
||||
Description: "ROUTE #1",
|
||||
LogoURL: "https://logo.example.com",
|
||||
},
|
||||
{
|
||||
ID: "7c377f11cdb9700e",
|
||||
Name: "from-path",
|
||||
Type: "http",
|
||||
From: "https://from.example.com",
|
||||
},
|
||||
{
|
||||
ID: "708e3cbd0bbe8547",
|
||||
Name: "postgres",
|
||||
Type: "tcp",
|
||||
From: "tcp+https://postgres.example.com:5432",
|
||||
ConnectCommand: "pomerium-cli tcp postgres.example.com:5432",
|
||||
},
|
||||
{
|
||||
ID: "2dd08d87486e051a",
|
||||
Name: "dns",
|
||||
Type: "udp",
|
||||
From: "udp+https://dns.example.com:53",
|
||||
ConnectCommand: "pomerium-cli udp dns.example.com:53",
|
||||
},
|
||||
}, portal.RoutesFromConfigRoutes([]*config.Policy{
|
||||
{
|
||||
From: "https://from.example.com",
|
||||
To: to1,
|
||||
Description: "ROUTE #1",
|
||||
LogoURL: "https://logo.example.com",
|
||||
},
|
||||
{
|
||||
From: "https://from.example.com",
|
||||
To: to1,
|
||||
Path: "/path",
|
||||
},
|
||||
{
|
||||
From: "tcp+https://postgres.example.com:5432",
|
||||
To: to2,
|
||||
},
|
||||
{
|
||||
From: "udp+https://dns.example.com:53",
|
||||
To: to2,
|
||||
},
|
||||
}))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue