Skip to content

hopecee/Dourrranndal451

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Durandal 451

Durandal 2.0.1 running with ASP.NET 4.5.1 using OWIN security to provide:

  • site based and 3rd party user authentication,
  • local SPA authorization and customization based on role membership.

For more information please see the series of blog posts on this project here.

#Getting started

During the database initialization two roles are created:

  • Administrators
  • RegisteredUsers

A user called Administrator is also created with the password 'Administrator451' and added to both roles. Edit IdentityDbInitializer if you need to change this, or add more roles and users.

To configure route based authorization add a property requiredRoles to each route that needs to be checked when setting up the route map.

{ route: 'start', moduleId: 'viewmodels/start', nav: true, requiredRoles: ['RegisteredUsers'] },
{ route: 'siteAdmin', moduleId: 'viewmodels/start', nav: true, requiredRoles: ['Administrators','PowerUsers'] }

To render areas of a view based on the role membership use the ifIsInRole custom KO binding.

<div data-bind="ifIsInRole: 'Admnistrators' ">
    <h2>Admin</h2>
    <p>This is an admin section which will only be visible if the current user is in the 'Admnistrators' role.</p>
</div>

#References

This project is based on the following packages and components:

About

Durandal 2.0.1 on ASP.NET 4.5.1 secured with OWIN.

Resources

Stars

Watchers

Forks

Packages

No packages published