Skip to content

Commit

Permalink
Use Microsoft.Owin.Security.OAuth version 2.1.0 to match AuthZ Server…
Browse files Browse the repository at this point in the history
… Version
  • Loading branch information
tjoudeh committed Oct 6, 2014
1 parent 24d0943 commit e8e76c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security">
<HintPath>..\packages\Microsoft.Owin.Security.3.0.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
<Reference Include="Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.OAuth">
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
<Reference Include="Microsoft.Owin.Security.OAuth, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.2.1.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class ProtectedController : ApiController
[Route("")]
public IEnumerable<object> Get()
{
//string token = "";
//Microsoft.Owin.Security.AuthenticationTicket ticket = Startup.OAuthBearerOptions.AccessTokenFormat.Unprotect(token);

var identity = User.Identity as ClaimsIdentity;

return identity.Claims.Select(c => new
Expand Down
8 changes: 5 additions & 3 deletions AngularJSAuthentication.ResourceServer/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace AngularJSAuthentication.ResourceServer
{
public class Startup
{

public static OAuthBearerAuthenticationOptions OAuthBearerOptions { get; private set; }

public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
Expand All @@ -27,10 +30,9 @@ public void Configuration(IAppBuilder app)

private void ConfigureOAuth(IAppBuilder app)
{
OAuthBearerOptions = new OAuthBearerAuthenticationOptions();
//Token Consumption
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
{
});
app.UseOAuthBearerAuthentication(OAuthBearerOptions);
}
}
}
9 changes: 5 additions & 4 deletions AngularJSAuthentication.ResourceServer/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<machineKey validationKey="BDE5239FBD71982481D87D815FA0A65B9F5982D99DFA96E6D92B782E0952D58818B479B19FF6D95263E85B0209297E6858B57D1E0BD3EFECE5E35742D605F2A7"
decryptionKey="8E8496D7342EA258526CF6177E04EA7D208E359C95E60CD2A462FC062B9E41B3"
validation="SHA1"
decryption="AES"/>
<machineKey validationKey="BDE5239FBD71982481D87D815FA0A65B9F5982D99DFA96E6D92B782E0952D58818B479B19FF6D95263E85B0209297E6858B57D1E0BD3EFECE5E35742D605F2A7" decryptionKey="8E8496D7342EA258526CF6177E04EA7D208E359C95E60CD2A462FC062B9E41B3" validation="SHA1" decryption="AES" />
</system.web>
<system.webServer>
<handlers>
Expand All @@ -26,6 +23,10 @@
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</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" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 2 additions & 2 deletions AngularJSAuthentication.ResourceServer/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<package id="Microsoft.Owin" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Cors" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
</packages>

0 comments on commit e8e76c1

Please sign in to comment.