File tree Expand file tree Collapse file tree
src/CZ.AspNetCore.EasyAuthAuthentication/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ private IEnumerable<AADClaimsModel> BuildFromAuthToken(JObject xMsClientPrincipa
7676 {
7777 this . logger . LogDebug ( $ "payload was { xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] } ") ;
7878
79- claims . AddRange ( JsonConvert . DeserializeObject < IEnumerable < string > > ( xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] . ToString ( ) )
79+ claims . AddRange ( JsonConvert . DeserializeObject < IEnumerable < string > > ( xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] ? . ToString ( ) ?? "[]" )
8080 . Select ( r => new AADClaimsModel { Typ = this . defaultOptions . RoleClaimType , Values = r } ) ) ;
8181 }
8282 var otherClaims = xMsClientPrincipal . Properties ( )
@@ -88,8 +88,8 @@ private IEnumerable<AADClaimsModel> BuildFromAuthToken(JObject xMsClientPrincipa
8888 {
8989 Typ = options . NameClaimType ,
9090 Values = xMsClientPrincipal . ContainsKey ( "upn" ) ?
91- xMsClientPrincipal [ "upn" ] . ToString ( ) : // this appends if an user is using the auth token from the /.auth/me site on the website
92- xMsClientPrincipal [ "appid" ] . ToString ( ) // this appends if an application is try accessing the app.
91+ xMsClientPrincipal [ "upn" ] ? . ToString ( ) ?? string . Empty : // this appends if an user is using the auth token from the /.auth/me site on the website
92+ xMsClientPrincipal [ "appid" ] ? . ToString ( ) ?? string . Empty // this appends if an application is try accessing the app.
9393 } ) ;
9494 return claims ;
9595 }
You can’t perform that action at this time.
0 commit comments