@nauth-toolkit/client-angular 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
NAUTH TOOLKIT EARLY ACCESS LICENSE
|
|
2
|
+
Version 1.0 (December 2025)
|
|
3
|
+
|
|
4
|
+
================================================================================
|
|
5
|
+
FUTURE OPEN SOURCE NOTICE
|
|
6
|
+
================================================================================
|
|
7
|
+
NAuth Toolkit will transition to an open-source license (MIT or Apache 2.0) for
|
|
8
|
+
core authentication features once the project reaches production readiness.
|
|
9
|
+
|
|
10
|
+
This Early Access License is temporary and designed to:
|
|
11
|
+
• Allow developers to build with nauth-toolkit during preview/beta
|
|
12
|
+
• Provide clear expectations during the pre-release phase
|
|
13
|
+
• Enable feedback and real-world testing before GA
|
|
14
|
+
|
|
15
|
+
We're committed to keeping core auth free and open source. Premium features
|
|
16
|
+
(enterprise SSO, advanced compliance, hosted options) will be offered separately
|
|
17
|
+
under fair commercial terms.
|
|
18
|
+
|
|
19
|
+
================================================================================
|
|
20
|
+
EARLY ACCESS LICENSE TERMS
|
|
21
|
+
================================================================================
|
|
22
|
+
|
|
23
|
+
1. Grant of Use
|
|
24
|
+
You are granted a free, non-exclusive, non-transferable license to:
|
|
25
|
+
- Install and use nauth-toolkit packages in development, testing, staging,
|
|
26
|
+
and production environments
|
|
27
|
+
- Modify the code for your own internal use
|
|
28
|
+
- Deploy applications using nauth-toolkit to serve your users
|
|
29
|
+
|
|
30
|
+
You may NOT:
|
|
31
|
+
- Redistribute NAuth Toolkit as a standalone product or service
|
|
32
|
+
- Sell, sublicense, or offer NAuth Toolkit as part of a competing auth
|
|
33
|
+
platform or toolkit
|
|
34
|
+
- Remove or alter copyright notices
|
|
35
|
+
|
|
36
|
+
2. No Fees During Early Access
|
|
37
|
+
There are no license fees, subscription costs, or usage charges during the
|
|
38
|
+
Early Access period. You may use nauth-toolkit freely for commercial and
|
|
39
|
+
non-commercial purposes within the terms of this license.
|
|
40
|
+
|
|
41
|
+
3. Production Use
|
|
42
|
+
Production use is permitted but comes with standard early-access caveats:
|
|
43
|
+
- Features and APIs may change between preview releases
|
|
44
|
+
- Support is community-based (GitHub issues/discussions)
|
|
45
|
+
- No SLA or guaranteed uptime (you run it on your infrastructure)
|
|
46
|
+
|
|
47
|
+
We recommend thorough testing and having rollback plans for critical systems.
|
|
48
|
+
|
|
49
|
+
4. Future Transition
|
|
50
|
+
When nauth-toolkit releases v1.0 GA:
|
|
51
|
+
- Core packages will adopt an open-source license (MIT or Apache 2.0)
|
|
52
|
+
- Your existing deployments will continue to work
|
|
53
|
+
- Premium features (if any) will be clearly documented with separate licensing
|
|
54
|
+
- No forced upgrades or surprise fees
|
|
55
|
+
|
|
56
|
+
5. Ownership
|
|
57
|
+
NAuth Toolkit is developed and maintained by Noorix Digital Solutions.
|
|
58
|
+
You retain full ownership of your applications and data.
|
|
59
|
+
|
|
60
|
+
6. Data and Privacy
|
|
61
|
+
NAuth Toolkit runs in YOUR infrastructure and database. You control all data.
|
|
62
|
+
You are responsible for compliance with applicable data protection laws.
|
|
63
|
+
|
|
64
|
+
7. Disclaimer of Warranty
|
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
66
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
67
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
68
|
+
|
|
69
|
+
8. Limitation of Liability
|
|
70
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
71
|
+
SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS
|
|
72
|
+
OF PROFITS, REVENUE, DATA, OR USE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
73
|
+
DAMAGES.
|
|
74
|
+
|
|
75
|
+
9. Termination
|
|
76
|
+
This license remains in effect until:
|
|
77
|
+
- You stop using nauth-toolkit, or
|
|
78
|
+
- The project transitions to open source (at which point the new license applies)
|
|
79
|
+
|
|
80
|
+
If you breach these terms, your license terminates and you must stop using the
|
|
81
|
+
software.
|
|
82
|
+
|
|
83
|
+
10. Contact and Support
|
|
84
|
+
- Documentation: https://nauth.dev
|
|
85
|
+
- Issues/Discussions: GitHub (when public repository launches)
|
|
86
|
+
- Commercial inquiries: Contact admin@noorix.com
|
|
87
|
+
|
|
88
|
+
================================================================================
|
|
89
|
+
Thank you for being an early adopter. Your feedback shapes the future of NAuth.
|
|
90
|
+
================================================================================
|
package/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# @nauth-toolkit/client-angular
|
|
2
|
+
|
|
3
|
+
Angular adapter for nauth-toolkit client SDK. Provides Angular-specific components, services, guards, and interceptors for seamless authentication integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **AuthService** - Injectable wrapper around NAuthClient with RxJS Observables
|
|
8
|
+
- **authInterceptor** - HTTP interceptor for auth headers, CSRF, and token refresh
|
|
9
|
+
- **authGuard** - Route guard for protected routes
|
|
10
|
+
- **socialRedirectCallbackGuard** - OAuth callback handler
|
|
11
|
+
- **NAuthModule** - NgModule for non-standalone apps (Angular < 17)
|
|
12
|
+
- **AngularHttpAdapter** - Uses Angular's HttpClient for all requests
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @nauth-toolkit/client-angular @nauth-toolkit/client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or with Yarn:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @nauth-toolkit/client-angular @nauth-toolkit/client
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Standalone Components (Angular 17+)
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// app.config.ts
|
|
32
|
+
import { ApplicationConfig, inject } from '@angular/core';
|
|
33
|
+
import { Router, provideRouter } from '@angular/router';
|
|
34
|
+
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
35
|
+
import { NAUTH_CLIENT_CONFIG, authInterceptor } from '@nauth-toolkit/client-angular';
|
|
36
|
+
|
|
37
|
+
export const appConfig: ApplicationConfig = {
|
|
38
|
+
providers: [
|
|
39
|
+
provideRouter(routes),
|
|
40
|
+
{
|
|
41
|
+
provide: NAUTH_CLIENT_CONFIG,
|
|
42
|
+
useFactory: () => {
|
|
43
|
+
const router = inject(Router);
|
|
44
|
+
return {
|
|
45
|
+
baseUrl: 'https://api.example.com/auth',
|
|
46
|
+
tokenDelivery: 'cookies',
|
|
47
|
+
onSessionExpired: () => router.navigate(['/login']),
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
provideHttpClient(withInterceptors([authInterceptor])),
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### NgModule (Angular < 17)
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// app.module.ts
|
|
60
|
+
import { NgModule } from '@angular/core';
|
|
61
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
62
|
+
import { Router } from '@angular/router';
|
|
63
|
+
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
64
|
+
import { NAuthModule, AuthInterceptor, NAUTH_CLIENT_CONFIG } from '@nauth-toolkit/client-angular';
|
|
65
|
+
|
|
66
|
+
@NgModule({
|
|
67
|
+
imports: [BrowserModule, HttpClientModule, NAuthModule],
|
|
68
|
+
providers: [
|
|
69
|
+
{
|
|
70
|
+
provide: NAUTH_CLIENT_CONFIG,
|
|
71
|
+
useFactory: (router: Router) => ({
|
|
72
|
+
baseUrl: 'https://api.example.com/auth',
|
|
73
|
+
tokenDelivery: 'cookies',
|
|
74
|
+
onSessionExpired: () => router.navigate(['/login']),
|
|
75
|
+
}),
|
|
76
|
+
deps: [Router],
|
|
77
|
+
},
|
|
78
|
+
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
|
|
79
|
+
],
|
|
80
|
+
bootstrap: [AppComponent],
|
|
81
|
+
})
|
|
82
|
+
export class AppModule {}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
|
|
87
|
+
### Authentication
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { Component } from '@angular/core';
|
|
91
|
+
import { Router } from '@angular/router';
|
|
92
|
+
import { AuthService } from '@nauth-toolkit/client-angular';
|
|
93
|
+
|
|
94
|
+
@Component({
|
|
95
|
+
selector: 'app-login',
|
|
96
|
+
template: `
|
|
97
|
+
<form (ngSubmit)="login()">
|
|
98
|
+
<input [(ngModel)]="email" placeholder="Email" />
|
|
99
|
+
<input [(ngModel)]="password" type="password" />
|
|
100
|
+
<button type="submit">Login</button>
|
|
101
|
+
</form>
|
|
102
|
+
`,
|
|
103
|
+
})
|
|
104
|
+
export class LoginComponent {
|
|
105
|
+
email = '';
|
|
106
|
+
password = '';
|
|
107
|
+
|
|
108
|
+
constructor(
|
|
109
|
+
private auth: AuthService,
|
|
110
|
+
private router: Router,
|
|
111
|
+
) {}
|
|
112
|
+
|
|
113
|
+
async login() {
|
|
114
|
+
const response = await this.auth.login(this.email, this.password);
|
|
115
|
+
if (response.challengeName) {
|
|
116
|
+
this.router.navigate(['/verify', response.challengeName.toLowerCase()]);
|
|
117
|
+
} else {
|
|
118
|
+
this.router.navigate(['/dashboard']);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Route Protection
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// app.routes.ts
|
|
128
|
+
import { Routes } from '@angular/router';
|
|
129
|
+
import { authGuard } from '@nauth-toolkit/client-angular';
|
|
130
|
+
|
|
131
|
+
export const routes: Routes = [
|
|
132
|
+
{ path: 'login', component: LoginComponent },
|
|
133
|
+
{
|
|
134
|
+
path: 'dashboard',
|
|
135
|
+
component: DashboardComponent,
|
|
136
|
+
canActivate: [authGuard()],
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Reactive State
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { Component } from '@angular/core';
|
|
145
|
+
import { AuthService } from '@nauth-toolkit/client-angular';
|
|
146
|
+
import { AsyncPipe } from '@angular/common';
|
|
147
|
+
|
|
148
|
+
@Component({
|
|
149
|
+
selector: 'app-profile',
|
|
150
|
+
template: `
|
|
151
|
+
@if (currentUser$ | async; as user) {
|
|
152
|
+
<h1>Welcome, {{ user.email }}</h1>
|
|
153
|
+
}
|
|
154
|
+
`,
|
|
155
|
+
imports: [AsyncPipe],
|
|
156
|
+
})
|
|
157
|
+
export class ProfileComponent {
|
|
158
|
+
currentUser$ = this.auth.currentUser$;
|
|
159
|
+
|
|
160
|
+
constructor(private auth: AuthService) {}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Compatibility
|
|
165
|
+
|
|
166
|
+
- **Angular**: 14.0.0+
|
|
167
|
+
- **RxJS**: 7.x or 8.x
|
|
168
|
+
- **Node.js**: 22.0.0+
|
|
169
|
+
|
|
170
|
+
## Documentation
|
|
171
|
+
|
|
172
|
+
Full documentation available at [https://nauth-toolkit.com/docs](https://nauth-toolkit.com/docs)
|
|
173
|
+
|
|
174
|
+
- [Angular Integration Guide](https://nauth-toolkit.com/docs/frontend-sdk/angular/overview)
|
|
175
|
+
- [API Reference](https://nauth-toolkit.com/docs/frontend-sdk/api/overview)
|
|
176
|
+
- [Challenge Handling](https://nauth-toolkit.com/docs/frontend-sdk/guides/challenge-handling)
|
|
177
|
+
- [MFA Setup](https://nauth-toolkit.com/docs/frontend-sdk/guides/mfa-setup)
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
UNLICENSED
|
|
182
|
+
|