npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

onestop-auth

v1.2.6

Published

Onestop Auth Module

Downloads

4

Readme

Onestop Auth Module

AuthModule is a set of essential modules for Onestop Angular application.

What's included:

  • Login and Spaces Select Page Templete
  • Authentication Service
  • Spaces Service to store and retrieve spaces/spaceId/user roles in localstorage
  • Onestop http interceptor to manage http calls, eg. setup common headers and handle errors

Installation

Before install this module, make sure your npm are under onstop npm registry. To check your npm registry, run

npm config get registry

To change your npm registry to Onestop npm, run

npm config set registry http://packages.prod.1-stop.biz/npm/npm/

To install this module, under the project directory run

npm install --save onestop-auth

Getting started

Import the AuthModule in your root application module:

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

import {AppComponent} from './app.component';
import {AuthInterceptor, AuthModule} from 'onestop-auth';
import {AppRoutingModule} from './app-routing.module';
import {HomeComponent} from './home.component';
import {HTTP_INTERCEPTORS} from '@angular/common/http';

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        AppRoutingModule,
        // authenticationUrl and appPrefix are required
        AuthModule.forRoot({
            authenticationUrl: "https://api-40.1-stop.biz/CPMSGW/api/v1/user/login",
            authorisationBaseUrl: "https://api-40.1-stop.biz/CPMSGW/api/v1",
            appPrefix: "CPMS_"
        })
    ],
    declarations: [AppComponent, HomeComponent],
    providers: [{
        provide: HTTP_INTERCEPTORS,
        useClass: AuthInterceptor,
        multi: true,
    }],
    bootstrap: [AppComponent]
})
export class AppModule {
}

More configuration details see Configuration Options

Setting routes:

import {RouterModule, Routes} from '@angular/router';
import {NgModule} from '@angular/core';
import {HomeComponent} from './home.component';
import {LoginComponent, SpacesComponent} from 'onestop-auth';

const routes: Routes = [
    {
        path: '',
        component: HomeComponent
    },
    {
        path: 'login',
        component: LoginComponent,
    },
    {
        path: 'spaces',
        component: SpacesComponent,
    },
    { path: '', redirectTo: 'login', pathMatch: 'full'},
    { path: '**', redirectTo: ''},
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}

Configuration

| Name | Default | Description | |---------------------|---------------------------------------------------------------------------|--------------------------------------------------------------| | *authenticationUrl | null | The Authentication URL to post user name and password, eg. https://api-40.1-stop.biz/CPMSGW/api/v1/user/login | | *appPrefix | null | Onestop App prefix, eg. CPMS_ | | authorisationBaseUrl| null | The base url in relation to user space url and user roles url | | redirectTo | / | The Url that will be redirected to when successfully login| | clientId | '1STOP' | ClientId in Authentication payload| | spaceId | null | Provide a default Space ID| | defaultSpaceId | true | If default space ID is not provided, and you don't want to go to space selection page to select a ID, you can set this config to true, then the app will skip spaces page and set up first space in user's available spaces.| | spaceUrl | spaces | Space selection page URL| | userSpacesUrl | /user/spaceIds | URL to get user spaces, will combine with authorisationBaseUrl| | userRolesUrl | /user/facilities | URL to get user roles, will combine with authorisationBaseUrl|