
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@trxn/angular-authentication
Advanced tools
To install this librairy you have to install it first via npm, yarn or pnpm and
install the required peerdependency @trxn/angular-tools
npm i --save @trxn/angular-tools`
After that you need to initialized the app.module.ts
of your angular
application.
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularAuthenticationModule } from '@trxn/angular-authentication';
import { AngularToolsModule } from '@trxn/angular-tools';
@NgModule({
declarations: [AppComponent],
imports: [
AngularToolsModule.forRoot({
environment: {
api: {
uri: 'http://localhost:4200/api',
},
appCode: 'traxion',
appVersion: '1',
},
}),
AngularAuthenticationModule.forRoot({
environment: {
api: {
url: 'http://localhost:4200/api',
},
},
}),
],
bootstrap: [AppComponent],
})
export class AppModule {}
You can modify environment variables in the authentication module like in that code:
AngularAuthenticationModule.forRoot({
environment: {
api: {
url: 'http://localhost:4200/api',
},
routing: {
prefix: ['/'],
},
login: {
url: 'login',
routing: 'sign-in',
redirect: ['/'],
},
logout: {
url: 'logout',
redirect: ['/'],
},
session: {
url: 'me',
},
},
});
Here are the list of environment variables:
api.url
(string): contain the api urllogin
:
url
(string): contain the api path to login endpoint. Will be aggregate to
the api.url
routing
(string): contain the routing of the login component. Will be
aggregate to the routing.prefix
redicrect
(string[]): contain the path where user will be redirect after
successful loginlogout
:
url
(string): contain the api path to logout endpoint. Will be aggregate to
the api.url
redirect
(string[]): contain the path where user will be redirect after
successful logoutsession.url
(string): contain the api path to session endpoint. Will be
aggregate to the api.url
routing.prefix
(string[]): contain the path where the authetification routing
is inizialized (more information in routing section)This package contain a routing module with to route (login and logout). To use
it you just have to add this routing module in your app.module.ts
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularAuthenticationRoutingModule } from '@trxn/angular-authentication';
@NgModule({
declarations: [AppComponent],
imports: [AngularAuthenticationRoutingModule],
bootstrap: [AppComponent],
})
export class AppModule {}
This will create two routes:
/login
: login route/logout
: logout routeNB: this Module will not work without AngularToolsModule
and
AngularAuthenticationModule
.
In case you want to use other routing path, you can directly access the two components of login and logout.
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {
LogoutComponent,
LoginComponent,
} from '@trxn/angular-authentication';
const routes: Routes = [
{
path: 'login',
component: LoginComponent,
data: {
title: 'Login',
},
},
{
path: 'logout',
component: LogoutComponent,
data: {
title: 'Logout',
},
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
NB: If you decide to use that component has a children of a path, don't forget
to change the config routing.prefix
.
This package was done to work with @trxn/nestjs-authentication
as backend.
Check there readme for more information.
FAQs
## Installation
The npm package @trxn/angular-authentication receives a total of 15 weekly downloads. As such, @trxn/angular-authentication popularity was classified as not popular.
We found that @trxn/angular-authentication demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.