
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
onestop-auth
Advanced tools
AuthModule is a set of essential modules for Onestop Angular application.
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
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 {
}
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 |
FAQs
Onestop Auth Module
We found that onestop-auth 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.