File tree Expand file tree Collapse file tree 7 files changed +31
-18
lines changed
EasyAuth.ContainerApp/Services Expand file tree Collapse file tree 7 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 5656 AZURE_CREDENTIALS : ${{ secrets.AZURE_CREDENTIALS }}
5757
5858 - name : Provision Infrastructure
59+ if : ${{ env.AZURE_ENV_NAME != '' }}
5960 run : azd provision --no-prompt
6061 env :
6162 AZD_INITIAL_ENVIRONMENT_CONFIG : ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
6263
6364 - name : Deploy Application
65+ if : ${{ env.AZURE_ENV_NAME != '' }}
6466 run : azd deploy --no-prompt
Original file line number Diff line number Diff line change @@ -49,14 +49,22 @@ public async Task<string> GetPayload()
4949
5050 public async Task < string > GetAuthMe ( )
5151 {
52+ var context = accessor . HttpContext ;
53+ var request = context ! . Request ;
54+ var headers = request . Headers ;
5255 var authMe = default ( string ) ;
5356 try
5457 {
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 ) ;
5664 }
57- catch
65+ catch ( Exception ex )
5866 {
59- authMe = "Not authenticated" ;
67+ authMe = ex . Message ;
6068 }
6169
6270 return authMe ;
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
3- <!-- <TargetFrameworks>net8.0;net9.0</TargetFrameworks> -->
4- <!-- <TargetFramework>net9.0</TargetFramework> -->
5- <TargetFramework >net8.0</TargetFramework >
3+ <TargetFramework >net9.0</TargetFramework >
64 <AzureFunctionsVersion >v4</AzureFunctionsVersion >
75 <OutputType >Exe</OutputType >
86 <ImplicitUsings >enable</ImplicitUsings >
Original file line number Diff line number Diff line change 66 "dotnetRunMessages" : true ,
77 "launchBrowser" : true ,
88 "inspectUri" : " {wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" ,
9- "applicationUrl" : " http://localhost:5000 " ,
9+ "applicationUrl" : " http://localhost:8080 " ,
1010 "environmentVariables" : {
1111 "ASPNETCORE_ENVIRONMENT" : " Development"
1212 }
1616 "dotnetRunMessages" : true ,
1717 "launchBrowser" : true ,
1818 "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 " ,
2020 "environmentVariables" : {
2121 "ASPNETCORE_ENVIRONMENT" : " Development"
2222 }
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()
4949
5050 public async Task < string > GetAuthMe ( )
5151 {
52+ var context = accessor . HttpContext ;
53+ var request = context ! . Request ;
54+ var headers = request . Headers ;
5255 var authMe = default ( string ) ;
5356 try
5457 {
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 ) ;
5664 }
57- catch
65+ catch ( Exception ex )
5866 {
59- authMe = "Not authenticated" ;
67+ authMe = ex . Message ;
6068 }
6169
6270 return authMe ;
Original file line number Diff line number Diff line change 33 "configurations" : {
44 "azure-easyauth-sample" : {
55 "appLocation" : " src/EasyAuth.SwaApp" ,
6- "apiLocation" : " src/EasyAuth.FunctionApp/bin/Release/net8.0/publish " ,
6+ "apiLocation" : " src/EasyAuth.FunctionApp/bin/Release/net9.0 " ,
77 "outputLocation" : " bin/wwwroot" ,
8+ "apiLanguage" : " dotnetisolated" ,
9+ "apiVersion" : " 9.0" ,
810 "appBuildCommand" : " dotnet publish -c Release -o bin" ,
911 "apiBuildCommand" : " dotnet publish -c Release" ,
1012 "run" : " dotnet watch run" ,
11- "appDevserverUrl" : " http://localhost:5000 "
13+ "appDevserverUrl" : " http://localhost:8080 "
1214 }
1315 }
1416}
You can’t perform that action at this time.
0 commit comments