Skip to content

Commit 3ba25d4

Browse files
OKTA-319837 ASP.NET Core (2.x and 3.x) Samples > Update samples and instructions to use https
For all the projects besides resource servers which should be changed together with JS samples: * Included configuration files to make sure https is used and port numbers match the descriptions. * READMEs were changed accordingly and extended with information about SameSite restrictions.
1 parent d4942ba commit 3ba25d4

File tree

13 files changed

+196
-17
lines changed

13 files changed

+196
-17
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ dlldata.c
4646
project.lock.json
4747
project.fragment.lock.json
4848
artifacts/
49-
**/Properties/launchSettings.json
5049

5150
*_i.c
5251
*_p.c

samples-aspnetcore-2x/okta-hosted-login/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Run the example with your preferred tool and write down the port of your web app
2121

2222
> **NOTE:** This sample is using ASP.NET Core 2.2 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2323
24+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
25+
2426
#### Run the web application from Visual Studio
2527

26-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
28+
If you run this project in Visual Studio it will start the web application on port 44314 and using HTTPS. You can change this configuration in the `launchSettings.json`.
2729

2830
#### Run the web application from dotnet CLI
2931

30-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
32+
If you run this project via the dotnet CLI it will start the web application on ports 5001 and using HTTPS. You can change this configuration in the `launchSettings.json`.
3133

3234
Navigate to the folder where the project file is located and type the following:
3335

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

samples-aspnetcore-2x/self-hosted-login/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Run the example with your preferred tool and write down the port of your web app
2121

2222
> **NOTE:** This sample is using ASP.NET Core 2.2 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2323
24+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
25+
2426
#### Run the web application from Visual Studio
2527

26-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
28+
If you run this project in Visual Studio it will start the web application on port 44314 using HTTPS. You can change this configuration in the `launchSettings.json`.
2729

2830
#### Run the web application from dotnet CLI
2931

30-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
32+
If you run this project via the dotnet CLI it will start the web application on port 5001 using HTTPS. You can change this configuration in the `launchSettings.json`.
3133

3234
Navigate to the folder where the project file is located and type the following:
3335

@@ -44,7 +46,7 @@ Go to your [Okta Developer Console] and update the following parameters in your
4446
* **Login redirect URI** - for example, `https://localhost:5001/authorization-code/callback`
4547
* **Logout redirect URI** - for example, `https://localhost:5001/signout/callback`
4648

47-
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origin** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
49+
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origins** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
4850

4951
For step-by-step instructions, visit the Okta [Sign Users in to Your Web Application guide] which will show you how to sign users in using Okta and, [Sign Users Out guide] which will show you how to sign users out of your app and out of Okta.
5052

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

samples-aspnetcore-2x/social-login/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ Run the example with your preferred tool and write down the port of your web app
2222

2323
> **Note:** This sample is using ASP.NET Core 2.2 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2424
25+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
26+
2527
#### Run the web application from Visual Studio
2628

27-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
29+
If you run this project in Visual Studio it will start the web application on port 44314 using HTTPS. You can change this configuration in the `launchSettings.json`.
2830

2931
#### Run the web application from dotnet CLI
3032

31-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
33+
If you run this project via the dotnet CLI it will start the web application on port 5001 using HTTPS. You can change this configuration in the `launchSettings.json`.
3234

3335
Navigate to the folder where the project file is located and type the following:
3436

@@ -45,7 +47,7 @@ Go to your [Okta Developer Console] and update the following parameters in your
4547
* **Login redirect URI** - for example, `https://localhost:5001/authorization-code/callback`
4648
* **Logout redirect URI** - for example, `https://localhost:5001/signout/callback`
4749

48-
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origin** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
50+
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origins** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
4951

5052
For step-by-step instructions, visit the Okta [Sign Users in to Your Web Application guide] which will show you how to sign users in using Okta and, [Sign Users Out guide] which will show you how to sign users out of your app and out of Okta.
5153

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

samples-aspnetcore-3x/okta-hosted-login/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Run the example with your preferred tool and write down the port of your web app
2121

2222
> **NOTE:** This sample is using ASP.NET Core 3.1 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2323
24+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
25+
2426
#### Run the web application from Visual Studio
2527

26-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
28+
If you run this project in Visual Studio it will start the web application on port 44314 using HTTPS. You can change this configuration in the `launchSettings.json`.
2729

2830
#### Run the web application from dotnet CLI
2931

30-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
32+
If you run this project via the dotnet CLI it will start the web application on port 5001 using HTTPS. You can change this configuration in the `launchSettings.json`.
3133

3234
Navigate to the folder where the project file is located and type the following:
3335

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

samples-aspnetcore-3x/self-hosted-login/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Run the example with your preferred tool and write down the port of your web app
2121

2222
> **NOTE:** This sample is using ASP.NET Core 3.1 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2323
24+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
25+
2426
#### Run the web application from Visual Studio
2527

26-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
28+
If you run this project in Visual Studio it will start the web application on port 44314 using HTTPS. You can change this configuration in the `launchSettings.json`.
2729

2830
#### Run the web application from dotnet CLI
2931

30-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
32+
If you run this project via the dotnet CLI it will start the web application on port 5001 using HTTPS. You can change this configuration in the `launchSettings.json`.
3133

3234
Navigate to the folder where the project file is located and type the following:
3335

@@ -44,7 +46,7 @@ Go to your [Okta Developer Console] and update the following parameters in your
4446
* **Login redirect URI** - for example, `https://localhost:5001/authorization-code/callback`
4547
* **Logout redirect URI** - for example, `https://localhost:5001/signout/callback`
4648

47-
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origin** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
49+
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origins** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
4850

4951
For step-by-step instructions, visit the Okta [Sign Users in to Your Web Application guide] which will show you how to sign users in using Okta and, [Sign Users Out guide] which will show you how to sign users out of your app and out of Okta.
5052

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

samples-aspnetcore-3x/social-login/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ Run the example with your preferred tool and write down the port of your web app
2222

2323
> **Note:** This sample is using ASP.NET Core 3.1 which enforces HTTPS. This is a recommended practice for web applications. Check out [Enforce HTTPS in ASP.NET Core] for more details.
2424
25+
> Because of recent changes in Set-Cookie behavior (SameSite) this code will only work properly if it's configured to use https.
26+
2527
#### Run the web application from Visual Studio
2628

27-
If you run this project in Visual Studio it will start the web application on ports 5000 for HTTP and 44314 for HTTPS. You can change this configuration in the `launchSettings.json`.
29+
If you run this project in Visual Studio it will start the web application on port 44314 using HTTPS. You can change this configuration in the `launchSettings.json`.
2830

2931
#### Run the web application from dotnet CLI
3032

31-
If you run this project via the dotnet CLI it will start the web application on ports 5000 for HTTP and 5001 for HTTPS. You can change this configuration in the `launchSettings.json`.
33+
If you run this project via the dotnet CLI it will start the web application on port 5001 using HTTPS. You can change this configuration in the `launchSettings.json`.
3234

3335
Navigate to the folder where the project file is located and type the following:
3436

@@ -45,7 +47,7 @@ Go to your [Okta Developer Console] and update the following parameters in your
4547
* **Login redirect URI** - for example, `https://localhost:5001/authorization-code/callback`
4648
* **Logout redirect URI** - for example, `https://localhost:5001/signout/callback`
4749

48-
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origin** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
50+
Also, enable CORS to allow your self-hosted page to make an XHR to the Okta API with the Okta session cookie. To do so, click **API > Trusted Origins** in your [Okta Developer Console], and add your web application’s base URL (for example, `https://localhost:5001/`) as a **Trusted Origin**.
4951

5052
For step-by-step instructions, visit the Okta [Sign Users in to Your Web Application guide] which will show you how to sign users in using Okta and, [Sign Users Out guide] which will show you how to sign users out of your app and out of Okta.
5153

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080/",
7+
"sslPort": 44314
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"launchUrl": "https://localhost:44314",
15+
"environmentVariables": {
16+
"ASPNETCORE_ENVIRONMENT": "Development"
17+
}
18+
},
19+
"okta-aspnetcore-mvc-example": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"applicationUrl": "https://localhost:5001"
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)