aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2020-12-24 13:24:50 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2020-12-24 13:24:50 +0900
commit06b05b006ed7d22a69282d5dfae80c420e122b53 (patch)
treefde7c2067fa7944013a4b8470bee9f0f9cf33837 /src
parent878064c437f30b6683e6414be18b19252f51184c (diff)
downloadreclaim-ui-06b05b006ed7d22a69282d5dfae80c420e122b53.tar.gz
reclaim-ui-06b05b006ed7d22a69282d5dfae80c420e122b53.zip
settings page, experiments tweaks
Diffstat (limited to 'src')
-rw-r--r--src/app/app-routing.module.ts6
-rw-r--r--src/app/app.component.html6
-rw-r--r--src/app/app.component.ts7
-rw-r--r--src/app/app.module.ts6
-rw-r--r--src/app/config.service.ts30
-rw-r--r--src/app/config/config.component.html6
-rw-r--r--src/app/config/config.component.ts18
-rw-r--r--src/app/edit-credentials/edit-credentials.component.html26
-rw-r--r--src/app/edit-credentials/edit-credentials.component.ts222
-rw-r--r--src/app/edit-identity/edit-identity.component.html9
-rw-r--r--src/app/edit-identity/edit-identity.component.ts4
-rw-r--r--src/app/identity-list/identity-list.component.ts6
-rw-r--r--src/app/import-attributes/import-attributes.component.ts13
-rw-r--r--src/locales/en/messages.json14
14 files changed, 91 insertions, 282 deletions
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 7c221b0..1ea7895 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -5,7 +5,9 @@ import { NewIdentityComponent } from './new-identity/new-identity.component';
5import { EditIdentityComponent } from './edit-identity/edit-identity.component'; 5import { EditIdentityComponent } from './edit-identity/edit-identity.component';
6import { EditAuthorizationsComponent } from './edit-authorizations/edit-authorizations.component'; 6import { EditAuthorizationsComponent } from './edit-authorizations/edit-authorizations.component';
7import { EditCredentialsComponent } from './edit-credentials/edit-credentials.component'; 7import { EditCredentialsComponent } from './edit-credentials/edit-credentials.component';
8import { ImportAttributesComponent } from './import-attributes/import-attributes.component';
8import { AuthorizationRequestComponent } from './authorization-request/authorization-request.component'; 9import { AuthorizationRequestComponent } from './authorization-request/authorization-request.component';
10import { ConfigComponent } from './config/config.component';
9 11
10const routes: Routes = [ 12const routes: Routes = [
11 { path: 'index.html', component: IdentityListComponent }, 13 { path: 'index.html', component: IdentityListComponent },
@@ -15,7 +17,9 @@ const routes: Routes = [
15 { path: 'edit-identity/:id', component: EditIdentityComponent }, 17 { path: 'edit-identity/:id', component: EditIdentityComponent },
16 { path: 'edit-authorizations/:id', component: EditAuthorizationsComponent }, 18 { path: 'edit-authorizations/:id', component: EditAuthorizationsComponent },
17 { path: 'edit-credentials/:id', component: EditCredentialsComponent }, 19 { path: 'edit-credentials/:id', component: EditCredentialsComponent },
18 { path: 'authorization-request', component: AuthorizationRequestComponent } 20 { path: 'import-attributes/:id', component: ImportAttributesComponent },
21 { path: 'authorization-request', component: AuthorizationRequestComponent },
22 { path: 'config', component: ConfigComponent }
19]; 23];
20 24
21@NgModule({ 25@NgModule({
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 7bb4ac3..3877791 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,6 +1,2 @@
1<div class="logo"><img src="assets/reclaim_icon.png"/></div> 1<div class="logo"><img src="assets/reclaim_icon.png"/><button class="btn btn-primary" [routerLink]="['/config']" style="float:right;"><i class="fa fa-cog"></i></button></div>
2<router-outlet></router-outlet> 2<router-outlet></router-outlet>
3<div style="margin: 1em" (click)="toggleExperimental()">
4 <i [className]="isExperimental() ? 'fa fa-toggle-on' : 'fa fa-toggle-off'"></i>
5 <b *ngIf="isExperimental()">{{getMessage("app_html@experimentalEnabled")}}</b><span *ngIf="!isExperimental()">{{getMessage("app_html@experimentalDisabled")}}</span>
6</div>
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index b93cafd..f233feb 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -20,13 +20,6 @@ export class AppComponent {
20 this.configService = _configService; 20 this.configService = _configService;
21 } 21 }
22 22
23 isExperimental() {
24 return this.configService.get().experiments;
25 }
26
27 toggleExperimental() {
28 this.configService.get().experiments = !this.configService.get().experiments;
29 }
30 23
31 //Internationalization 24 //Internationalization
32 getMessage(key, sub?){ 25 getMessage(key, sub?){
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 1bfb1d9..dd3d06d 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -23,6 +23,8 @@ import { AuthorizationRequestComponent } from './authorization-request/authoriza
23import { EditAuthorizationsComponent } from './edit-authorizations/edit-authorizations.component'; 23import { EditAuthorizationsComponent } from './edit-authorizations/edit-authorizations.component';
24import { EditCredentialsComponent } from './edit-credentials/edit-credentials.component'; 24import { EditCredentialsComponent } from './edit-credentials/edit-credentials.component';
25import { OAuthStorage } from 'angular-oauth2-oidc'; 25import { OAuthStorage } from 'angular-oauth2-oidc';
26import { ImportAttributesComponent } from './import-attributes/import-attributes.component';
27import { ConfigComponent } from './config/config.component';
26 28
27@NgModule({ 29@NgModule({
28 declarations: [ 30 declarations: [
@@ -34,7 +36,9 @@ import { OAuthStorage } from 'angular-oauth2-oidc';
34 EditIdentityComponent, 36 EditIdentityComponent,
35 AuthorizationRequestComponent, 37 AuthorizationRequestComponent,
36 EditAuthorizationsComponent, 38 EditAuthorizationsComponent,
37 EditCredentialsComponent 39 EditCredentialsComponent,
40 ImportAttributesComponent,
41 ConfigComponent
38 ], 42 ],
39 imports: [ 43 imports: [
40 BrowserModule, 44 BrowserModule,
diff --git a/src/app/config.service.ts b/src/app/config.service.ts
index c0eefd0..03dabdb 100644
--- a/src/app/config.service.ts
+++ b/src/app/config.service.ts
@@ -6,14 +6,38 @@ import { Config } from './config';
6@Injectable() 6@Injectable()
7export class ConfigService { 7export class ConfigService {
8 config: Config; 8 config: Config;
9 defaultConfig: Config;
9 10
10 constructor(private http: HttpClient) { } 11 constructor(private http: HttpClient) {
12 var confString = localStorage.getItem('reclaimSettings');
13 try {
14 this.config = JSON.parse(confString);
15 console.log("Loaded settings: " + confString);
16 } catch(e) {
17 this.http.get<Config>('assets/config.json').subscribe(cnf => {
18 this.config = cnf;
19 console.log("Got default settings: " + cnf);
20 });
21 console.log("Error loading settings: " + e);
22 }
23 }
11 24
12 get() { 25 get(): Config {
13 return this.config; 26 return this.config;
14 } 27 }
15 28
29 save(cnf: Config) {
30 try {
31 var confString = JSON.stringify(cnf);
32 localStorage.setItem('reclaimSettings', confString);
33 this.config = cnf;
34 console.log("Saved: " + confString);
35 } catch(e) {
36 console.log(confString);
37 }
38 }
39
16 async load() { 40 async load() {
17 this.config = await this.http.get<Config>('assets/config.json').toPromise(); 41 this.defaultConfig = await this.http.get<Config>('assets/config.json').toPromise();
18 } 42 }
19} 43}
diff --git a/src/app/config/config.component.html b/src/app/config/config.component.html
index d5f4c6c..69a94c6 100644
--- a/src/app/config/config.component.html
+++ b/src/app/config/config.component.html
@@ -10,6 +10,12 @@
10 <i [className]="isExperimental() ? 'fa fa-toggle-on mr-2' : 'fa fa-toggle-off mr-2'"></i> 10 <i [className]="isExperimental() ? 'fa fa-toggle-on mr-2' : 'fa fa-toggle-off mr-2'"></i>
11 <b *ngIf="isExperimental()">{{getMessage("app_html@experimentalEnabled")}}</b><span *ngIf="!isExperimental()">{{getMessage("app_html@experimentalDisabled")}}</span> 11 <b *ngIf="isExperimental()">{{getMessage("app_html@experimentalEnabled")}}</b><span *ngIf="!isExperimental()">{{getMessage("app_html@experimentalDisabled")}}</span>
12 </div> 12 </div>
13 <span class="mr-2">re:claimID REST API base URL</span> <input [(ngModel)]="config.apiUrl">
14 <div>
15 <button class="btn btn-primary" (click)="saveAndBack()">
16 <span class="fa fa-save"></span> {{ getMessage("SaveAndBack") }}
17 </button>
18
13 </div> 19 </div>
14</div> 20</div>
15 21
diff --git a/src/app/config/config.component.ts b/src/app/config/config.component.ts
index 52e9af9..b68eddd 100644
--- a/src/app/config/config.component.ts
+++ b/src/app/config/config.component.ts
@@ -1,7 +1,8 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { ConfigService } from '../config.service'; 2import { ConfigService } from '../config.service';
3import { Config } from '../config';
3import { LanguageService } from '../language.service'; 4import { LanguageService } from '../language.service';
4 5import { ActivatedRoute, Router} from '@angular/router';
5 6
6@Component({ 7@Component({
7 selector: 'app-config', 8 selector: 'app-config',
@@ -11,14 +12,17 @@ import { LanguageService } from '../language.service';
11export class ConfigComponent implements OnInit { 12export class ConfigComponent implements OnInit {
12 13
13 configService: ConfigService; 14 configService: ConfigService;
15 config: Config;
14 16
15 constructor(private _configService: ConfigService, 17 constructor(private _configService: ConfigService,
16 private languageService: LanguageService) { 18 private languageService: LanguageService,
19 private router: Router) {
17 this.configService = _configService; 20 this.configService = _configService;
18 } 21 }
19 22
20 23
21 ngOnInit(): void { 24 ngOnInit(): void {
25 this.config = this.configService.get();
22 } 26 }
23 27
24 isExperimental() { 28 isExperimental() {
@@ -26,10 +30,12 @@ export class ConfigComponent implements OnInit {
26 } 30 }
27 31
28 toggleExperimental() { 32 toggleExperimental() {
29 var config = this.configService.get(); 33 this.config.experiments = !this.config.experiments;
30 console.log("Config is: "+config); 34 }
31 config.experiments = !config.experiments; 35
32 this.configService.save(config); 36 saveAndBack() {
37 this.configService.save(this.config);
38 this.router.navigate(['/']);
33 } 39 }
34 40
35 //Internationalization 41 //Internationalization
diff --git a/src/app/edit-credentials/edit-credentials.component.html b/src/app/edit-credentials/edit-credentials.component.html
index dc2bea2..d9b0e58 100644
--- a/src/app/edit-credentials/edit-credentials.component.html
+++ b/src/app/edit-credentials/edit-credentials.component.html
@@ -103,35 +103,13 @@
103 class="fa fa-times"></span> </div> 103 class="fa fa-times"></span> </div>
104 </td> 104 </td>
105 </tr> 105 </tr>
106 <tr [class.alert-danger]="isCredInConflict(newCredential)" *ngIf="loggedIn()"> 106 <!-- FIXME implement adding plain text credentials -->
107 <td>
108 <input [class.text-danger]="!credentialNameValid(newCredential)" placeholder="{{getMessage('edit_credentials_html@credentials')}}"
109 [(ngModel)]="newCredential.name">
110 </td>
111 <td>
112 <div style="min-width: 15em">JWT</div>
113 </td>
114 <td>
115 {{getNewCredentialExpiration()}}
116 </td>
117 <td>
118 <div style="min-width: 15em">{{newIdProvider.url}}</div>
119 </td>
120 <td>
121 <button class="btn btn-primary" [disabled]="!canAddCredential(newCredential)" (click)="saveIdProvider()">
122 <span class="fa fa-plus"></span>
123 </button>
124 <button class="btn btn-primary ml-2" (click)="cancelAdding()">
125 <span class="fa fa-trash"></span>
126 </button>
127 </td>
128 </tr>
129 </tbody> 107 </tbody>
130 </table> 108 </table>
131 109
132 <!-- Edit card buttons --> 110 <!-- Edit card buttons -->
133 <div> 111 <div>
134 <button class="btn btn-primary" (click)="goBack()" [disabled]="!canGoBack()"> 112 <button class="btn btn-primary" [routerLink]="['/edit-identity', identity.name ]">
135 <span class="fa fa-save"></span> {{getMessage("Back")}} 113 <span class="fa fa-save"></span> {{getMessage("Back")}}
136 </button> 114 </button>
137 </div> 115 </div>
diff --git a/src/app/edit-credentials/edit-credentials.component.ts b/src/app/edit-credentials/edit-credentials.component.ts
index c19a0f9..1ac2acf 100644
--- a/src/app/edit-credentials/edit-credentials.component.ts
+++ b/src/app/edit-credentials/edit-credentials.component.ts
@@ -23,11 +23,6 @@ export class EditCredentialsComponent implements OnInit {
23 identity: Identity; 23 identity: Identity;
24 credentials: Credential[]; 24 credentials: Credential[];
25 newCredential: Credential; 25 newCredential: Credential;
26 newIdProvider: IdProvider;
27 webfingerEmail: string;
28 emailNotFoundAlertClosed: boolean;
29 errorMassage: string;
30 scopes: Scope[];
31 26
32 constructor(private reclaimService: ReclaimService, 27 constructor(private reclaimService: ReclaimService,
33 private identityService: IdentityService, 28 private identityService: IdentityService,
@@ -40,26 +35,7 @@ export class EditCredentialsComponent implements OnInit {
40 ngOnInit() { 35 ngOnInit() {
41 this.newCredential = new Credential('', '', '', 'JWT', '', 0, []); 36 this.newCredential = new Credential('', '', '', 'JWT', '', 0, []);
42 this.identity = new Identity('',''); 37 this.identity = new Identity('','');
43 this.newIdProvider = new IdProvider ('', '');
44 this.webfingerEmail = '';
45 this.emailNotFoundAlertClosed = true;
46 this.errorMassage = '';
47 this.loadScopesFromLocalStorage()
48 this.loadIdProviderFromLocalStorage();
49 this.credentials = []; 38 this.credentials = [];
50 if (this.newIdProvider.url !== ''){
51 const loginOptions: LoginOptions = {
52 customHashFragment: "?code="+localStorage.getItem("credentialCode") + "&state=" + localStorage.getItem("credentialState") + "&session_state="+ localStorage.getItem("credentialSession_State"),
53 }
54 this.configureOauthService();
55 if (!localStorage.getItem("credentialCode")){
56 this.oauthService.loadDiscoveryDocumentAndTryLogin();
57 }
58 else{
59 this.oauthService.loadDiscoveryDocumentAndTryLogin(loginOptions);
60 }
61
62 }
63 this.activatedRoute.params.subscribe(p => { 39 this.activatedRoute.params.subscribe(p => {
64 if (p['id'] === undefined) { 40 if (p['id'] === undefined) {
65 return; 41 return;
@@ -86,60 +62,6 @@ export class EditCredentialsComponent implements OnInit {
86 }); 62 });
87 } 63 }
88 64
89 saveIdProvider(){
90 this.saveIdProviderinLocalStorage();
91 this.addCredential();
92 }
93
94 addCredential() {
95 if (!this.oauthService.hasValidAccessToken()){
96 console.log("No AccessToken");
97 return;
98 }
99 this.newCredential.value = this.oauthService.getIdToken();
100 this.reclaimService.addCredential(this.identity, this.newCredential).subscribe(res => {
101 console.log("Saved Credential");
102 this.resetNewIdProvider();
103 this.resetScopes();
104 this.updateCredentials();
105 this.newCredential.name = '';
106 this.newCredential.value = '';
107 this.logOutFromOauthService();
108 },
109 err => {
110 console.log("Failed saving credential");
111 console.log(err);
112 //this.errorInfos.push("Failed to update identity ``" + this.identityInEdit.name + "''");
113 EMPTY
114 this.newCredential.name = '';
115 this.newCredential.value = '';
116 this.logOutFromOauthService();
117 });
118 }
119
120 saveIdProviderinLocalStorage(){
121 localStorage.setItem('Authorization: ' + this.newCredential.name, 'idProvider: ' + this.newIdProvider.url + ';redirectUri: ' + this.oauthService.redirectUri + ';clientId: ' + this.oauthService.clientId + ';accessToken: ' + this.oauthService.getIdToken() + ';idToken: ' + this.oauthService.getIdToken());
122 }
123
124 private storeCredential() {
125 const promises = [];
126 if ((this.newCredential.value !== '') || (this.newCredential.type !== '')) {
127 promises.push(from(this.reclaimService.addCredential(this.identity, this.newCredential)));
128 }
129 return forkJoin(promises);
130 }
131
132 canGoBack() {
133 if (this.newIdProvider.url === ''){
134 return true;
135 }
136 return false;
137 }
138
139 goBack() {
140 this.router.navigate(['/edit-identity', this.identity.name]);
141 }
142
143 isCredInConflict(credential: Credential) { 65 isCredInConflict(credential: Credential) {
144 let i; 66 let i;
145 if (undefined !== this.credentials) { 67 if (undefined !== this.credentials) {
@@ -213,150 +135,6 @@ export class EditCredentialsComponent implements OnInit {
213 return true; 135 return true;
214 } 136 }
215 137
216 loadIdProviderFromLocalStorage(){
217 this.newIdProvider.url = localStorage.getItem("newIdProviderURL") || '';
218 this.newIdProvider.name = this.getNewIdProviderName(this.newIdProvider.url);
219 }
220
221 getNewIdProviderName(url: string){
222 return url.split('//')[1];
223 }
224
225 getNewCredentialExpiration(){
226 var exp = new Date(0);
227 exp.setMilliseconds(this.oauthService.getIdTokenExpiration());
228 return exp.toLocaleString();
229 }
230
231 resetNewIdProvider(){
232 this.newIdProvider.url = '';
233 this.newIdProvider.name = '';
234 localStorage.removeItem('newIdProviderURL');
235 }
236
237 logOutFromOauthService(){
238 if (!this.oauthService.hasValidAccessToken()){
239 return;
240 }
241 this.oauthService.logOut();
242 }
243
244 loggedIn(){
245 return this.oauthService.hasValidAccessToken();
246 }
247
248 cancelAdding(){
249 this.logOutFromOauthService();
250 this.resetNewIdProvider();
251 this.resetScopes();
252 this.newCredential.value = '';
253 this.newCredential.name = '';
254 }
255
256
257 //Webfinger
258
259 discoverIdProvider() {
260 if (!this.isValidEmailforDiscovery()){
261 return;
262 }
263 localStorage.setItem('userForCredential', this.identity.name);
264 this.credentialService.getLink(this.webfingerEmail).subscribe (idProvider => {
265 this.newIdProvider.url = (idProvider.links [0]).href;
266 localStorage.setItem('newIdProviderURL', this.newIdProvider.url);
267 this.newIdProvider.name = this.getNewIdProviderName(this.newIdProvider.url);
268 console.log(this.newIdProvider.url);
269 this.webfingerEmail == '';
270 this.getScopes();
271 },
272 error => {
273 if (error.status == 404){
274 this.errorMassage = this.getMessage("edit_credentials_ts@noAccount");
275 }
276 else{
277 this.errorMassage = this.getMessage("edit_credentials_ts@errorWrongAddress");
278 }
279 this.emailNotFoundAlertClosed = false;
280 setTimeout(() => this.emailNotFoundAlertClosed = true, 20000);
281 this.webfingerEmail = '';
282 console.log (error);
283 });
284 }
285
286 getScopes(){
287 this.configureOauthService();
288 this.credentialService.getDiscoveryDocument(this.oauthService.issuer).subscribe(openidConfig => {
289 openidConfig["scopes_supported"].forEach(scope => {
290 const scopeInterface: Scope = {
291 scope: scope,
292 chosen: true,
293 }
294 this.scopes.push(scopeInterface)
295 });
296 localStorage.setItem("scopes", JSON.stringify(this.scopes));
297 });
298 }
299
300 loadScopesFromLocalStorage(){
301 this.scopes = [];
302 var loadedScopes = localStorage.getItem("scopes");
303 if (loadedScopes==null){
304 return
305 }
306 loadedScopes.split(',{').forEach(scopeObject => {
307 var scopeName = scopeObject.split(',')[0];
308 var scopeChosen = scopeObject.split(',')[1].slice(0, -1);
309 const scopeInterface: Scope = {
310 scope: scopeName.split(':')[1].slice(1,-1),
311 chosen: (/true/i).test(scopeChosen.split(':')[1]),
312 }
313 this.scopes.push(scopeInterface)
314 }
315 );
316 }
317
318 newIdProviderDiscovered(){
319 if (this.newIdProvider.url == ''){
320 return false;
321 }
322 return true;
323 }
324
325 isValidEmailforDiscovery(){
326 if (!this.webfingerEmail.includes('@') && this.webfingerEmail != ''){
327 return false;
328 }
329 return true;
330 }
331
332 loginFhgAccount(){
333 this.configureOauthService();
334 this.oauthService.loadDiscoveryDocumentAndLogin();
335 }
336
337 configureOauthService(){
338 var authCodeFlowConfig = this.credentialService.getOauthConfig(this.newIdProvider, this.scopes);
339 this.oauthService.configure(authCodeFlowConfig);
340 }
341
342 cancelLinking(){
343 this.resetNewIdProvider();
344 this.resetScopes();
345 this.webfingerEmail = '';
346 }
347
348 necessaryScope(scope){
349 if (scope=="openid" || scope=="profile") {
350 return true;
351 }
352 return false;
353 }
354
355 resetScopes(){
356 localStorage.removeItem("scopes");
357 this.scopes = [];
358 }
359
360 //Internationalization 138 //Internationalization
361 getMessage(key, sub?){ 139 getMessage(key, sub?){
362 return this.languageService.getMessage(key, sub); 140 return this.languageService.getMessage(key, sub);
diff --git a/src/app/edit-identity/edit-identity.component.html b/src/app/edit-identity/edit-identity.component.html
index ea5a10c..716bb4e 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -9,6 +9,15 @@
9 <h2 class="fa-2x"><i class="fa fa-user-circle pr-2"></i> {{ identity.name }}</h2> 9 <h2 class="fa-2x"><i class="fa fa-user-circle pr-2"></i> {{ identity.name }}</h2>
10 </div> 10 </div>
11 </div> 11 </div>
12 <!--IdProvider-Discovery-->
13 <div *ngIf="!hasAttributes()" class="alert alert-primary alert-dismissible fade show my-2" role="alert" >
14 <span class="fa fa-info"> </span> <b class="ml-2">{{getMessage("edit_identity_html@noAttributes")}}</b><br/>
15 {{getMessage("edit_identity_html@importInfo")}}<br/>
16 <button class="btn btn-primary" [routerLink]="['/import-attributes', identity.name ]">
17 <span class="fa fa-download"></span> {{getMessage("edit_identity_html@linkAccount")}}
18 </button>
19 </div>
20
12 <!-- Attribute table --> 21 <!-- Attribute table -->
13 <div class="card-body"> 22 <div class="card-body">
14 <div> 23 <div>
diff --git a/src/app/edit-identity/edit-identity.component.ts b/src/app/edit-identity/edit-identity.component.ts
index 6ed4e24..654d622 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -545,4 +545,8 @@ export class EditIdentityComponent implements OnInit {
545 return this.languageService.getMessage(key, sub); 545 return this.languageService.getMessage(key, sub);
546 } 546 }
547 547
548 hasAttributes(): boolean {
549 return this.attributes.length > 0;
550 }
551
548} 552}
diff --git a/src/app/identity-list/identity-list.component.ts b/src/app/identity-list/identity-list.component.ts
index 8c44d79..94805a9 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -65,11 +65,7 @@ export class IdentityListComponent implements OnInit {
65 localStorage.setItem('credentialState', this.route.snapshot.queryParams["state"]); 65 localStorage.setItem('credentialState', this.route.snapshot.queryParams["state"]);
66 localStorage.setItem('credentialSession_State', this.route.snapshot.queryParams["session_state"]); 66 localStorage.setItem('credentialSession_State', this.route.snapshot.queryParams["session_state"]);
67 var user = localStorage.getItem('userForCredential'); 67 var user = localStorage.getItem('userForCredential');
68 this.router.navigate(['/edit-credentials', user]); 68 this.router.navigate(['/import-attributes', user]);
69 }
70 if (undefined !== this.route.snapshot.queryParams["logout"]){
71 var user = localStorage.getItem('userForCredential');
72 this.router.navigate(['/edit-credentials', user]);
73 } 69 }
74 if (!this.oidcService.inOpenIdFlow() && undefined == this.route.snapshot.queryParams["authz_request"]) { 70 if (!this.oidcService.inOpenIdFlow() && undefined == this.route.snapshot.queryParams["authz_request"]) {
75 this.oidcService.parseRouteParams(this.route.snapshot.queryParams); 71 this.oidcService.parseRouteParams(this.route.snapshot.queryParams);
diff --git a/src/app/import-attributes/import-attributes.component.ts b/src/app/import-attributes/import-attributes.component.ts
index 4f610cb..3194490 100644
--- a/src/app/import-attributes/import-attributes.component.ts
+++ b/src/app/import-attributes/import-attributes.component.ts
@@ -10,7 +10,7 @@ import { IdProvider } from '../idProvider';
10import { LoginOptions } from 'angular-oauth2-oidc'; 10import { LoginOptions } from 'angular-oauth2-oidc';
11import { Scope } from '../scope'; 11import { Scope } from '../scope';
12import { LanguageService } from '../language.service'; 12import { LanguageService } from '../language.service';
13 13import { ConfigService } from '../config.service';
14 14
15@Component({ 15@Component({
16 selector: 'app-import-attributes', 16 selector: 'app-import-attributes',
@@ -37,7 +37,8 @@ export class ImportAttributesComponent implements OnInit {
37 private router: Router, 37 private router: Router,
38 private credentialService: CredentialService, 38 private credentialService: CredentialService,
39 private oauthService: OAuthService, 39 private oauthService: OAuthService,
40 private languageService: LanguageService) { } 40 private languageService: LanguageService,
41 private configService: ConfigService) { }
41 42
42 43
43 ngOnInit(): void { 44 ngOnInit(): void {
@@ -124,8 +125,12 @@ export class ImportAttributesComponent implements OnInit {
124 this.discoveringIdProvider = true; 125 this.discoveringIdProvider = true;
125 localStorage.setItem('userForCredential', this.identity.name); 126 localStorage.setItem('userForCredential', this.identity.name);
126 let account = this.webfingerEmail; 127 let account = this.webfingerEmail;
127 if (this.webfingerEmail.substr(this.webfingerEmail.indexOf('@')+1) === 'aisec.fraunhofer.de') { 128 if (this.configService.get().experiments) {
128 account = this.webfingerEmail.substr(0, this.webfingerEmail.indexOf('@')+1) + 'as.aisec.fraunhofer.de'; 129 if (this.webfingerEmail.substr(this.webfingerEmail.indexOf('@')+1) === 'aisec.fraunhofer.de') {
130 account = this.webfingerEmail.substr(0, this.webfingerEmail.indexOf('@')+1) + 'as.aisec.fraunhofer.de';
131 } else if (this.webfingerEmail.substr(this.webfingerEmail.indexOf('@')+1) === 'bfh.ch') {
132 account = this.webfingerEmail.substr(0, this.webfingerEmail.indexOf('@')+1) + 'omejdn.nslab.ch';
133 }
129 } 134 }
130 135
131 this.credentialService.getLink(account).subscribe (idProvider => { 136 this.credentialService.getLink(account).subscribe (idProvider => {
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 42be71a..a965f3f 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -22,6 +22,9 @@
22 "authorization_request_html@retry": "Retry", 22 "authorization_request_html@retry": "Retry",
23 "authorization_request_html@cancelRequest": "Cancel verification request", 23 "authorization_request_html@cancelRequest": "Cancel verification request",
24 "authorization_request_html@requestCancelled": "Request cancelled", 24 "authorization_request_html@requestCancelled": "Request cancelled",
25 "import_attributes_html@import": "Import",
26 "import_attributes_html@importFor": "Import attributes for",
27 "import_attributes_html@confirm": "Confirm",
25 "edit_authorizations_html@manageAuths": "Manage authorizations for", 28 "edit_authorizations_html@manageAuths": "Manage authorizations for",
26 "edit_authorizations_html@authEntity": "Authorized Entity:", 29 "edit_authorizations_html@authEntity": "Authorized Entity:",
27 "edit_authorizations_html@sharedAttributes": "Shared attributes:", 30 "edit_authorizations_html@sharedAttributes": "Shared attributes:",
@@ -32,8 +35,8 @@
32 "edit_credentials_html@linkAccount": "Link account:", 35 "edit_credentials_html@linkAccount": "Link account:",
33 "edit_credentials_html@notCompatible": "This account is not compatible with re:claimID.", 36 "edit_credentials_html@notCompatible": "This account is not compatible with re:claimID.",
34 "edit_credentials_html@info": "INFO", 37 "edit_credentials_html@info": "INFO",
35 "edit_credentials_html@linkAccountInfo1": "It is possible to link your external\naccounts with a re:claimID identity. To do so, enter you email address\nbelow and click \"Check compatibility\".", 38 "edit_credentials_html@linkAccountInfo1": "It is possible to import attributes from your external\naccounts into a re:claimID identity. To do so, enter you email address\nbelow and click \"Import\".",
36 "edit_credentials_html@linkAccountInfo2": "Not all external accounts support linking to re:claimID identities.", 39 "edit_credentials_html@linkAccountInfo2": "Not all external accounts support this feature.",
37 "edit_credentials_html@checkCompatability": "Check compatibility", 40 "edit_credentials_html@checkCompatability": "Check compatibility",
38 "edit_credentials_html@availableClaims": "Available claims to request:", 41 "edit_credentials_html@availableClaims": "Available claims to request:",
39 "edit_credentials_html@link": "Link", 42 "edit_credentials_html@link": "Link",
@@ -50,6 +53,9 @@
50 "edit_credentials_ts@noAccount": "No account found with this email", 53 "edit_credentials_ts@noAccount": "No account found with this email",
51 "edit_credentials_ts@errorWrongAddress": "An Error has occured - This may have been caused by a wrong e-mail address.", 54 "edit_credentials_ts@errorWrongAddress": "An Error has occured - This may have been caused by a wrong e-mail address.",
52 "edit_identity_html@basicInfo": "Basic user information", 55 "edit_identity_html@basicInfo": "Basic user information",
56 "edit_identity_html@noAttributes": "This identity seems to not yet have any attributes!",
57 "edit_identity_html@importInfo": "You can import attributes from an existing online account or manually add your own below.",
58 "edit_identity_html@linkAccount": "Import attributes",
53 "edit_identity_html@standardScopes": "The attributes below correspond to the standard scopes of the\nOpenID Connect specification: ``profile'', ``email'', ``phone'' and ``address''.", 59 "edit_identity_html@standardScopes": "The attributes below correspond to the standard scopes of the\nOpenID Connect specification: ``profile'', ``email'', ``phone'' and ``address''.",
54 "edit_identity_html@claimAsAttribute": "{{CREDVALUE}} issued by {{ISSUER}} as attribute for ``{{CLAIMVALUE}}''", 60 "edit_identity_html@claimAsAttribute": "{{CREDVALUE}} issued by {{ISSUER}} as attribute for ``{{CLAIMVALUE}}''",
55 "edit_identity_html@attribute": "Attribute", 61 "edit_identity_html@attribute": "Attribute",
@@ -93,8 +99,8 @@
93 "new_identity_html@usernameDuplicate": "An identity with this username already exists.", 99 "new_identity_html@usernameDuplicate": "An identity with this username already exists.",
94 "new_identity_html@enterUsername": "Enter a username for your new identity.", 100 "new_identity_html@enterUsername": "Enter a username for your new identity.",
95 "new_identity_html@username": "Username", 101 "new_identity_html@username": "Username",
96 "app_html@experimentalEnabled": "Epxerimental features enabled", 102 "app_html@experimentalEnabled": "Experimental features enabled",
97 "app_html@experimentalDisabled": "Epxerimental features disabled", 103 "app_html@experimentalDisabled": "Experimental features disabled",
98 "claim@family_name": "Family name", 104 "claim@family_name": "Family name",
99 "claim@given_name": "Given name", 105 "claim@given_name": "Given name",
100 "claim@middle_name": "Middle name", 106 "claim@middle_name": "Middle name",