Skip to content

Commit

Permalink
Merge pull request #3829 from GreenStage/egomes/AUTH-6690
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Jan 14, 2025
2 parents 1ad4079 + 75e7c41 commit 43c3b8a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/3829.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
access_application: added more fields to private destinations
```
13 changes: 12 additions & 1 deletion access_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,18 @@ const (

type AccessDestination struct {
Type AccessDestinationType `json:"type"`
URI string `json:"uri"`
// URI is required and only used for public destinations.
URI string `json:"uri,omitempty"`
// Hostname can only be used for private destinations.
Hostname string `json:"hostname,omitempty"`
// CIDR can only be used for private destinations.
CIDR string `json:"cidr,omitempty"`
// PortRange can only be used for private destinations.
PortRange string `json:"port_range,omitempty"`
// L4Protocol can only be used for private destinations.
L4Protocol string `json:"l4_protocol,omitempty"`
// VnetID can only be used for private destinations.
VnetID string `json:"vnet_id,omitempty"`
}

// AccessApplication represents an Access application.
Expand Down
62 changes: 55 additions & 7 deletions access_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,14 @@ func TestCreateAccessApplications(t *testing.T) {
"domain_type": "public",
"destinations": [
{"type": "public", "uri": "test.example.com/admin"},
{"type": "public", "uri": "test.example.com/admin2"}
{"type": "private", "hostname": "test.private.domain"},
{
"type": "private",
"cidr": "192.168.1.0/24",
"port_range": "8080-8081",
"vnet_id": "e69219cb-095a-4839-a352-b25b3d43aaac",
"l4_protocol": "udp"
}
],
"type": "self_hosted",
"session_duration": "24h",
Expand Down Expand Up @@ -342,8 +349,21 @@ func TestCreateAccessApplications(t *testing.T) {
Domain: "test.example.com/admin",
DomainType: AccessDestinationPublic,
Destinations: []AccessDestination{
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
{
Type: AccessDestinationPublic,
URI: "test.example.com/admin",
},
{
Type: AccessDestinationPrivate,
Hostname: "test.private.domain",
},
{
Type: AccessDestinationPrivate,
CIDR: "192.168.1.0/24",
PortRange: "8080-8081",
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
L4Protocol: "udp",
},
},
Type: "self_hosted",
SessionDuration: "24h",
Expand Down Expand Up @@ -429,7 +449,14 @@ func TestUpdateAccessApplication(t *testing.T) {
"domain_type": "public",
"destinations": [
{"type": "public", "uri": "test.example.com/admin"},
{"type": "public", "uri": "test.example.com/admin2"}
{"type": "private", "hostname": "test.private.domain"},
{
"type": "private",
"cidr": "192.168.1.0/24",
"port_range": "8080-8081",
"vnet_id": "e69219cb-095a-4839-a352-b25b3d43aaac",
"l4_protocol": "udp"
}
],
"type": "self_hosted",
"session_duration": "24h",
Expand Down Expand Up @@ -476,7 +503,14 @@ func TestUpdateAccessApplication(t *testing.T) {
DomainType: AccessDestinationPublic,
Destinations: []AccessDestination{
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
{
Type: AccessDestinationPrivate,
CIDR: "192.168.1.0/24",
PortRange: "8080-8081",
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
L4Protocol: "udp",
},
},
Type: "self_hosted",
SessionDuration: "24h",
Expand Down Expand Up @@ -519,7 +553,14 @@ func TestUpdateAccessApplication(t *testing.T) {
DomainType: AccessDestinationPublic,
Destinations: []AccessDestination{
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
{
Type: AccessDestinationPrivate,
CIDR: "192.168.1.0/24",
PortRange: "8080-8081",
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
L4Protocol: "udp",
},
},
Type: "self_hosted",
SessionDuration: "24h",
Expand Down Expand Up @@ -557,7 +598,14 @@ func TestUpdateAccessApplication(t *testing.T) {
DomainType: AccessDestinationPublic,
Destinations: []AccessDestination{
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
{
Type: AccessDestinationPrivate,
CIDR: "192.168.1.0/24",
PortRange: "8080-8081",
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
L4Protocol: "udp",
},
},
Type: "self_hosted",
SessionDuration: "24h",
Expand Down

0 comments on commit 43c3b8a

Please sign in to comment.