Skip to content
Snippets Groups Projects
Commit 05bafe30 authored by Callari, Roberto's avatar Callari, Roberto
Browse files

idm external config

parent 56d7c7f6
No related branches found
No related tags found
No related merge requests found
...@@ -7,13 +7,43 @@ import { Component, OnInit } from '@angular/core'; ...@@ -7,13 +7,43 @@ import { Component, OnInit } from '@angular/core';
import { AnalyticsService } from './@core/utils/analytics.service'; import { AnalyticsService } from './@core/utils/analytics.service';
import { SeoService } from './@core/utils/seo.service'; import { SeoService } from './@core/utils/seo.service';
import { v4 as uuidv4 } from 'uuid';
import { NbAuthOAuth2Token, NbAuthService, NbOAuth2AuthStrategy, NbOAuth2ClientAuthMethod } from '@nebular/auth';
import { ConfigService } from '@ngx-config/core';
@Component({ @Component({
selector: 'ngx-app', selector: 'ngx-app',
template: '<router-outlet></router-outlet>', template: '<router-outlet></router-outlet>',
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
constructor(private analytics: AnalyticsService, private seoService: SeoService) { constructor(private analytics: AnalyticsService, private seoService: SeoService,private configService: ConfigService,
authService: NbAuthService, // force construction of the auth service
oauthStrategy: NbOAuth2AuthStrategy) {
oauthStrategy.setOptions({
name: 'idm',
clientId: configService.getSettings("client_id"),
clientSecret: configService.getSettings("client_secret"),
baseEndpoint: `${configService.getSettings("idmBaseURL")}/oauth2/`,
clientAuthMethod: NbOAuth2ClientAuthMethod.BASIC,
token: {
redirectUri: `${configService.getSettings("dashboardBaseURL")}/auth/callback`,
class: NbAuthOAuth2Token
},
authorize: {
state: uuidv4(),
redirectUri: `${configService.getSettings("dashboardBaseURL")}/auth/callback`,
},
redirect: {
success: '/pages', // welcome page path
failure: null, // stay on the same page
},
refresh:{
// endpoint: 'token',
// grantType: NbOAuth2GrantType.REFRESH_TOKEN,
}
})
} }
ngOnInit(): void { ngOnInit(): void {
......
...@@ -70,33 +70,14 @@ export function createTranslateLoader(http: HttpClient) { ...@@ -70,33 +70,14 @@ export function createTranslateLoader(http: HttpClient) {
strategies: [ strategies: [
NbOAuth2AuthStrategy.setup({ NbOAuth2AuthStrategy.setup({
name: 'idm', name: 'idm',
clientId: 'b5d2fe98-3d01-4b93-b54c-acbb60772479', clientId: ''
clientSecret: '15964f9e-b7e3-4816-bb93-548488cfaca5',
baseEndpoint: 'http://192.168.99.100:3000/oauth2/',
clientAuthMethod: NbOAuth2ClientAuthMethod.BASIC,
token: {
redirectUri: 'http://localhost:4200/auth/callback',
class: NbAuthOAuth2Token
},
authorize: {
state: uuidv4(),
redirectUri: 'http://localhost:4200/auth/callback',
},
redirect: {
success: '/pages', // welcome page path
failure: null, // stay on the same page
},
refresh:{
// endpoint: 'token',
// grantType: NbOAuth2GrantType.REFRESH_TOKEN,
}
}), }),
], ],
}), }),
NbSecurityModule.forRoot({ NbSecurityModule.forRoot({
accessControl: { accessControl: {
ADMIN:{ ADMIN:{
view: '*', view: '*'
}, },
MANAGER:{ MANAGER:{
view: ['external-app','maps','home','about','charts','lorem-ipsum'] view: ['external-app','maps','home','about','charts','lorem-ipsum']
......
...@@ -22,7 +22,7 @@ export class UserInformationService { ...@@ -22,7 +22,7 @@ export class UserInformationService {
return this.getUser().pipe( return this.getUser().pipe(
map(x => { map(x => {
if (x.roles.length != 0) { if (x.roles.length != 0) {
return x.roles.map(y => y.name); return x.roles.map(y => y.name.toUpperCase());
} else { } else {
return ["CITIZEN"]; return ["CITIZEN"];
} }
......
{ "idmBaseURL":"http://192.168.99.100:3000", { "idmBaseURL":"http://192.168.99.100:3000",
"dashboardBaseURL":"http://localhost:4200",
"client_id":"d3f0bbb0-6846-446a-bce4-2755ad9adcd2", "client_id":"d3f0bbb0-6846-446a-bce4-2755ad9adcd2",
"client_secret":"", "client_secret":"59625d70-a36b-40e7-a927-314b1346c3bb",
"external-application-cards":[ "external-application-cards":[
{ {
"url": "http://217.172.12.141:8080", "url": "http://217.172.12.141:8080",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment