Added null or empty check for IdentityUrlExternal
This commit is contained in:
parent
f97a187723
commit
6d5fd99985
@ -40,7 +40,7 @@ stages:
|
|||||||
- script: 'oc project $(OpenShiftProject)'
|
- script: 'oc project $(OpenShiftProject)'
|
||||||
failOnStderr: true
|
failOnStderr: true
|
||||||
displayName: 'Set OpenShift Project Context'
|
displayName: 'Set OpenShift Project Context'
|
||||||
- script: 'oc process -f ./deploy/aro/identity-api/identityapi-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) -p WEB_SPA_URL=$(WebSpaUrl) -p WEB_MVC_URL=$(WebMvcUrl) -p LOCATION_API_URL=$(LocationsApiUrl) -p MARKETING_API_URL=$(MarketingApiUrl) -p BASKET_API_URL=$(BasketApiUrl) -p ORDERING_API_URL=$(OrderingApiUrl) -p MOBILE_SHOPPING_AGGREGATOR_URL=$(MobileShoppingAggregatorUrl) -p WEB_SHOPPING_AGGREGATOR_URL=$(WebShoppingAggregatorUrl) -p WEBHOOKS_API_URL=$(WebhooksApiUrl) -p WEBHOOKS_WEB_CLIENT_URL=$(WebhooksWebClientUrl) | oc apply -f-'
|
- script: 'oc process -f ./deploy/aro/identity-api/identityapi-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) -p IDENTITY_URL_EXTERNAL=$(IdentityUrlExternal) -p WEB_SPA_URL=$(WebSpaUrl) -p WEB_MVC_URL=$(WebMvcUrl) -p LOCATION_API_URL=$(LocationsApiUrl) -p MARKETING_API_URL=$(MarketingApiUrl) -p BASKET_API_URL=$(BasketApiUrl) -p ORDERING_API_URL=$(OrderingApiUrl) -p MOBILE_SHOPPING_AGGREGATOR_URL=$(MobileShoppingAggregatorUrl) -p WEB_SHOPPING_AGGREGATOR_URL=$(WebShoppingAggregatorUrl) -p WEBHOOKS_API_URL=$(WebhooksApiUrl) -p WEBHOOKS_WEB_CLIENT_URL=$(WebhooksWebClientUrl) | oc apply -f-'
|
||||||
failOnStderr: true
|
failOnStderr: true
|
||||||
displayName: 'Ensure Identity API OpenShift DeploymentConfig and Service'
|
displayName: 'Ensure Identity API OpenShift DeploymentConfig and Service'
|
||||||
- script: 'oc apply -f ./deploy/aro/identity-api/identity-public-route.json'
|
- script: 'oc apply -f ./deploy/aro/identity-api/identity-public-route.json'
|
||||||
|
@ -26,6 +26,8 @@ objects:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
|
- name: IdentityUrlExternal
|
||||||
|
value: ${IDENTITY_URL_EXTERNAL}
|
||||||
- name: SpaClient
|
- name: SpaClient
|
||||||
value: ${WEB_SPA_URL}
|
value: ${WEB_SPA_URL}
|
||||||
- name: XamarinCallback
|
- name: XamarinCallback
|
||||||
@ -113,6 +115,10 @@ parameters:
|
|||||||
name: TEMPLATE_NAME
|
name: TEMPLATE_NAME
|
||||||
required: true
|
required: true
|
||||||
value: identityapi-deploy-template
|
value: identityapi-deploy-template
|
||||||
|
- description: The external URL of the Identity endpoint
|
||||||
|
displayName: Identity URL External
|
||||||
|
name: IDENTITY_URL_EXTERNAL
|
||||||
|
required: true
|
||||||
- description: The cluster internal URL of the Web SPA endpoint
|
- description: The cluster internal URL of the Web SPA endpoint
|
||||||
displayName: Web SPA URL
|
displayName: Web SPA URL
|
||||||
name: WEB_SPA_URL
|
name: WEB_SPA_URL
|
||||||
|
@ -76,9 +76,13 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
|
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
|
||||||
|
|
||||||
// Check to see if the Identity server is using https
|
// Check to see if the Identity server is using https
|
||||||
var identityUrl = this.Configuration.GetValue<string>("IdentityUrl");
|
var isUsingHttps = false;
|
||||||
var identityUri = new Uri(identityUrl);
|
var identityUrlExternal = this.Configuration.GetValue<string>("IdentityUrlExternal");
|
||||||
var isUsingHttps = identityUri.Scheme == Uri.UriSchemeHttps;
|
if (!string.IsNullOrEmpty(identityUrlExternal))
|
||||||
|
{
|
||||||
|
var identityUri = new Uri(identityUrlExternal);
|
||||||
|
isUsingHttps = identityUri.Scheme == Uri.UriSchemeHttps;
|
||||||
|
}
|
||||||
|
|
||||||
// Adds IdentityServer
|
// Adds IdentityServer
|
||||||
services.AddIdentityServer(x =>
|
services.AddIdentityServer(x =>
|
||||||
@ -89,7 +93,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
// Need this if using https
|
// Need this if using https
|
||||||
if (isUsingHttps)
|
if (isUsingHttps)
|
||||||
{
|
{
|
||||||
x.PublicOrigin = identityUrl;
|
x.PublicOrigin = identityUrlExternal;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false))
|
.AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user