@@ -23,6 +23,7 @@ import { hasSucceeded } from 'src/app/core/data/request-entry-state.model';
23
23
import { FindListOptions } from '../../core/data/find-list-options.model' ;
24
24
import { getBaseUrl } from '../../shared/clarin-shared-util' ;
25
25
import { ConfigurationProperty } from '../../core/shared/configuration-property.model' ;
26
+ import { RemoteData } from '../../core/data/remote-data' ;
26
27
27
28
/**
28
29
* This component is showed up when the user has clicked on the `verification token`.
@@ -62,6 +63,12 @@ export class AutoregistrationComponent implements OnInit {
62
63
*/
63
64
baseUrl = '' ;
64
65
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
+
65
72
constructor ( protected router : Router ,
66
73
public route : ActivatedRoute ,
67
74
private requestService : RequestService ,
@@ -82,6 +89,14 @@ export class AutoregistrationComponent implements OnInit {
82
89
// Load the `ClarinVerificationToken` based on the `verificationToken` value
83
90
this . loadVerificationToken ( ) ;
84
91
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
+ }
85
100
}
86
101
87
102
/**
@@ -241,8 +256,17 @@ export class AutoregistrationComponent implements OnInit {
241
256
return baseUrlResponse ?. values ?. [ 0 ] ;
242
257
} ) ;
243
258
}
244
- }
245
259
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
+ }
246
270
/**
247
271
* ShibHeaders string value from the verificationToken$ parsed to the objects.
248
272
*/
0 commit comments