fix up orcid a little
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -11,14 +11,15 @@
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
.gitignore/
|
||||
.bundle/
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
OwinOAuthProvidersDemo/App_Data/
|
||||
# Visual Studo 2015 cache/options directory
|
||||
.vs/
|
||||
Owin.Security.Providers.nuspec
|
||||
|
||||
@@ -21,7 +21,6 @@ DEPENDENCIES
|
||||
albacore
|
||||
nokogiri
|
||||
os
|
||||
rake
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
1.12.1
|
||||
|
||||
@@ -2,8 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwinOAuthProvidersDemo", "OwinOAuthProvidersDemo\OwinOAuthProvidersDemo.csproj", "{5A438007-0C90-4DAC-BAA1-54A32164067F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.Security.Providers.ArcGISOnline", "src\Owin.Security.Providers.ArcGISOnline\Owin.Security.Providers.ArcGISOnline.csproj", "{8A49FAEF-D365-4D25-942C-1CAD03845A5E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.Security.Providers.Asana", "src\Owin.Security.Providers.Asana\Owin.Security.Providers.Asana.csproj", "{F3E27220-1D8C-4037-94AA-7B7F4A12F351}"
|
||||
@@ -94,16 +92,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.Security.Providers.Sla
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.Security.Providers.Orcid", "src\Owin.Security.Providers.Orcid\Owin.Security.Providers.Orcid.csproj", "{89CB4342-E23D-4E7C-89E5-C369599A5860}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwinOAuthProvidersDemo", "OwinOAuthProvidersDemo\OwinOAuthProvidersDemo.csproj", "{5A438007-0C90-4DAC-BAA1-54A32164067F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8A49FAEF-D365-4D25-942C-1CAD03845A5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A49FAEF-D365-4D25-942C-1CAD03845A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A49FAEF-D365-4D25-942C-1CAD03845A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -284,6 +280,10 @@ Global
|
||||
{89CB4342-E23D-4E7C-89E5-C369599A5860}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{89CB4342-E23D-4E7C-89E5-C369599A5860}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{89CB4342-E23D-4E7C-89E5-C369599A5860}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A438007-0C90-4DAC-BAA1-54A32164067F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -3,21 +3,23 @@ using Microsoft.Owin;
|
||||
using Microsoft.Owin.Security.Cookies;
|
||||
using Owin;
|
||||
|
||||
//using Owin.Security.Providers.Orcid;
|
||||
|
||||
namespace OwinOAuthProvidersDemo
|
||||
{
|
||||
public partial class Startup
|
||||
{
|
||||
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
|
||||
public void ConfigureAuth(IAppBuilder app)
|
||||
{
|
||||
// Enable the application to use a cookie to store information for the signed in user
|
||||
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
||||
{
|
||||
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
|
||||
LoginPath = new PathString("/Account/Login")
|
||||
});
|
||||
// Use a cookie to temporarily store information about a user logging in with a third party login provider
|
||||
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
|
||||
public partial class Startup
|
||||
{
|
||||
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
|
||||
public void ConfigureAuth(IAppBuilder app)
|
||||
{
|
||||
// Enable the application to use a cookie to store information for the signed in user
|
||||
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
||||
{
|
||||
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
|
||||
LoginPath = new PathString("/Account/Login")
|
||||
});
|
||||
// Use a cookie to temporarily store information about a user logging in with a third party login provider
|
||||
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
|
||||
//app.UseDeviantArtAuthentication("id", "secret");
|
||||
//app.UseUntappdAuthentication("id", "secret");
|
||||
// Uncomment the following lines to enable logging in with third party login providers
|
||||
@@ -71,8 +73,8 @@ namespace OwinOAuthProvidersDemo
|
||||
|
||||
/*
|
||||
* Twitch sign-ins use /signin-Twitch as the URL for authentication
|
||||
*
|
||||
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
////Simple Twitch Sign-in
|
||||
@@ -85,7 +87,6 @@ namespace OwinOAuthProvidersDemo
|
||||
// ClientSecret = "",
|
||||
// Provider = new TwitchAuthenticationProvider()
|
||||
// {
|
||||
|
||||
// OnAuthenticated = async z =>
|
||||
// {
|
||||
//// Getting the twitch users picture
|
||||
@@ -108,8 +109,6 @@ namespace OwinOAuthProvidersDemo
|
||||
//};
|
||||
//app.UseTwitchAuthentication(opt);
|
||||
|
||||
|
||||
|
||||
//app.UseOpenIDAuthentication("http://me.yahoo.com/", "Yahoo");
|
||||
|
||||
//app.UseOpenIDAuthentication("https://openid.stackexchange.com/", "StackExchange");
|
||||
@@ -123,7 +122,7 @@ namespace OwinOAuthProvidersDemo
|
||||
//app.UseOpenIDAuthentication("http://openid.orange.fr/server", "Orange", true);
|
||||
|
||||
//app.UseSalesforceAuthentication(
|
||||
// clientId: "",
|
||||
// clientId: "",
|
||||
// clientSecret: "");
|
||||
|
||||
//in scenarios where a sandbox URL needs to be used
|
||||
@@ -275,8 +274,8 @@ namespace OwinOAuthProvidersDemo
|
||||
//app.UseXingAuthentication("", "");
|
||||
|
||||
//app.UseDoYouBuzzAuthentication("", "");
|
||||
|
||||
//app.UseOrcidAuthentication("", "");
|
||||
//app.("", "");
|
||||
//app.UseOrcidAuthentication("APP-QQ4XO1AYU3WR696B", "6bb22d2e-71b3-4d5d-b1af-f5d3a8cd4270");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OwinOAuthProvidersDemo</RootNamespace>
|
||||
<AssemblyName>OwinOAuthProvidersDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort>44300</IISExpressSSLPort>
|
||||
@@ -21,6 +21,7 @@
|
||||
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
|
||||
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
|
||||
<UseGlobalApplicationHostFile />
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -65,16 +66,16 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Security, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.Cookies, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@@ -105,8 +106,8 @@
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
@@ -115,13 +116,13 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -150,9 +151,7 @@
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
@@ -163,6 +162,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest">
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=301880
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-OwinOAuthProvidersDemo-2015.mdf;Initial Catalog=aspnet-OwinOAuthProvidersDemo-20131113093838;Integrated Security=True" providerName="System.Data.SqlClient" />
|
||||
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-owinOauthDemo.mdf;Initial Catalog=aspnet-owinOauthDemo;Integrated Security=True" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
@@ -18,9 +17,17 @@
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
</appSettings>
|
||||
<!--
|
||||
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
|
||||
|
||||
The following attributes can be set on the <httpRuntime> tag.
|
||||
<system.Web>
|
||||
<httpRuntime targetFramework="4.5.2" />
|
||||
</system.Web>
|
||||
-->
|
||||
<system.web>
|
||||
<authentication mode="None" />
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<compilation debug="true" targetFramework="4.5.2" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
@@ -40,11 +47,11 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
@@ -60,7 +67,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net45" />
|
||||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security.Facebook" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security.Google" version="2.1.0" targetFramework="net45" />
|
||||
@@ -24,7 +24,7 @@
|
||||
<package id="Microsoft.Owin.Security.Twitter" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Modernizr" version="2.7.2" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="Respond" version="1.4.2" targetFramework="net45" />
|
||||
<package id="WebGrease" version="1.6.0" targetFramework="net45" />
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
using System;
|
||||
using Microsoft.Owin;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Owin;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Owin.Security.Providers.Orcid.Message
|
||||
{
|
||||
public static class OrcidMessageExtensions
|
||||
{
|
||||
public static OrcidAuthenticatedContext ToAuthenticationContext(this string json, IOwinContext context, string orcid, string accessToken)
|
||||
{
|
||||
var profile = JsonConvert.DeserializeObject<OrcidProfileMessage>(json);
|
||||
public static class OrcidMessageExtensions
|
||||
{
|
||||
public static OrcidAuthenticatedContext ToAuthenticationContext(this string json, IOwinContext context, string orcid, string accessToken)
|
||||
{
|
||||
var profile = JsonConvert.DeserializeObject<OrcidProfileMessage>(json);
|
||||
|
||||
var user = JObject.Parse(json);
|
||||
var user = JObject.Parse(json);
|
||||
|
||||
var authenticatedContext = new OrcidAuthenticatedContext(context, user, accessToken);
|
||||
var authenticatedContext = new OrcidAuthenticatedContext(context, user, accessToken);
|
||||
|
||||
var email = profile.OrcidProfile.OrcidBio.ContactDetails.Email.LastOrDefault();
|
||||
if (email != null)
|
||||
authenticatedContext.Email = email.Value;
|
||||
var email = profile.OrcidProfile.OrcidBio?.ContactDetails?.Email?.LastOrDefault();
|
||||
if(email != null)
|
||||
authenticatedContext.Email = email.Value;
|
||||
|
||||
authenticatedContext.Id = orcid;
|
||||
authenticatedContext.UserName = orcid;
|
||||
|
||||
authenticatedContext.FirstName = profile.OrcidProfile.OrcidBio.PersonalDetails.GivenNames.Value;
|
||||
authenticatedContext.LastName = profile.OrcidProfile.OrcidBio.PersonalDetails.FamilyName.Value;
|
||||
authenticatedContext.FirstName = profile.OrcidProfile.OrcidBio.PersonalDetails.GivenNames.Value;
|
||||
authenticatedContext.LastName = profile.OrcidProfile.OrcidBio.PersonalDetails.FamilyName.Value;
|
||||
|
||||
return authenticatedContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return authenticatedContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +1,120 @@
|
||||
using System;
|
||||
using Microsoft.Owin;
|
||||
using Microsoft.Owin.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Owin;
|
||||
using Microsoft.Owin.Security;
|
||||
|
||||
namespace Owin.Security.Providers.Orcid
|
||||
{
|
||||
public class OrcidAuthenticationOptions : AuthenticationOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
|
||||
/// in back channel communications belong to Orcid.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The pinned certificate validator.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// If this property is null then the default certificate checks are performed,
|
||||
/// validating the subject name and if the signing chain is a trusted party.
|
||||
/// </remarks>
|
||||
public ICertificateValidator BackchannelCertificateValidator { get; set; }
|
||||
public class OrcidAuthenticationOptions : AuthenticationOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
|
||||
/// in back channel communications belong to Orcid.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The pinned certificate validator.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// If this property is null then the default certificate checks are performed,
|
||||
/// validating the subject name and if the signing chain is a trusted party.
|
||||
/// </remarks>
|
||||
public ICertificateValidator BackchannelCertificateValidator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The HttpMessageHandler used to communicate with Orcid.
|
||||
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
|
||||
/// can be downcast to a WebRequestHandler.
|
||||
/// </summary>
|
||||
public HttpMessageHandler BackchannelHttpHandler { get; set; }
|
||||
/// <summary>
|
||||
/// The HttpMessageHandler used to communicate with Orcid.
|
||||
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
|
||||
/// can be downcast to a WebRequestHandler.
|
||||
/// </summary>
|
||||
public HttpMessageHandler BackchannelHttpHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets timeout value in milliseconds for back channel communications with Orcid.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The back channel timeout in milliseconds.
|
||||
/// </value>
|
||||
public TimeSpan BackchannelTimeout { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets timeout value in milliseconds for back channel communications with Orcid.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The back channel timeout in milliseconds.
|
||||
/// </value>
|
||||
public TimeSpan BackchannelTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The request path within the application's base path where the user-agent will be returned.
|
||||
/// The middleware will process this request when it arrives.
|
||||
/// Default value is "/signin-Orcid".
|
||||
/// </summary>
|
||||
public PathString CallbackPath { get; set; }
|
||||
/// <summary>
|
||||
/// The request path within the application's base path where the user-agent will be returned.
|
||||
/// The middleware will process this request when it arrives.
|
||||
/// Default value is "/signin-orcid".
|
||||
/// </summary>
|
||||
public PathString CallbackPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get or sets the text that the user can display on a sign in user interface.
|
||||
/// </summary>
|
||||
public string Caption
|
||||
{
|
||||
get { return Description.Caption; }
|
||||
set { Description.Caption = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get or sets the text that the user can display on a sign in user interface.
|
||||
/// </summary>
|
||||
public string Caption
|
||||
{
|
||||
get { return Description.Caption; }
|
||||
set { Description.Caption = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Orcid supplied Client ID
|
||||
/// </summary>
|
||||
public string ClientId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Orcid supplied Client ID
|
||||
/// </summary>
|
||||
public string ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Orcid supplied Client Secret
|
||||
/// </summary>
|
||||
public string ClientSecret { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Orcid supplied Client Secret
|
||||
/// </summary>
|
||||
public string ClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sets of OAuth endpoints used to authenticate against Orcid. Overriding these endpoints allows you to use Orcid Enterprise for
|
||||
/// authentication.
|
||||
/// </summary>
|
||||
public OrcidAuthenticationEndpoints Endpoints { get; set; }
|
||||
/// <summary>
|
||||
/// Gets the sets of OAuth endpoints used to authenticate against Orcid. Overriding these endpoints allows you to use Orcid Enterprise for
|
||||
/// authentication.
|
||||
/// </summary>
|
||||
public OrcidAuthenticationEndpoints Endpoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="IOrcidAuthenticationProvider" /> used in the authentication events
|
||||
/// </summary>
|
||||
public IOrcidAuthenticationProvider Provider { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="IOrcidAuthenticationProvider" /> used in the authentication events
|
||||
/// </summary>
|
||||
public IOrcidAuthenticationProvider Provider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of permissions to request.
|
||||
/// </summary>
|
||||
public IList<string> Scope { get; private set; }
|
||||
/// <summary>
|
||||
/// A list of permissions to request.
|
||||
/// </summary>
|
||||
public IList<string> Scope { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies how the authorization server prompts the user for reauthentication and reapproval. This parameter is optional.
|
||||
/// The only values Orcid supports are:
|
||||
/// login—The authorization server must prompt the user for reauthentication, forcing the user to log in again.
|
||||
/// consent—The authorization server must prompt the user for reapproval before returning information to the client.
|
||||
/// It is valid to pass both values, separated by a space, to require the user to both log in and reauthorize.
|
||||
/// </summary>
|
||||
public string Prompt { get; set; }
|
||||
/// <summary>
|
||||
/// Specifies how the authorization server prompts the user for reauthentication and reapproval. This parameter is optional.
|
||||
/// The only values Orcid supports are:
|
||||
/// login—The authorization server must prompt the user for reauthentication, forcing the user to log in again.
|
||||
/// consent—The authorization server must prompt the user for reapproval before returning information to the client.
|
||||
/// It is valid to pass both values, separated by a space, to require the user to both log in and reauthorize.
|
||||
/// </summary>
|
||||
public string Prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user
|
||||
/// <see cref="System.Security.Claims.ClaimsIdentity" />.
|
||||
/// </summary>
|
||||
public string SignInAsAuthenticationType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user
|
||||
/// <see cref="System.Security.Claims.ClaimsIdentity" />.
|
||||
/// </summary>
|
||||
public string SignInAsAuthenticationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type used to secure data handled by the middleware.
|
||||
/// </summary>
|
||||
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type used to secure data handled by the middleware.
|
||||
/// </summary>
|
||||
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new <see cref="OrcidAuthenticationOptions" />
|
||||
/// </summary>
|
||||
public OrcidAuthenticationOptions()
|
||||
: base("Orcid")
|
||||
{
|
||||
Caption = Constants.DefaultAuthenticationType;
|
||||
CallbackPath = new PathString("/signin-orcid");
|
||||
AuthenticationMode = AuthenticationMode.Passive;
|
||||
Scope = new List<string>();
|
||||
BackchannelTimeout = TimeSpan.FromSeconds(60);
|
||||
Endpoints = new OrcidAuthenticationEndpoints
|
||||
{
|
||||
AuthorizationEndpoint = OrcidAuthenticationEndpoints.Default.AuthorizationEndPoint,
|
||||
TokenEndpoint = OrcidAuthenticationEndpoints.Default.TokenEndpoint,
|
||||
ApiEndpoint = OrcidAuthenticationEndpoints.Default.ApiEndpoint
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new <see cref="OrcidAuthenticationOptions" />
|
||||
/// </summary>
|
||||
public OrcidAuthenticationOptions()
|
||||
: base("Orcid")
|
||||
{
|
||||
Caption = Constants.DefaultAuthenticationType;
|
||||
CallbackPath = new PathString("/signin-orcid");
|
||||
AuthenticationMode = AuthenticationMode.Passive;
|
||||
Scope = new List<string>();
|
||||
BackchannelTimeout = TimeSpan.FromSeconds(60);
|
||||
Endpoints = new OrcidAuthenticationEndpoints
|
||||
{
|
||||
AuthorizationEndpoint = OrcidAuthenticationEndpoints.Default.AuthorizationEndPoint,
|
||||
TokenEndpoint = OrcidAuthenticationEndpoints.Default.TokenEndpoint,
|
||||
ApiEndpoint = OrcidAuthenticationEndpoints.Default.ApiEndpoint
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,6 @@
|
||||
<Compile Include="Provider\OrcidReturnEndpointContext.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Owin.Security.Providers.Orcid.nuspec" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Owin.Security.Providers.Orcid</id>
|
||||
<version>1.0.0</version>
|
||||
<authors>Rick Zakharov</authors>
|
||||
<owners>RickZee</owners>
|
||||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
|
||||
<projectUrl>https://github.com/RickZee/OwinOAuthProviders</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>
|
||||
Adds ORCID OAuth provider for OWIN to use with ASP.NET
|
||||
</description>
|
||||
<summary>
|
||||
Providers have now been split into their own packages from Owin.Security.Providers
|
||||
</summary>
|
||||
<releaseNotes>
|
||||
</releaseNotes>
|
||||
<copyright>Copyright 2016</copyright>
|
||||
<tags>owin katana oauth LinkedIn</tags>
|
||||
<dependencies>
|
||||
<dependency id="Microsoft.Owin.Security" version="2.1.0" />
|
||||
<dependency id="Newtonsoft.Json" version="6.0.1" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bin\Release\Owin.Security.Providers.Orcid.dll" target="lib\net45" />
|
||||
</files>
|
||||
</package>
|
||||
Reference in New Issue
Block a user