Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngauth

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngauth

Authorization layer over angular

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Angular Authorization layer

This module allows you to add authorization layer to your angular project, and to filter pages for "anonymous" and "authenticated" users.

Installation

** You can assist the example on AuthExample.js of using ngAuth with ng-facebook module **

  1. Download using one of the following options:
    1. npm: npm install ngauth
    2. bower: bower install ngAuth
    3. git
  2. Add the module to your dependencies and include its scripts
  3. Create your own authentication service by implementing the AuthBase abstract:
    angular.module('myApp', ['ngAuthBase'])
        .factory('Auth', ['$facebook', 'AuthBaseUI', '$rootScope',
            function($facebook, AuthBase, $rootScope) {
                var Auth = angular.extend(AuthBase,  {});
    
                return Auth;
            }])
        .run(['Auth', function(Auth) {}])
    ;
    
    *** use AuthBase dependency for regular ng-route, and AuthBaseUI for router-ui ***
  4. Implement the following methods: 2.1. setIsLoggedIn() should check if the user is logged-in: true - logged-in user false - anonymous user null - information not available yet(waiting to response)

Usage

Defining routes

  1. add anonymous: true to every route which allowed only for anonymous users
  2. add authenticated: true to every route which allowed only for anonymous users

Example:

$stateProvider
    .state('login', {
        url: '/login',
        controller: 'loginCtrl',
        anonymous: true,
        templateUrl: 'src/app/views/login.html'
    })
;

Authentication status change handler

You can attach handler for every time the authentication status is changed and ready, by listening to Auth.status:

Example:

$rootScope.$on("Auth.status", function(event, status) {
    if(status) {
        console.log("Logged In!");
    } else {
        console.log("Logged out!")
    }
});

Add login/logout methods to your auth service

It's recommended to add your login/logout method on your auth service.

Keywords

FAQs

Package last updated on 30 Jan 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc