UI Router and Satellizer force login-open source projects sahat/satellizer
user4526623
the idea is to have role based authentication as discussed in the Repo readme.
so the code for forbidding the unauthorised access to /profile
would be something like the following
$stateProvider.state("profile", {
url: "/profile",
templateUrl: "app/profile/profile.html",
controller: "ProfileCtrl",
controllerAs: "user",
data: {
permissions: {
except: ['guest'],
redirectTo: 'sign_in'
}
}
});
given that you defined the guest
role
definePermissions = function(Permission, Identity) {
Permission.defineRole('guest', function(stateParams) {
return !Identity.currentUser;
});
};