From 511a4c1287fc040bac2f4cd4ee4e54356aebbe3f Mon Sep 17 00:00:00 2001 From: Yuri Petskus Date: Tue, 24 May 2016 15:53:12 +0600 Subject: [PATCH 1/3] Update VKontakteAuthenticationHandler.cs Email support. VK send it with access_token --- .../VKontakteAuthenticationHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs b/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs index 213ef7c..8e4b418 100644 --- a/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs +++ b/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs @@ -95,6 +95,10 @@ namespace Owin.Security.Providers.VKontakte var user = await GetUser(response, accessToken); var context = CreateAuthenticatedContext(user, accessToken, properties); + + // Email support. VK send it with access_token + context.Identity.AddClaim(new Claim(ClaimTypes.Email, response["email"].ToString(), XmlSchemaString, + Options.AuthenticationType)); await Options.Provider.Authenticated(context); @@ -226,4 +230,4 @@ namespace Owin.Security.Providers.VKontakte return context.IsRequestCompleted; } } -} \ No newline at end of file +} From 411205106387766ea3650b2232fd75a6c081897b Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Mon, 21 Nov 2016 17:25:59 -0500 Subject: [PATCH 2/3] put email behind if wall --- .../VKontakteAuthenticationHandler.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs b/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs index 8e4b418..06bb6c4 100644 --- a/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs +++ b/src/Owin.Security.Providers.VKontakte/VKontakteAuthenticationHandler.cs @@ -95,10 +95,12 @@ namespace Owin.Security.Providers.VKontakte var user = await GetUser(response, accessToken); var context = CreateAuthenticatedContext(user, accessToken, properties); - - // Email support. VK send it with access_token - context.Identity.AddClaim(new Claim(ClaimTypes.Email, response["email"].ToString(), XmlSchemaString, - Options.AuthenticationType)); + var email = response["email"]?.ToString(); + if(!string.IsNullOrWhiteSpace(email)) + { + // Email support. VK send it with access_token + context.Identity.AddClaim(new Claim(ClaimTypes.Email, email, XmlSchemaString, Options.AuthenticationType)); + } await Options.Provider.Authenticated(context); From 52ab5c257135805c9f798b99da674b13f2cf8588 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Mon, 21 Nov 2016 17:29:30 -0500 Subject: [PATCH 3/3] bump version --- Rakefile.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile.rb b/Rakefile.rb index 2ac96b8..60d6df0 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -15,7 +15,7 @@ PACKAGES = File.expand_path("packages") TOOLS = File.expand_path("tools") NUGET = File.expand_path("#{TOOLS}/nuget") NUGET_EXE = File.expand_path("#{TOOLS}/nuget/nuget.exe") -@version = "2.11.0" +@version = "2.11.1" PROJECTS = Dir.glob('src/*').select{|dir| File.directory? dir } desc 'Retrieve things'