Commit 1ec214a 1 parent 2046b4f commit 1ec214a Copy full SHA for 1ec214a
File tree 2 files changed +22
-6
lines changed
EasyAuth.ContainerApp/Services
2 files changed +22
-6
lines changed 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 @@ -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 ;
You can’t perform that action at this time.
0 commit comments