Skip to content

Commit d1fbc1b

Browse files
committed
ufal/fe-not-show-shib-welcome-page
* Loaded property from the cfg and check if the page with idp attributes could be showed up. If not redirect the user to the home page. (#431)
1 parent 6c6194c commit d1fbc1b

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/app/login-page/autoregistration/autoregistration.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="container" >
1+
<div *ngIf="(showAttributes | async) == true" class="container" >
22
<div *ngIf="(verificationToken$ | async) != null">
33
<h5 class="display-4">{{'clarin.autoregistration.welcome.message' | translate}} {{dspaceName$ | async}}</h5>
44
<div class="alert alert-info" role="alert" style="width: 100%">

src/app/login-page/autoregistration/autoregistration.component.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { hasSucceeded } from 'src/app/core/data/request-entry-state.model';
2323
import { FindListOptions } from '../../core/data/find-list-options.model';
2424
import { getBaseUrl } from '../../shared/clarin-shared-util';
2525
import { ConfigurationProperty } from '../../core/shared/configuration-property.model';
26+
import { RemoteData } from '../../core/data/remote-data';
2627

2728
/**
2829
* This component is showed up when the user has clicked on the `verification token`.
@@ -62,6 +63,12 @@ export class AutoregistrationComponent implements OnInit {
6263
*/
6364
baseUrl = '';
6465

66+
/**
67+
* Show attributes passed from the IdP or not.
68+
* It could be disabled by the cfg property `authentication-shibboleth.show.idp-attributes`
69+
*/
70+
showAttributes: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
71+
6572
constructor(protected router: Router,
6673
public route: ActivatedRoute,
6774
private requestService: RequestService,
@@ -82,6 +89,14 @@ export class AutoregistrationComponent implements OnInit {
8289
// Load the `ClarinVerificationToken` based on the `verificationToken` value
8390
this.loadVerificationToken();
8491
await this.assignBaseUrl();
92+
await this.loadShowAttributes().then((value: RemoteData<ConfigurationProperty>) => {
93+
const stringBoolean = value?.payload?.values?.[0];
94+
this.showAttributes.next(stringBoolean === 'true');
95+
});
96+
97+
if (this.showAttributes.value === false) {
98+
this.sendAutoLoginRequest();
99+
}
85100
}
86101

87102
/**
@@ -241,8 +256,17 @@ export class AutoregistrationComponent implements OnInit {
241256
return baseUrlResponse?.values?.[0];
242257
});
243258
}
244-
}
245259

260+
/**
261+
* Load the `authentication-shibboleth.show.idp-attributes` property from the cfg
262+
*/
263+
async loadShowAttributes(): Promise<any> {
264+
return await this.configurationService.findByPropertyName('authentication-shibboleth.show.idp-attributes')
265+
.pipe(
266+
getFirstCompletedRemoteData()
267+
).toPromise();
268+
}
269+
}
246270
/**
247271
* ShibHeaders string value from the verificationToken$ parsed to the objects.
248272
*/

0 commit comments

Comments
 (0)