Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ng-navigation-service
Advanced tools
[![Bower Version](https://img.shields.io/bower/v/ng-navigation-service.svg)](https://github.com/justinsa/angular-navigation-service) [![NPM Version](https://img.shields.io/npm/v/ng-navigation-service.svg)](https://www.npmjs.com/package/ng-navigation-serv
A navigation helper service for Angular client applications.
The ng-navigation-service was designed in tandem with the ng-authentication-service, but it is not a hard requirement. The configured security service must support the following API:
boolean isAuthenticated()
[String] roles()
Add this module to your app as a dependency:
var app = angular.module('yourApp', ['navigation.service']);
Configure a security service to use with the navigation provider:
app.config(['$navigationProvider', function ($navigationProvider) {
$navigationProvider.configure({
securityService: '$authentication'
});
}]);
Inject $navigation as a parameter in declarations that require it:
app.controller('yourController', function($scope, $navigation){ ... });
To override the default configuration options, configure the module with an options argument during application configuration and provide overrides for any of the following options.
app.config(['$navigationProvider', function ($navigationProvider) {
$navigationProvider.configure({
activeLinkDecorator: undefined,
inactiveLinkDecorator: undefined,
securityService: undefined,
extensions: undefined,
roleToAudienceMapFunction: function (userRole) {
return userRole;
},
inAudienceValidationFunction: function (userRoles, audiences) {
var userAudiences = _.flatten(_.map(userRoles, this.roleToAudienceMapFunction));
return !_.isEmpty(userAudiences) && !_.isEmpty(audiences) &&
_.some(audiences, function (audience) { return _.includes(userAudiences, audience); });
}
});
}]);
All properties (own and inherited) of the extensions object will be available as native to the $navigation service API. The extensions object is applied using the _.defaults(...) method and cannot overwrite any of the existing API properties. This is intended to provide implementors with a way to add objects or functions that are application specific and should fall within the context of the navigation service to expose, e.g., a hash of link objects or a function to re-write links.
// returns true if the user is in any of the specified audiences
$navigation.inAudience('X', 'Y', 'Z');
// will flatten provided arrays that are one-level deep in the arguments list
$navigation.inAudience('X', ['Y', 'Z'], ['A']) === $navigation.inAudience('X', 'Y', 'Z', 'A')
// returns true if the location is the current active location
// the following will match any location that starts with the /dashboard route
$navigation.isActiveLocation('/dashboard');
// can also handle sub-routes using '/'
// the leading '/' is optional
$navigation.isActiveLocation('dashboard/user');
// $navigation.decorateLink(item, active, inactive);
// returns the active decorator if the location is the current active location (see isActiveLocation).
// returns the inactive decorator if the location is not the current active location.
$navigation.decorateLink('/dashboard', 'active-item', undefined);
// parameters @active and @inactive are optional and if set to a falsy value will be
// overridden by the corresponding configuration values, if those are set:
// configuration.activeLinkDecorator
// configuration.inactiveLinkDecorator
$navigation.decorateLink('/dashboard');
// Navigate to a route and optionally push the current location to history.
$navigation.goto(route, noHistory);
// Pop and navigate to the previous location from history.
$navigation.back();
These methods were primarily implemented for testing or utility purposes, but they may be useful in special scenarios and are part of the exposed API.
// Get the configuration options
$navigation.getConfiguration();
// $navigation.tokenizePath(location);
// returns an in-order array of lowercase tokens from a location string.
// returns an empty array if no tokens are in the location string.
// returns an in-order array of lowercase tokens from the current active location, if no location parameter is provided.
$navigation.tokenizePath('/dashboard');
// parameter @location is optional and if set to a falsy value will be
// overridden by the value of ``$location.path()``.
After forking you should only have to run npm install
from a command line to get your environment setup.
After install you have two gulp commands available to you:
gulp js:lint
gulp js:test
FAQs
[![Bower Version](https://img.shields.io/bower/v/ng-navigation-service.svg)](https://github.com/justinsa/angular-navigation-service) [![NPM Version](https://img.shields.io/npm/v/ng-navigation-service.svg)](https://www.npmjs.com/package/ng-navigation-serv
The npm package ng-navigation-service receives a total of 20 weekly downloads. As such, ng-navigation-service popularity was classified as not popular.
We found that ng-navigation-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.