Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
## add it here

#TEST_DOMAIN=local.altinn.cloud
#AMUI_TEST_DOMAIN=am.ui.local.altinn.cloud
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- NGINX_HOST=localhost
- NGINX_PORT=80
- TEST_DOMAIN=${TEST_DOMAIN:-local.altinn.cloud}
- AMUI_TEST_DOMAIN=${AMUI_TEST_DOMAIN:-am.ui.local.altinn.cloud}
- ALTINN3LOCAL_PORT=${ALTINN3LOCAL_PORT:-80}
- NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx/
- NGINX_ENVSUBST_TEMPLATE_SUFFIX=.conf
Expand Down
39 changes: 32 additions & 7 deletions loadbalancer/templates/nginx.conf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ http {
server host.docker.internal:5300;
}

upstream accessmanagementcomp {
server host.docker.internal:5117;
upstream accessmanagementbff {
server host.docker.internal:5110;
}

server {
Expand Down Expand Up @@ -90,11 +90,6 @@ http {
error_page 502 /502Receipt.html;
}

location /accessmanagement/ {
proxy_pass http://accessmanagementcomp/accessmanagement/;
error_page 502 /502Accessmanagement.html;
}

location /storage/ {
proxy_pass http://localtest/storage/;
}
Expand Down Expand Up @@ -123,4 +118,34 @@ http {
}

}

server {
listen 80;
server_name ${AMUI_TEST_DOMAIN};

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

error_page 502 /502Accessmanagement.html;

location = / {
proxy_pass http://accessmanagementbff/accessmanagment/;
}

location / {
#Support using Local js, when a cookie value is set
sub_filter_once off;
sub_filter 'https://altinncdn.no/toolkits/altinn-app-frontend/3/' $LOCAL_SUB_FILTER;
proxy_pass http://accessmanagementbff/;
error_page 502 /502Accessmanagement.html;
proxy_cookie_domain altinn3local.no local.altinn.cloud;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proxy_cookie_domain should not be required here, and I’m not sure about the sub_filter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about it either. @TheTechArch @tjololo Do you have any comments on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need it. Same with Sub filter also I belive. Test without

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allinox You can remove the sub_filter and proxy_cookie_domain here and test it out before committing the changes to this branch

}

location /502Accessmanagement.html {
root /www;
}

}
}
5 changes: 5 additions & 0 deletions src/Configuration/GeneralSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public string GetBaseUrl
}
}

/// <summary>
/// Gets or sets the hostname for accessmanagement UI
/// </summary>
public string AMHostname { get; set; }

/// <summary>
/// Get value from environment variable with key equals "GeneralSettings__" + propertyName or directly from
/// the property if the environment variable is missing.
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public async Task<ActionResult> LogInTestUser(StartAppModel startAppModel)

if (startAppModel.AppPathSelection?.Equals("accessmanagement") == true)
{
return Redirect($"/accessmanagement/ui/given-api-delegations/overview");
return Redirect($"http://{_generalSettings.AMHostname}/accessmanagement/ui/offered-api-delegations/overview");
}

Application app = await _localApp.GetApplicationMetadata(startAppModel.AppPathSelection);
Expand Down Expand Up @@ -410,7 +410,7 @@ private List<SelectListItem> GetAuthenticationLevels(int defaultAuthLevel)
}

private async Task<List<SelectListItem>> GetAppsList()
{
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
{

var applications = await _localApp.GetApplications();
return applications.Select((kv) => GetSelectItem(kv.Value, kv.Key)).ToList();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/LocalApp/Implementation/LocalAppFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private string GetAppPath(string appId)
try
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:5117/");
client.BaseAddress = new Uri("http://localhost:5110/");
HttpResponseMessage respnse = await client.GetAsync("swagger/index.html");
if (respnse.StatusCode.Equals(HttpStatusCode.OK))
{
Expand Down
3 changes: 2 additions & 1 deletion src/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"PlatformEndpoint": "http://localhost:5040/",
"ClaimsIdentity": "UserLogin",
"JwtCookieValidityTime": "960",
"AltinnPartyCookieName": "AltinnPartyId"
"AltinnPartyCookieName": "AltinnPartyId",
"AMHostName": "am.ui.local.altinn.cloud"
},
"CertificateSettings": {
"CertificatePwd": "qwer1234",
Expand Down