diff --git a/claims/claimsAdmin/claimsAdmin.component.ts b/claims/claimsAdmin/claimsAdmin.component.ts index 8b142399..d1240a38 100644 --- a/claims/claimsAdmin/claimsAdmin.component.ts +++ b/claims/claimsAdmin/claimsAdmin.component.ts @@ -37,7 +37,6 @@ export class ClaimsAdminComponent { @Input() isConnect: boolean = false; @Input() externalPortalUrl: string; @Input() claimsInfoURL: string; - @Input() userInfoURL: string; public user: User = null; sub; diff --git a/claims/myClaims/myClaims.component.ts b/claims/myClaims/myClaims.component.ts index 5f2369df..5e6d8833 100644 --- a/claims/myClaims/myClaims.component.ts +++ b/claims/myClaims/myClaims.component.ts @@ -30,7 +30,6 @@ import {Subscriber} from "rxjs"; export class MyClaimsComponent { @Input() claimsInfoURL: string; @Input() communityId:string; - @Input() userInfoURL: string; public user: User = null; constructor(private userManagementService: UserManagementService, private _router: Router) {} diff --git a/error-interceptor.service.ts b/error-interceptor.service.ts index 713949c3..701c6697 100644 --- a/error-interceptor.service.ts +++ b/error-interceptor.service.ts @@ -11,7 +11,7 @@ import * as url from "url"; @Injectable() export class ErrorInterceptorService implements HttpInterceptor { - private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL, properties.registryUrl? (properties.registryUrl + 'verification/'):null, properties.eoscDataTransferAPI].filter(value => !!value); + private static UNAUTHORIZED_WHITELIST = [properties.orcidAPIURL, properties.registryUrl? (properties.registryUrl + 'verification/'):null, properties.eoscDataTransferAPI].filter(value => !!value); private url: string = null; constructor(private router: Router) { diff --git a/login/userMini.component.ts b/login/userMini.component.ts index e8293086..87029003 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -122,12 +122,8 @@ export class UserMiniComponent implements OnInit, OnChanges { public isAuthorized: boolean = false; @Input() public mobileView: boolean = false; public firstLetters: string = ""; - public server: boolean = true; public routerHelper: RouterHelper = new RouterHelper(); @Input() userMenuItems; - @Input() logInUrl; - @Input() logOutUrl; - @Input() cookieDomain; @Input() notificationConfiguration: NotificationConfiguration; @ViewChild('notificationsSidebar') notificationsSidebar: NotificationsSidebarComponent; public showNotifications = false; @@ -137,9 +133,6 @@ export class UserMiniComponent implements OnInit, OnChanges { } ngOnInit() { - if (typeof document !== 'undefined') { - this.server = false; - } this.initUser(); } diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index d07abdb6..23fac7a3 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -42,7 +42,7 @@ export class User { this.role = []; if (info.roles) { info.roles.forEach(role => { - this.role.push(role); + this.role.push(decodeURIComponent(role).replace('$$', '::')); }); } else { if (info.edu_person_entitlements) { diff --git a/services/user-management.service.ts b/services/user-management.service.ts index 29997a60..f0fbdddc 100644 --- a/services/user-management.service.ts +++ b/services/user-management.service.ts @@ -14,6 +14,9 @@ import {isArray} from "rxjs/internal-compatibility"; }) export class UserManagementService { private readonly getUserInfoSubject: AdvancedAsyncSubject = new AdvancedAsyncSubject(); + private static LOGIN = 'openid_connect_login'; + private static LOGOUT: string = 'openid_logout'; + private static USERINFO: string = 'userInfo'; public fixRedirectURL: string = null; private redirectUrl: string = null; private subscription; @@ -39,11 +42,18 @@ export class UserManagementService { public getUserInfo(): Observable { return this.getUserInfoSubject.asObservable(); } - - public updateUserInfo(resolve: Function = null) { - this.subscription = this.http.get(properties.userInfoUrl, CustomOptions.registryOptions()).pipe(map(userInfo => { + + public getUserInfoAt(index = 1): Observable { + return this.http.get((isArray(properties.loginServiceURL)?properties.loginServiceURL[index]:properties.loginServiceURL) + + UserManagementService.USERINFO, CustomOptions.registryOptions()).pipe(map(userInfo => { return new User(userInfo); - })).subscribe(user => { + })) + } + + + public updateUserInfo(resolve: Function = null) { + this.subscription = this.getUserInfoAt().subscribe(user => { + console.log(user) this.getUserInfoSubject.next(user); if (resolve) { resolve(); @@ -85,20 +95,24 @@ export class UserManagementService { if(redirect) { this.redirectUrl = redirect; } else if (this.fixRedirectURL) { + console.log(this.fixRedirectURL) this.setRedirectUrl(this.fixRedirectURL); } else { this.setRedirectUrl(); } - window.location.href = this.setURL(properties.loginUrl) + encodeURIComponent(this.redirectUrl); + let loginURL: string | string[] = isArray(properties.loginServiceURL)?properties.loginServiceURL.map(url => url + UserManagementService.LOGIN):(properties.loginServiceURL + UserManagementService.LOGIN); + window.location.href = this.setURL(loginURL) + this.redirectUrl; } public logout() { this.setRedirectUrl(); Session.removeUser(); - window.location.href = this.setURL(properties.logoutUrl) + encodeURIComponent(this.redirectUrl); + let logoutURL: string | string[] = isArray(properties.loginServiceURL)?properties.loginServiceURL.map(url => url + UserManagementService.LOGOUT):(properties.loginServiceURL + UserManagementService.LOGOUT); + window.location.href = this.setURL(logoutURL) + this.redirectUrl; } setURL(url: string | string[]) { + console.log(url); if(isArray(url)) { let redirectURL = ''; url.forEach((url, index) => { diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 873c0cd9..ba758807 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -12,9 +12,7 @@
- +
@@ -192,9 +190,7 @@ - +
diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 8d9278aa..0ee4efca 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -57,10 +57,8 @@ export interface EnvProperties { vocabulariesAPI?: string; piwikBaseUrl?: string; piwikSiteId?: string; - loginUrl?: string | string[]; + loginServiceURL?: string | string[]; registryUrl?: string; - logoutUrl?: string | string[]; - userInfoUrl?: string; developersApiUrl?: string, cookieDomain?: string; feedbackmail?: string; diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts index a59a00e5..6005b3d9 100644 --- a/utils/properties/environments/environment.ts +++ b/utils/properties/environments/environment.ts @@ -107,9 +107,7 @@ export let commonDev: EnvProperties = { orcidClientId: "APP-A5M3KTX6NCN67L91", utilsService: "http://mpagasas.di.uoa.gr:8000", vocabulariesAPI: "https://dev-openaire.d4science.org/provision/mvc/vocabularies/", - loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_connect_login", - userInfoUrl: "http://mpagasas.di.uoa.gr:19080/login-service/userInfo", - logoutUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_logout", + loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/", cookieDomain: ".di.uoa.gr", feedbackmail: "kostis30fylloy@gmail.com", cacheUrl: "http://dl170.madgik.di.uoa.gr:3000/get?url=", @@ -146,9 +144,7 @@ export let commonTest: EnvProperties = { csvAPIURL: "https://services.openaire.eu/search/v2/api/reports", utilsService: "https://explore.openaire.eu/utils-service", vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/", - loginUrl: " https://services.openaire.eu/login-service/openid_connect_login", - userInfoUrl: " https://services.openaire.eu/login-service/userInfo", - logoutUrl: "https://services.openaire.eu/login-service/openid_logout", + loginServiceURL: " https://services.openaire.eu/login-service/", cacheUrl: "https://explore.openaire.eu/cache/get?url=", datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/", monitorServiceAPIURL: "https://services.openaire.eu/uoa-monitor-service", @@ -177,9 +173,7 @@ export let commonBeta: EnvProperties = { csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports", utilsService: "https://demo.openaire.eu/utils-service", vocabulariesAPI: "https://beta.services.openaire.eu/provision/mvc/vocabularies/", - loginUrl: "https://beta.services.openaire.eu/login-service/openid_connect_login", - userInfoUrl: "https://beta.services.openaire.eu/login-service/userInfo", - logoutUrl: "https://beta.services.openaire.eu/login-service/openid_logout", + loginServiceURL: "https://beta.services.openaire.eu/login-service/", cacheUrl: "https://demo.openaire.eu/cache/get?url=", datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/", monitorServiceAPIURL: "https://beta.services.openaire.eu/uoa-monitor-service", @@ -218,9 +212,7 @@ export let commonProd: EnvProperties = { csvAPIURL: "https://services.openaire.eu/search/v2/api/reports", utilsService: "https://explore.openaire.eu/utils-service", vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/", - loginUrl: " https://services.openaire.eu/login-service/openid_connect_login", - userInfoUrl: " https://services.openaire.eu/login-service/userInfo", - logoutUrl: "https://services.openaire.eu/login-service/openid_logout", + loginServiceURL: "https://services.openaire.eu/login-service/", cacheUrl: "https://explore.openaire.eu/cache/get?url=", datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/", monitorServiceAPIURL: "https://services.openaire.eu/uoa-monitor-service",