React to Auth changes for MusicStore Spa

This commit is contained in:
Hao Kung 2015-03-02 17:24:43 -08:00
parent 850ba6375d
commit 3406608633
7 changed files with 10 additions and 13 deletions

View File

@ -1,8 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.Linq;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Security;
using MusicStore.Infrastructure; using MusicStore.Infrastructure;
using MusicStore.Models; using MusicStore.Models;
using MusicStore.Spa.Infrastructure; using MusicStore.Spa.Infrastructure;

View File

@ -1,9 +1,8 @@
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.ModelBinding;
using Microsoft.AspNet.Security;
using MusicStore.Models; using MusicStore.Models;
namespace MusicStore.Controllers namespace MusicStore.Controllers

View File

@ -1,6 +1,5 @@
using System.Security.Claims; using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Security;
namespace MusicStore.Spa.Controllers namespace MusicStore.Spa.Controllers
{ {

View File

@ -1,7 +1,7 @@
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Security;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
@ -58,7 +58,7 @@ namespace MusicStore.Spa
// Configure Auth // Configure Auth
services.Configure<AuthorizationOptions>(options => services.Configure<AuthorizationOptions>(options =>
{ {
options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequiresClaim("app-ManageStore", "Allowed").Build()); options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequireClaim("app-ManageStore", "Allowed").Build());
}); });
} }

View File

@ -6,7 +6,7 @@
//Func<string, HtmlString> js = input => Html.Raw(HttpUtility.JavaScriptStringEncode(input, false)); //Func<string, HtmlString> js = input => Html.Raw(HttpUtility.JavaScriptStringEncode(input, false));
} }
@if (User.Identity.IsAuthenticated) @if (User.IsSignedIn())
{ {
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{ {

View File

@ -31,7 +31,7 @@
"Microsoft.AspNet.StaticFiles": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*",
"EntityFramework.InMemory": "7.0.0-*", "EntityFramework.InMemory": "7.0.0-*",
"EntityFramework.SqlServer": "7.0.0-*", "EntityFramework.SqlServer": "7.0.0-*",
"Microsoft.AspNet.Security.Cookies": "1.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*",
"Microsoft.Framework.ConfigurationModel": "1.0.0-*", "Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*" "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*"

View File

@ -1,5 +1,5 @@
@using MusicStore.Models; @using MusicStore.Models;
@using Microsoft.AspNet.Http.Security; @using Microsoft.AspNet.Http.Authentication;
@using Microsoft.AspNet.Identity; @using Microsoft.AspNet.Identity;
@model ExternalLoginListViewModel @model ExternalLoginListViewModel
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager