@abgov/nx-adsp 12.4.0 → 12.5.0
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/generators.json +6 -0
- package/package.json +1 -1
- package/src/generators/angular-app/angular-app.js +22 -7
- package/src/generators/angular-app/angular-app.js.map +1 -1
- package/src/generators/angular-app/files/nginx.conf__tmpl__ +14 -7
- package/src/generators/angular-app/files/src/app/app.component.css__tmpl__ +10 -54
- package/src/generators/angular-app/files/src/app/app.component.html__tmpl__ +18 -49
- package/src/generators/angular-app/files/src/app/app.component.spec.ts__tmpl__ +22 -27
- package/src/generators/angular-app/files/src/app/app.component.ts__tmpl__ +60 -20
- package/src/generators/angular-app/files/src/app/app.config.ts__tmpl__ +27 -0
- package/src/generators/angular-app/files/src/app/app.routes.ts__tmpl__ +10 -31
- package/src/generators/angular-app/files/src/app/home/home.component.html__tmpl__ +1 -3
- package/src/generators/angular-app/files/src/app/home/home.component.ts__tmpl__ +9 -23
- package/src/generators/angular-app/files/src/app/protected/protected.component.html__tmpl__ +2 -2
- package/src/generators/angular-app/files/src/app/protected/protected.component.spec.ts__tmpl__ +27 -43
- package/src/generators/angular-app/files/src/app/protected/protected.component.ts__tmpl__ +15 -15
- package/src/generators/angular-app/files/src/app/services/auth-guard.service.ts__tmpl__ +12 -21
- package/src/generators/angular-app/files/src/environments/environment.ts__tmpl__ +2 -11
- package/src/generators/angular-app/files/src/index.html__tmpl__ +3 -9
- package/src/generators/angular-app/files/src/main.ts__tmpl__ +8 -12
- package/src/generators/angular-app/files/src/silent-check-sso.html__tmpl__ +5 -0
- package/src/generators/angular-app/files/src/styles.css__tmpl__ +2 -2
- package/src/generators/mean/mean.d.ts +3 -0
- package/src/generators/mean/mean.js +30 -0
- package/src/generators/mean/mean.js.map +1 -0
- package/src/generators/mean/mean.spec.ts +38 -0
- package/src/generators/mean/schema.d.ts +11 -0
- package/src/generators/mean/schema.json +26 -0
- package/src/generators/mern/mern.js +5 -21
- package/src/generators/mern/mern.js.map +1 -1
- package/src/generators/mern/schema.d.ts +0 -4
- package/src/generators/react-app/files/nginx.conf__tmpl__ +18 -7
- package/src/generators/react-app/react-app.js +6 -0
- package/src/generators/react-app/react-app.js.map +1 -1
- package/src/generators/angular-app/files/src/app/app.module.ts__tmpl__ +0 -47
- package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.css__tmpl__ +0 -13
- package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.html__tmpl__ +0 -12
- package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.spec.ts__tmpl__ +0 -33
- package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.ts__tmpl__ +0 -48
- package/src/generators/angular-app/files/src/app/auth.interceptor.ts__tmpl__ +0 -24
- package/src/generators/angular-app/files/src/app/logout/logout.component.html__tmpl__ +0 -1
- package/src/generators/angular-app/files/src/app/logout/logout.component.ts__tmpl__ +0 -9
- package/src/generators/angular-app/files/src/app/services/auth.service.ts__tmpl__ +0 -57
- package/src/generators/angular-app/files/src/app/tenant.service.ts__tmpl__ +0 -19
- package/src/generators/angular-app/files/src/environments/config.ts__tmpl__ +0 -21
- /package/src/generators/angular-app/files/{src → public}/assets/banner.jpg +0 -0
- /package/src/generators/angular-app/files/{src → public}/assets/github-1.svg +0 -0
- /package/src/generators/angular-app/files/{src → public}/favicon.ico +0 -0
package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.ts__tmpl__
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Injectable, Component, OnInit } from '@angular/core';
|
|
2
|
-
import { AuthService } from '../services/auth.service';
|
|
3
|
-
import { User } from 'oidc-client';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: '<%= projectName %>-app-auth-callback',
|
|
7
|
-
templateUrl: './auth-callback.component.html',
|
|
8
|
-
styleUrls: ['./auth-callback.component.css'],
|
|
9
|
-
})
|
|
10
|
-
@Injectable({
|
|
11
|
-
providedIn: 'root',
|
|
12
|
-
})
|
|
13
|
-
export class AuthCallbackComponent implements OnInit {
|
|
14
|
-
public tokenType = '';
|
|
15
|
-
public accessToken = '';
|
|
16
|
-
|
|
17
|
-
constructor(private authService: AuthService) {}
|
|
18
|
-
|
|
19
|
-
ngOnInit() {
|
|
20
|
-
this.getAuth();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getAuth() {
|
|
24
|
-
if (!this.authService.isLoggedIn()) {
|
|
25
|
-
this.authService
|
|
26
|
-
.completeAuthentication()
|
|
27
|
-
.catch((error) => {
|
|
28
|
-
console.error(`could not complete authentication: ${error}`);
|
|
29
|
-
})
|
|
30
|
-
.then(() => {
|
|
31
|
-
this.setTokens();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setTokens() {
|
|
37
|
-
if (this.authService.isLoggedIn()) {
|
|
38
|
-
const user: User | null = this.authService.getUser();
|
|
39
|
-
if (user) {
|
|
40
|
-
this.accessToken = user.access_token;
|
|
41
|
-
this.tokenType = user.token_type;
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
} else {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { AuthCallbackComponent } from './auth-callback/auth-callback.component';
|
|
5
|
-
|
|
6
|
-
@Injectable({ providedIn: 'root' })
|
|
7
|
-
export class AuthInterceptor implements HttpInterceptor {
|
|
8
|
-
|
|
9
|
-
constructor(private authCallBackComponent: AuthCallbackComponent) { }
|
|
10
|
-
|
|
11
|
-
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
12
|
-
if (this.authCallBackComponent.setTokens()) {
|
|
13
|
-
req = req.clone({
|
|
14
|
-
setHeaders: {
|
|
15
|
-
'Content-Type' : 'application/json; charset=utf-8',
|
|
16
|
-
'Accept' : 'application/json',
|
|
17
|
-
'Authorization': `Bearer ${this.authCallBackComponent.accessToken}`,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return next.handle(req);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div>Logged Out !!</div>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { UserManager, UserManagerSettings, User } from 'oidc-client';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class AuthService {
|
|
8
|
-
private manager = new UserManager(getClientSettings());
|
|
9
|
-
private user: User | null = null;
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
this.manager.getUser().then((user) => {
|
|
13
|
-
this.user = user;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
isLoggedIn(): boolean {
|
|
18
|
-
return this.user != null && !this.user.expired;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getUser(): User | null {
|
|
22
|
-
return this.user;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
startAuthentication(): Promise<void> {
|
|
26
|
-
return this.manager.signinRedirect();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
completeAuthentication(): Promise<void> {
|
|
30
|
-
return this.manager.signinRedirectCallback().then((user) => {
|
|
31
|
-
this.user = user;
|
|
32
|
-
console.log(JSON.stringify(this.user));
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
logout() {
|
|
37
|
-
return this.manager.signoutRedirect();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function getClientSettings(): UserManagerSettings {
|
|
42
|
-
const data = JSON.parse(localStorage.getItem('envData') || "\"\"");
|
|
43
|
-
const appUrl = `${window.location.protocol}//${window.location.hostname}${
|
|
44
|
-
window.location.port ? `:${window.location.port}` : ''
|
|
45
|
-
}`;
|
|
46
|
-
|
|
47
|
-
const settings = {
|
|
48
|
-
client_id: data.access.client_id,
|
|
49
|
-
redirect_uri: `${appUrl}/auth-callback`,
|
|
50
|
-
post_logout_redirect_uri: `${appUrl}/signout/callback`,
|
|
51
|
-
silent_redirect_uri: `${appUrl}/auth-callback`,
|
|
52
|
-
response_type: 'code',
|
|
53
|
-
authority: `${data.access.url}/auth/realms/${data.access.realm}`,
|
|
54
|
-
automaticSilentRenew: true,
|
|
55
|
-
};
|
|
56
|
-
return settings;
|
|
57
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
|
|
4
|
-
@Injectable({ providedIn: 'root' })
|
|
5
|
-
export default class TenantService {
|
|
6
|
-
|
|
7
|
-
private getTenantNameUrl = `${this.configData().tenantApi.host}${this.configData().tenantApi.endpoints.tenantNameByRealm}/${this.configData().access.realm}`;
|
|
8
|
-
|
|
9
|
-
constructor(private http: HttpClient) {}
|
|
10
|
-
|
|
11
|
-
/** GET tenants from the server */
|
|
12
|
-
getTenant() {
|
|
13
|
-
return this.http.get(this.getTenantNameUrl);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
configData () {
|
|
17
|
-
return JSON.parse(localStorage.getItem('envData') || "\"\"");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { environment } from './environment';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
@Injectable()
|
|
5
|
-
export class Config {
|
|
6
|
-
constructor() {}
|
|
7
|
-
|
|
8
|
-
Init() {
|
|
9
|
-
return new Promise<void>((resolve, reject) => {
|
|
10
|
-
console.log("AppInitService.init() called");
|
|
11
|
-
|
|
12
|
-
fetch('/config/config.json')
|
|
13
|
-
.then((res) => {
|
|
14
|
-
return (res.ok ? res.json() : environment)
|
|
15
|
-
}).then(( envData ) => {
|
|
16
|
-
localStorage.setItem('envData', JSON.stringify(envData));
|
|
17
|
-
resolve();
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|