Commit 9d75f26 1 parent 2075bdd commit 9d75f26 Copy full SHA for 9d75f26
File tree 7 files changed +31
-18
lines changed
EasyAuth.ContainerApp/Services
7 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 56
56
AZURE_CREDENTIALS : ${{ secrets.AZURE_CREDENTIALS }}
57
57
58
58
- name : Provision Infrastructure
59
+ if : ${{ env.AZURE_ENV_NAME != '' }}
59
60
run : azd provision --no-prompt
60
61
env :
61
62
AZD_INITIAL_ENVIRONMENT_CONFIG : ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
62
63
63
64
- name : Deploy Application
65
+ if : ${{ env.AZURE_ENV_NAME != '' }}
64
66
run : azd deploy --no-prompt
Original file line number Diff line number Diff line change @@ -49,14 +49,22 @@ public async Task<string> GetPayload()
49
49
50
50
public async Task < string > GetAuthMe ( )
51
51
{
52
+ var context = accessor . HttpContext ;
53
+ var request = context ! . Request ;
54
+ var headers = request . Headers ;
52
55
var authMe = default ( string ) ;
53
56
try
54
57
{
55
- authMe = await http . GetStringAsync ( "/.auth/me" ) ;
58
+ http . DefaultRequestHeaders . Clear ( ) ;
59
+ foreach ( var header in headers )
60
+ {
61
+ http . DefaultRequestHeaders . Add ( header . Key , header . Value . ToArray ( ) ) ;
62
+ }
63
+ authMe = JsonSerializer . Serialize ( await http . GetFromJsonAsync < object > ( "/.auth/me" ) , options ) ;
56
64
}
57
- catch
65
+ catch ( Exception ex )
58
66
{
59
- authMe = "Not authenticated" ;
67
+ authMe = ex . Message ;
60
68
}
61
69
62
70
return authMe ;
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
- <!-- <TargetFrameworks>net8.0;net9.0</TargetFrameworks> -->
4
- <!-- <TargetFramework>net9.0</TargetFramework> -->
5
- <TargetFramework >net8.0</TargetFramework >
3
+ <TargetFramework >net9.0</TargetFramework >
6
4
<AzureFunctionsVersion >v4</AzureFunctionsVersion >
7
5
<OutputType >Exe</OutputType >
8
6
<ImplicitUsings >enable</ImplicitUsings >
Original file line number Diff line number Diff line change 6
6
"dotnetRunMessages" : true ,
7
7
"launchBrowser" : true ,
8
8
"inspectUri" : " {wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" ,
9
- "applicationUrl" : " http://localhost:5000 " ,
9
+ "applicationUrl" : " http://localhost:8080 " ,
10
10
"environmentVariables" : {
11
11
"ASPNETCORE_ENVIRONMENT" : " Development"
12
12
}
16
16
"dotnetRunMessages" : true ,
17
17
"launchBrowser" : true ,
18
18
"inspectUri" : " {wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" ,
19
- "applicationUrl" : " https://localhost:5050 ;http://localhost:5000 " ,
19
+ "applicationUrl" : " https://localhost:8081 ;http://localhost:8080 " ,
20
20
"environmentVariables" : {
21
21
"ASPNETCORE_ENVIRONMENT" : " Development"
22
22
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -49,14 +49,22 @@ public async Task<string> GetPayload()
49
49
50
50
public async Task < string > GetAuthMe ( )
51
51
{
52
+ var context = accessor . HttpContext ;
53
+ var request = context ! . Request ;
54
+ var headers = request . Headers ;
52
55
var authMe = default ( string ) ;
53
56
try
54
57
{
55
- authMe = await http . GetStringAsync ( "/.auth/me" ) ;
58
+ http . DefaultRequestHeaders . Clear ( ) ;
59
+ foreach ( var header in headers )
60
+ {
61
+ http . DefaultRequestHeaders . Add ( header . Key , header . Value . ToArray ( ) ) ;
62
+ }
63
+ authMe = JsonSerializer . Serialize ( await http . GetFromJsonAsync < object > ( "/.auth/me" ) , options ) ;
56
64
}
57
- catch
65
+ catch ( Exception ex )
58
66
{
59
- authMe = "Not authenticated" ;
67
+ authMe = ex . Message ;
60
68
}
61
69
62
70
return authMe ;
Original file line number Diff line number Diff line change 3
3
"configurations" : {
4
4
"azure-easyauth-sample" : {
5
5
"appLocation" : " src/EasyAuth.SwaApp" ,
6
- "apiLocation" : " src/EasyAuth.FunctionApp/bin/Release/net8.0/publish " ,
6
+ "apiLocation" : " src/EasyAuth.FunctionApp/bin/Release/net9.0 " ,
7
7
"outputLocation" : " bin/wwwroot" ,
8
+ "apiLanguage" : " dotnetisolated" ,
9
+ "apiVersion" : " 9.0" ,
8
10
"appBuildCommand" : " dotnet publish -c Release -o bin" ,
9
11
"apiBuildCommand" : " dotnet publish -c Release" ,
10
12
"run" : " dotnet watch run" ,
11
- "appDevserverUrl" : " http://localhost:5000 "
13
+ "appDevserverUrl" : " http://localhost:8080 "
12
14
}
13
15
}
14
16
}
You can’t perform that action at this time.
0 commit comments