File tree Expand file tree Collapse file tree
src/KK.AspNetCore.EasyAuthAuthentication/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,11 +70,15 @@ public bool CanHandleAuthentification(HttpContext httpContext) =>
7070
7171 private IEnumerable < AADClaimsModel > BuildFromAuthToken ( JObject xMsClientPrincipal , ProviderOptions options )
7272 {
73- this . logger . LogDebug ( $ "payload was { xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] . ToString ( ) } " ) ;
73+ var claims = new List < AADClaimsModel > ( ) ;
7474
75- var claims = JsonConvert . DeserializeObject < IEnumerable < string > > ( xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] . ToString ( ) )
76- . Select ( r => new AADClaimsModel { Typ = this . defaultOptions . RoleClaimType , Values = r } )
77- . ToList ( ) ;
75+ if ( xMsClientPrincipal . ContainsKey ( this . defaultOptions . RoleClaimType ) )
76+ {
77+ this . logger . LogDebug ( $ "payload was { xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] . ToString ( ) } ") ;
78+
79+ claims . AddRange ( JsonConvert . DeserializeObject < IEnumerable < string > > ( xMsClientPrincipal [ this . defaultOptions . RoleClaimType ] . ToString ( ) )
80+ . Select ( r => new AADClaimsModel { Typ = this . defaultOptions . RoleClaimType , Values = r } ) ) ;
81+ }
7882 var otherClaims = xMsClientPrincipal . Properties ( )
7983 . Where ( claimToken => claimToken . Name != this . defaultOptions . RoleClaimType )
8084 . Select ( claimToken => new AADClaimsModel { Typ = claimToken . Name , Values = claimToken . Value . ToString ( ) } )
You can’t perform that action at this time.
0 commit comments