@@ -51,7 +51,9 @@ public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwner
51
51
identity . AddClaim ( new Claim ( "mail" , context . UserName ) ) ;
52
52
identity . AddClaim ( new Claim ( "role" , "user" ) ) ;
53
53
identity . AddClaim ( new Claim ( ClaimTypes . Name , context . UserName ) ) ;
54
-
54
+ //identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.userId.ToString()));
55
+ identity . AddClaim ( new Claim ( "UserId" , user . userId . ToString ( ) ) ) ;
56
+
55
57
if ( user . member != null )
56
58
{
57
59
identity . AddClaim ( new Claim ( ClaimTypes . Role , "Member" ) ) ;
@@ -69,7 +71,7 @@ public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwner
69
71
identity . AddClaim ( new Claim ( ClaimTypes . Role , "Admin" ) ) ;
70
72
}
71
73
72
- AuthenticationProperties properties = CreateProperties ( user . mail ) ;
74
+ AuthenticationProperties properties = CreateProperties ( user . userId . ToString ( ) , user . mail ) ;
73
75
AuthenticationTicket ticket = new AuthenticationTicket ( identity , properties ) ;
74
76
context . Validated ( ticket ) ;
75
77
//context.Request.Context.Authentication.SignIn(cookiesIdentity);
@@ -83,6 +85,8 @@ public override Task TokenEndpoint(OAuthTokenEndpointContext context)
83
85
context . AdditionalResponseParameters . Add ( property . Key , property . Value ) ;
84
86
}
85
87
88
+ context . AdditionalResponseParameters . Add ( "userID" , context . Identity . GetUserId ( ) ) ;
89
+
86
90
return Task . FromResult < object > ( null ) ;
87
91
}
88
92
@@ -112,10 +116,11 @@ public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriCon
112
116
return Task . FromResult < object > ( null ) ;
113
117
}
114
118
115
- public static AuthenticationProperties CreateProperties ( string userName )
119
+ public static AuthenticationProperties CreateProperties ( string userId , string userName )
116
120
{
117
121
IDictionary < string , string > data = new Dictionary < string , string >
118
122
{
123
+ { "userId" , userId } ,
119
124
{ "userName" , userName }
120
125
} ;
121
126
return new AuthenticationProperties ( data ) ;
0 commit comments