@@ -25,13 +25,28 @@ public SlackAuthenticationOptions()
25
25
TokenEndpoint = SlackAuthenticationDefaults . TokenEndpoint ;
26
26
UserInformationEndpoint = SlackAuthenticationDefaults . UserInformationEndpoint ;
27
27
28
- ClaimActions . MapCustomJson ( ClaimTypes . NameIdentifier , user =>
29
- string . Concat ( user . GetProperty ( "team" ) . GetString ( "id" ) , "|" , user . GetProperty ( "user" ) . GetString ( "id" ) ) ) ;
30
28
ClaimActions . MapJsonSubKey ( ClaimTypes . Name , "user" , "name" ) ;
31
29
ClaimActions . MapJsonSubKey ( ClaimTypes . Email , "user" , "email" ) ;
32
30
ClaimActions . MapJsonSubKey ( Claims . UserId , "user" , "id" ) ;
33
31
ClaimActions . MapJsonSubKey ( Claims . TeamId , "team" , "id" ) ;
34
32
ClaimActions . MapJsonSubKey ( Claims . TeamName , "team" , "name" ) ;
33
+ ClaimActions . MapCustomJson ( ClaimTypes . NameIdentifier , ( element ) =>
34
+ {
35
+ string ? teamId = null ;
36
+ string ? userId = null ;
37
+
38
+ if ( element . TryGetProperty ( "team" , out var team ) )
39
+ {
40
+ teamId = team . GetString ( "id" ) ;
41
+ }
42
+
43
+ if ( element . TryGetProperty ( "user" , out var user ) )
44
+ {
45
+ userId = user . GetString ( "id" ) ;
46
+ }
47
+
48
+ return $ "{ teamId } |{ userId } ";
49
+ } ) ;
35
50
36
51
Scope . Add ( "identity.basic" ) ;
37
52
}
0 commit comments