Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions cs/src/Contracts/TunnelServiceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class TunnelServiceProperties
/// </summary>
internal const string DevDnsName = "global.ci.tunnels.dev.api.visualstudio.com";

/// <summary>
/// Default host name for the local tunnel service.
/// </summary>
internal const string LocalDnsName = "tunnels.local.api.visualstudio.com:9901";

/// <summary>
/// First-party app ID: `Visual Studio Tunnel Service`
/// </summary>
Expand Down Expand Up @@ -95,10 +100,28 @@ public class TunnelServiceProperties
/// GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
/// service environments.
/// Used by client apps that authenticate tunnel users with GitHub, in the PPE
/// service environment.
/// </remarks>
internal const string PpeGitHubAppClientId = "Iv1.b231c327f1eaa229";

/// <summary>
/// GitHub App Client ID for 'Dev Tunnels Service - Dev'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, in the DEV
/// service environment.
/// </remarks>
internal const string DevGitHubAppClientId = "Iv23ctTiak9wLCiTcEbr";

/// <summary>
/// GitHub App Client ID for 'Dev Tunnels Service - Local'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, when running
/// the service locally.
/// </remarks>
internal const string NonProdGitHubAppClientId = "Iv1.b231c327f1eaa229";
internal const string LocalGitHubAppClientId = "Iv23cttBYzKThF88PiPR";

private TunnelServiceProperties(
string serviceUri,
Expand Down Expand Up @@ -128,7 +151,7 @@ private TunnelServiceProperties(
$"https://{PpeDnsName}/",
PpeFirstPartyAppId,
PpeThirdPartyAppId,
NonProdGitHubAppClientId);
PpeGitHubAppClientId);

/// <summary>
/// Gets properties for the service in the development environment.
Expand All @@ -137,7 +160,20 @@ private TunnelServiceProperties(
$"https://{DevDnsName}/",
DevFirstPartyAppId,
DevThirdPartyAppId,
NonProdGitHubAppClientId);
DevGitHubAppClientId);

/// <summary>
/// Gets properties for the service when running locally.
/// </summary>
/// <remarks>
/// Uses the same service app IDs as the development environment, but a different
/// GitHub app with localhost callback URLs.
/// </remarks>
public static TunnelServiceProperties Local { get; } = new TunnelServiceProperties(
$"https://{LocalDnsName}/",
DevFirstPartyAppId,
DevThirdPartyAppId,
LocalGitHubAppClientId);

/// <summary>
/// Gets properties for the service in the specified environment.
Expand All @@ -157,6 +193,7 @@ public static TunnelServiceProperties Environment(string environmentName)
"prod" or "production" => TunnelServiceProperties.Production,
"ppe" or "preprod" or "staging" => TunnelServiceProperties.Staging,
"dev" or "development" => TunnelServiceProperties.Development,
"local" => TunnelServiceProperties.Local,
_ => throw new ArgumentException($"Invalid service environment: {environmentName}"),
};
}
Expand Down
13 changes: 11 additions & 2 deletions go/tunnels/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ var PpeServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", ppeDnsName),
ServiceAppID: ppeFirstPartyAppID,
ServiceInternalAppID: ppeThirdPartyAppID,
GitHubAppClientID: nonProdGitHubAppClientID,
GitHubAppClientID: ppeGitHubAppClientID,
}

var DevServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", devDnsName),
ServiceAppID: devFirstPartyAppID,
ServiceInternalAppID: devThirdPartyAppID,
GitHubAppClientID: nonProdGitHubAppClientID,
GitHubAppClientID: devGitHubAppClientID,
}

// LocalServiceProperties uses the same service app IDs as the development environment,
// but a different GitHub app with localhost callback URLs.
var LocalServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", localDnsName),
ServiceAppID: devFirstPartyAppID,
ServiceInternalAppID: devThirdPartyAppID,
GitHubAppClientID: localGitHubAppClientID,
}

type tokenProviderfn func() string
Expand Down
21 changes: 18 additions & 3 deletions go/tunnels/tunnel_service_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ var ppeDnsName = "global.rel.tunnels.ppe.api.visualstudio.com"
// Global DNS name of the development tunnel service.
var devDnsName = "global.ci.tunnels.dev.api.visualstudio.com"

// Default host name for the local tunnel service.
var localDnsName = "tunnels.local.api.visualstudio.com:9901"

// First-party app ID: `Visual Studio Tunnel Service`
//
// Used for authenticating AAD/MSA users, and service principals outside the AME tenant,
Expand Down Expand Up @@ -83,6 +86,18 @@ var prodGitHubAppClientID = "Iv1.e7b89e013f801f03"

// GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
//
// Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
// service environments.
var nonProdGitHubAppClientID = "Iv1.b231c327f1eaa229"
// Used by client apps that authenticate tunnel users with GitHub, in the PPE service
// environment.
var ppeGitHubAppClientID = "Iv1.b231c327f1eaa229"

// GitHub App Client ID for 'Dev Tunnels Service - Dev'
//
// Used by client apps that authenticate tunnel users with GitHub, in the DEV service
// environment.
var devGitHubAppClientID = "Iv23ctTiak9wLCiTcEbr"

// GitHub App Client ID for 'Dev Tunnels Service - Local'
//
// Used by client apps that authenticate tunnel users with GitHub, when running the
// service locally.
var localGitHubAppClientID = "Iv23cttBYzKThF88PiPR"
2 changes: 1 addition & 1 deletion go/tunnels/tunnels.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/rodaine/table"
)

const PackageVersion = "0.1.23"
const PackageVersion = "0.1.24"

func (tunnel *Tunnel) requestObject() (*Tunnel, error) {
convertedTunnel := &Tunnel{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class TunnelServiceProperties {
*/
static final String devDnsName = "global.ci.tunnels.dev.api.visualstudio.com";

/**
* Default host name for the local tunnel service.
*/
static final String localDnsName = "tunnels.local.api.visualstudio.com:9901";

/**
* First-party app ID: `Visual Studio Tunnel Service`
*
Expand Down Expand Up @@ -92,10 +97,26 @@ public class TunnelServiceProperties {
/**
* GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
*
* Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
* service environments.
* Used by client apps that authenticate tunnel users with GitHub, in the PPE service
* environment.
*/
static final String ppeGitHubAppClientId = "Iv1.b231c327f1eaa229";

/**
* GitHub App Client ID for 'Dev Tunnels Service - Dev'
*
* Used by client apps that authenticate tunnel users with GitHub, in the DEV service
* environment.
*/
static final String nonProdGitHubAppClientId = "Iv1.b231c327f1eaa229";
static final String devGitHubAppClientId = "Iv23ctTiak9wLCiTcEbr";

/**
* GitHub App Client ID for 'Dev Tunnels Service - Local'
*
* Used by client apps that authenticate tunnel users with GitHub, when running the
* service locally.
*/
static final String localGitHubAppClientId = "Iv23cttBYzKThF88PiPR";

/**
* Gets production service properties.
Expand All @@ -112,6 +133,14 @@ public class TunnelServiceProperties {
*/
public static final TunnelServiceProperties development = TunnelServicePropertiesStatics.development;

/**
* Gets properties for the service when running locally.
*
* Uses the same service app IDs as the development environment, but a different
* GitHub app with localhost callback URLs.
*/
public static final TunnelServiceProperties local = TunnelServicePropertiesStatics.local;

/**
* Gets the base URI of the service.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TunnelServicePropertiesStatics {
"https://" + TunnelServiceProperties.ppeDnsName + "/",
TunnelServiceProperties.ppeFirstPartyAppId,
TunnelServiceProperties.ppeThirdPartyAppId,
TunnelServiceProperties.nonProdGitHubAppClientId);
TunnelServiceProperties.ppeGitHubAppClientId);

/**
* Gets properties for the service in the development environment.
Expand All @@ -33,7 +33,19 @@ class TunnelServicePropertiesStatics {
"https://" + TunnelServiceProperties.devDnsName + "/",
TunnelServiceProperties.devFirstPartyAppId,
TunnelServiceProperties.devThirdPartyAppId,
TunnelServiceProperties.nonProdGitHubAppClientId);
TunnelServiceProperties.devGitHubAppClientId);

/**
* Gets properties for the service when running locally.
*
* Uses the same service app IDs as the development environment, but a different
* GitHub app with localhost callback URLs.
*/
static final TunnelServiceProperties local = new TunnelServiceProperties(
"https://" + TunnelServiceProperties.localDnsName + "/",
TunnelServiceProperties.devFirstPartyAppId,
TunnelServiceProperties.devThirdPartyAppId,
TunnelServiceProperties.localGitHubAppClientId);

public static TunnelServiceProperties environment(String environmentName) {
if (StringUtils.isBlank(environmentName)) {
Expand All @@ -51,6 +63,8 @@ public static TunnelServiceProperties environment(String environmentName) {
case "dev":
case "development":
return TunnelServiceProperties.development;
case "local":
return TunnelServiceProperties.local;
default:
throw new IllegalArgumentException("Invalid service environment: " + environmentName);
}
Expand Down
15 changes: 12 additions & 3 deletions rs/src/contracts/tunnel_environments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ pub fn env_production() -> TunnelServiceProperties {
pub fn env_staging() -> TunnelServiceProperties {
TunnelServiceProperties {
service_uri: format!("https://{}", PPE_DNS_NAME),
service_app_id: PROD_FIRST_PARTY_APP_ID.to_owned(),
service_app_id: PPE_FIRST_PARTY_APP_ID.to_owned(),
service_internal_app_id: PPE_THIRD_PARTY_APP_ID.to_owned(),
github_app_client_id: NON_PROD_GITHUB_APP_CLIENT_ID.to_owned(),
github_app_client_id: PPE_GITHUB_APP_CLIENT_ID.to_owned(),
}
}

Expand All @@ -26,6 +26,15 @@ pub fn env_development() -> TunnelServiceProperties {
service_uri: format!("https://{}", DEV_DNS_NAME),
service_app_id: DEV_FIRST_PARTY_APP_ID.to_owned(),
service_internal_app_id: DEV_THIRD_PARTY_APP_ID.to_owned(),
github_app_client_id: NON_PROD_GITHUB_APP_CLIENT_ID.to_owned(),
github_app_client_id: DEV_GITHUB_APP_CLIENT_ID.to_owned(),
}
}

pub fn env_local() -> TunnelServiceProperties {
TunnelServiceProperties {
service_uri: format!("https://{}", LOCAL_DNS_NAME),
service_app_id: DEV_FIRST_PARTY_APP_ID.to_owned(),
service_internal_app_id: DEV_THIRD_PARTY_APP_ID.to_owned(),
github_app_client_id: LOCAL_GITHUB_APP_CLIENT_ID.to_owned(),
}
}
21 changes: 18 additions & 3 deletions rs/src/contracts/tunnel_service_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub const PPE_DNS_NAME: &str = "global.rel.tunnels.ppe.api.visualstudio.com";
// Global DNS name of the development tunnel service.
pub const DEV_DNS_NAME: &str = "global.ci.tunnels.dev.api.visualstudio.com";

// Default host name for the local tunnel service.
pub const LOCAL_DNS_NAME: &str = "tunnels.local.api.visualstudio.com:9901";

// First-party app ID: `Visual Studio Tunnel Service`
//
// Used for authenticating AAD/MSA users, and service principals outside the AME tenant,
Expand Down Expand Up @@ -85,6 +88,18 @@ pub const PROD_GITHUB_APP_CLIENT_ID: &str = "Iv1.e7b89e013f801f03";

// GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
//
// Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
// service environments.
pub const NON_PROD_GITHUB_APP_CLIENT_ID: &str = "Iv1.b231c327f1eaa229";
// Used by client apps that authenticate tunnel users with GitHub, in the PPE service
// environment.
pub const PPE_GITHUB_APP_CLIENT_ID: &str = "Iv1.b231c327f1eaa229";

// GitHub App Client ID for 'Dev Tunnels Service - Dev'
//
// Used by client apps that authenticate tunnel users with GitHub, in the DEV service
// environment.
pub const DEV_GITHUB_APP_CLIENT_ID: &str = "Iv23ctTiak9wLCiTcEbr";

// GitHub App Client ID for 'Dev Tunnels Service - Local'
//
// Used by client apps that authenticate tunnel users with GitHub, when running the
// service locally.
pub const LOCAL_GITHUB_APP_CLIENT_ID: &str = "Iv23cttBYzKThF88PiPR";
29 changes: 26 additions & 3 deletions ts/src/contracts/tunnelServiceProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export const ppeDnsName = 'global.rel.tunnels.ppe.api.visualstudio.com';
*/
export const devDnsName = 'global.ci.tunnels.dev.api.visualstudio.com';

/**
* Default host name for the local tunnel service.
*/
export const localDnsName = 'tunnels.local.api.visualstudio.com:9901';

/**
* First-party app ID: `Visual Studio Tunnel Service`
*
Expand Down Expand Up @@ -113,23 +118,41 @@ export const prodGitHubAppClientId = 'Iv1.e7b89e013f801f03';
/**
* GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
*
* Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
* service environments.
* Used by client apps that authenticate tunnel users with GitHub, in the PPE service
* environment.
*/
export const ppeGitHubAppClientId = 'Iv1.b231c327f1eaa229';

/**
* GitHub App Client ID for 'Dev Tunnels Service - Dev'
*
* Used by client apps that authenticate tunnel users with GitHub, in the DEV service
* environment.
*/
export const devGitHubAppClientId = 'Iv23ctTiak9wLCiTcEbr';

/**
* GitHub App Client ID for 'Dev Tunnels Service - Local'
*
* Used by client apps that authenticate tunnel users with GitHub, when running the
* service locally.
*/
export const nonProdGitHubAppClientId = 'Iv1.b231c327f1eaa229';
export const localGitHubAppClientId = 'Iv23cttBYzKThF88PiPR';

// Import static members from a non-generated file,
// and re-export them as an object with the same name as the interface.
import {
production,
staging,
development,
local,
environment,
} from './tunnelServicePropertiesStatics';

export const TunnelServiceProperties = {
production,
staging,
development,
local,
environment,
};
Loading
Loading