You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
updates to address issue 7, essentially switching to use of easyauth header data to create identity and principal vs unnecessary network request to /.auth/me
// build up identity from X-MS-TOKEN-AAD-ID-TOKEN header set by EasyAuth filters if user openid connect session cookie or oauth bearer token authenticated ...
this.Logger.LogDebug("payload was fetched from easyauth headers, id: {0}",id);
83
98
84
-
this.Logger.LogDebug("payload was fetched from endpoint. id: {0}",id);
99
+
varidentity=newGenericIdentity(id,"AuthenticationTypes.Federation");// setting ClaimsIdentity.AuthenticationType to value that azuread non-easyauth setups use
85
100
86
-
varidentity=newGenericIdentity(id);
101
+
this.Logger.LogInformation("building claims from payload...");
//foreach (var claim in xMsClientPrincipal["claims"]) { if (claim["typ"].ToString() == ClaimTypes.NameIdentifier) { nameidentifier = claim["val"].ToString(); } } // line above works not required
//identity.AddClaim(new Claim("id_token", idToken)); // don't think we should be including this
140
+
//identity.AddClaim(new Claim("http://schemas.microsoft.com/claims/authnclassreference", 1)); // don't think we need to add this
141
+
if(!(identity.ClaimsasList<Claim>).Exists(claim =>claim.Type=="scp"))identity.AddClaim(newClaim("scp","user_impersonation"));// not sure why easyauth not including this
this.Logger.LogDebug("payload was fetched from easyauth me json, id: {0}",id);
154
+
155
+
varidentity=newGenericIdentity(id,"AuthenticationTypes.Federation");// setting ClaimsIdentity.AuthenticationType to value that azuread non-easyauth setups use
87
156
88
157
this.Logger.LogInformation("building claims from payload...");
this.Logger.LogInformation("Add claims to new identity");
97
185
98
186
identity.AddClaims(claims);
99
-
identity.AddClaim(newClaim("id_token",idToken));
187
+
//identity.AddClaim(new Claim("id_token", idToken)); // don't think we should be including this
188
+
//identity.AddClaim(new Claim("http://schemas.microsoft.com/claims/authnclassreference", 1)); // don't think we need to add this
189
+
if(!(identity.ClaimsasList<Claim>).Exists(claim =>claim.Type=="scp"))identity.AddClaim(newClaim("scp","user_impersonation"));// not sure why easyauth not including this
if(this.Options.AuthEndpoint.StartsWith("http"))authMeEndpoint=this.Options.AuthEndpoint;// enable pulling from places like storage account public blob container
218
+
elseauthMeEndpoint=$"{uriString}/{this.Options.AuthEndpoint}";// localhost relative path, e.g. wwwroot/.auth/me.json
0 commit comments