[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 305/459: renamed attestations to credentials
From: |
gnunet |
Subject: |
[reclaim-ui] 305/459: renamed attestations to credentials |
Date: |
Fri, 11 Jun 2021 23:26:37 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.
commit 899ad8ba320f52740367da9e5c02b725bac26c60
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Thu Aug 20 11:03:04 2020 +0200
renamed attestations to credentials
---
src/app/app-routing.module.ts | 4 +-
src/app/app.module.ts | 8 +-
src/app/attribute.ts | 2 +-
src/app/authorization.ts | 2 +-
...ttestation.service.ts => credential.service.ts} | 17 +--
src/app/{attestation.ts => credential.ts} | 2 +-
.../edit-credentials.component.css} | 0
.../edit-credentials.component.html} | 40 +++----
.../edit-credentials.component.ts} | 130 ++++++++++-----------
src/app/edit-identity/edit-identity.component.html | 106 ++++++++---------
src/app/edit-identity/edit-identity.component.ts | 74 ++++++------
src/app/identity-list/identity-list.component.ts | 52 ++++-----
src/app/open-id.service.ts | 6 +-
src/app/reclaim.service.ts | 38 ++----
14 files changed, 230 insertions(+), 251 deletions(-)
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index bbe1986..7c221b0 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -4,7 +4,7 @@ import { IdentityListComponent } from
'./identity-list/identity-list.component';
import { NewIdentityComponent } from './new-identity/new-identity.component';
import { EditIdentityComponent } from
'./edit-identity/edit-identity.component';
import { EditAuthorizationsComponent } from
'./edit-authorizations/edit-authorizations.component';
-import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations.component';
+import { EditCredentialsComponent } from
'./edit-credentials/edit-credentials.component';
import { AuthorizationRequestComponent } from
'./authorization-request/authorization-request.component';
const routes: Routes = [
@@ -14,7 +14,7 @@ const routes: Routes = [
{ path: 'new-identity', component: NewIdentityComponent },
{ path: 'edit-identity/:id', component: EditIdentityComponent },
{ path: 'edit-authorizations/:id', component: EditAuthorizationsComponent
},
- { path: 'edit-attestations/:id', component: EditAttestationsComponent },
+ { path: 'edit-credentials/:id', component: EditCredentialsComponent },
{ path: 'authorization-request', component: AuthorizationRequestComponent }
];
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 64708b7..1bfb1d9 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -16,12 +16,12 @@ import { ModalComponent } from './modal.component';
import { ModalService } from './modal.service';
import { SearchPipe } from './search.pipe';
import { OpenIdService } from './open-id.service';
-import { AttestationService } from './attestation.service';
+import { CredentialService } from './credential.service';
import { NewIdentityComponent } from './new-identity/new-identity.component';
import { EditIdentityComponent } from
'./edit-identity/edit-identity.component';
import { AuthorizationRequestComponent } from
'./authorization-request/authorization-request.component';
import { EditAuthorizationsComponent } from
'./edit-authorizations/edit-authorizations.component';
-import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations.component';
+import { EditCredentialsComponent } from
'./edit-credentials/edit-credentials.component';
import { OAuthStorage } from 'angular-oauth2-oidc';
@NgModule({
@@ -34,7 +34,7 @@ import { OAuthStorage } from 'angular-oauth2-oidc';
EditIdentityComponent,
AuthorizationRequestComponent,
EditAuthorizationsComponent,
- EditAttestationsComponent
+ EditCredentialsComponent
],
imports: [
BrowserModule,
@@ -52,7 +52,7 @@ import { OAuthStorage } from 'angular-oauth2-oidc';
GnsService,
OpenIdService,
ConfigService,
- AttestationService,
+ CredentialService,
{
provide: APP_INITIALIZER,
useFactory: (config: ConfigService) => () => config.load(),
diff --git a/src/app/attribute.ts b/src/app/attribute.ts
index 2dbce4f..6ea07af 100644
--- a/src/app/attribute.ts
+++ b/src/app/attribute.ts
@@ -1,7 +1,7 @@
export class Attribute {
constructor(public name: string,
public id: string,
- public attestation: string,
+ public credential: string,
public value: string,
public type: string,
public flag: string) {}
diff --git a/src/app/authorization.ts b/src/app/authorization.ts
index 1704f57..6d29ace 100644
--- a/src/app/authorization.ts
+++ b/src/app/authorization.ts
@@ -6,4 +6,4 @@ export interface Authorization{
accessToken: string,
idToken: string,
logoutURL: string
-}
\ No newline at end of file
+}
diff --git a/src/app/attestation.service.ts b/src/app/credential.service.ts
similarity index 93%
rename from src/app/attestation.service.ts
rename to src/app/credential.service.ts
index d5cff4c..531fd82 100644
--- a/src/app/attestation.service.ts
+++ b/src/app/credential.service.ts
@@ -6,11 +6,11 @@ import { IdProvider } from './idProvider';
import { Scope } from './scope';
@Injectable()
-export class AttestationService {
+export class CredentialService {
constructor(private http: HttpClient) {
}
-
+
getLink (email: string): Observable<any>{
//test
if (email.split('@')[1].includes('localhost')){
@@ -23,7 +23,7 @@ export class AttestationService {
var redirectUri;
if (window.location.href.includes('localhost')){
const user = localStorage.getItem('userForAttestation');
- redirectUri = 'http://localhost:4200/edit-attestations/' + user;
+ redirectUri = 'http://localhost:4200/edit-credentials/' + user;
}
else {
redirectUri = "https://ui.reclaim";
@@ -45,34 +45,27 @@ export class AttestationService {
const authCodeFlowConfig: AuthConfig = {
// Url of the Identity Provider
issuer: idProvider.url,
-
// URL of the SPA to redirect the user to after login
redirectUri: redirectUri,
postLogoutRedirectUri: redirectUri + "?logout=true",
logoutUrl: idProvider.logoutURL + '/logout',
-
// The SPA's id. The SPA is registerd with this id at the auth-server
// clientId: 'server.code',
clientId: 'reclaimid',
-
// Just needed if your auth server demands a secret. In general, this
// is a sign that the auth server is not configured with SPAs in mind
// and it might not enforce further best practices vital for security
// such applications.
// dummyClientSecret: 'secret',
-
responseType: 'code',
-
// set the scope for the permissions the client should request
// The first four are defined by OIDC.
// Important: Request offline_access to get a refresh token
// The api scope is a usecase specific one
scope: scopeValues,
-
- showDebugInformation: true,
-
+ showDebugInformation: true,
requireHttps: false,
};
console.log(authCodeFlowConfig.scope);
@@ -87,4 +80,4 @@ export class AttestationService {
return this.http.get<any>(url);
}
-}
\ No newline at end of file
+}
diff --git a/src/app/attestation.ts b/src/app/credential.ts
similarity index 91%
rename from src/app/attestation.ts
rename to src/app/credential.ts
index dfc40ff..a332b73 100644
--- a/src/app/attestation.ts
+++ b/src/app/credential.ts
@@ -1,6 +1,6 @@
import { Attribute } from './attribute';
-export class Attestation {
+export class Credential {
constructor(public name: string,
public id: string,
public value: string,
diff --git a/src/app/edit-attestations/edit-attestations.component.css
b/src/app/edit-credentials/edit-credentials.component.css
similarity index 100%
rename from src/app/edit-attestations/edit-attestations.component.css
rename to src/app/edit-credentials/edit-credentials.component.css
diff --git a/src/app/edit-attestations/edit-attestations.component.html
b/src/app/edit-credentials/edit-credentials.component.html
similarity index 74%
rename from src/app/edit-attestations/edit-attestations.component.html
rename to src/app/edit-credentials/edit-credentials.component.html
index 36934e1..df2262a 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-credentials/edit-credentials.component.html
@@ -2,10 +2,10 @@
<div class="m-2 card">
<div class="card-avatar card-img-top">
<div class="card-avatar-character text-dark">
- Third party attestations for <i>{{ identity.name }}</i>
+ Third party credentials for <i>{{ identity.name }}</i>
</div>
</div>
- <!-- Attestation management -->
+ <!-- Credential management -->
<div class="card-body">
<h3>Link account:</h3>
<!--IdProvider-Discovery-->
@@ -51,20 +51,20 @@
</div>
<hr />
- <h3>Attestations:</h3>
- <!-- Attestation creation warning -->
+ <h3>Credentials:</h3>
+ <!-- Credential creation warning -->
<div
- *ngIf="loggedIn() && !attestationNameValid(newAttestation) ||
!attestationTypeValid(newAttestation) || !attestationValueValid(newAttestation)"
+ *ngIf="loggedIn() && !credentialNameValid(newCredential) ||
!credentialTypeValid(newCredential) || !credentialValueValid(newCredential)"
class="alert alert-primary alert-dismissible fade show" role="alert">
<span class="fa fa-warning"></span> Note:
<ul>
- <li>Only use alphanumeric attestation names.</li>
+ <li>Only use alphanumeric credential names.</li>
<li>You cannot define the same name twice.</li>
<li>Types and values may not be empty!</li>
</ul>
</div>
- <!-- Requested attestation -->
+ <!-- Requested credential -->
<table class="table pb-1" style="">
<thead>
<tr>
@@ -76,50 +76,50 @@
</tr>
</thead>
<tbody>
- <tr [class.alert-danger]="newAttestation.name === attestation.name"
- [class.alert-warning]="!isAttestationValid(attestation)" *ngFor="let
attestation of attestations">
+ <tr [class.alert-danger]="newCredential.name === credential.name"
+ [class.alert-warning]="!isCredentialValid(credential)" *ngFor="let
credential of credentials">
<td>
- <div style="min-width: 15em">{{attestation.name}}</div>
+ <div style="min-width: 15em">{{credential.name}}</div>
</td>
<td>
- <div>{{attestation.type}}</div>
+ <div>{{credential.type}}</div>
</td>
<td>
- <div>{{getExpiration(attestation)}}</div>
+ <div>{{getExpiration(credential)}}</div>
</td>
<!--ISSUER <td>
<div style="min-width: 15em">
</div>
</td>-->
<td>
- <div style="min-width: 15em">{{attestation.issuer}}</div>
+ <div style="min-width: 15em">{{credential.issuer}}</div>
</td>
<td>
- <button class="btn btn-primary"
(click)="deleteAttestation(attestation)">
+ <button class="btn btn-primary"
(click)="deleteCredential(credential)">
<span class="fa fa-trash"></span>
</button>
</td>
<td>
- <div *ngIf="!isAttestationValid(attestation)"> <span
style="color:#f00"> Expired </span> <span
+ <div *ngIf="!isCredentialValid(credential)"> <span
style="color:#f00"> Expired </span> <span
class="fa fa-times"></span> </div>
</td>
</tr>
- <tr [class.alert-danger]="isAttestInConflict(newAttestation)"
*ngIf="loggedIn()">
+ <tr [class.alert-danger]="isCredInConflict(newCredential)"
*ngIf="loggedIn()">
<td>
- <input [class.text-danger]="!attestationNameValid(newAttestation)"
placeholder="Attestation"
- [(ngModel)]="newAttestation.name">
+ <input [class.text-danger]="!credentialNameValid(newCredential)"
placeholder="Credential"
+ [(ngModel)]="newCredential.name">
</td>
<td>
<div style="min-width: 15em">JWT</div>
</td>
<td>
- {{getNewAttestationExpiration()}}
+ {{getNewCredentialExpiration()}}
</td>
<td>
<div style="min-width: 15em">{{newIdProvider.url}}</div>
</td>
<td>
- <button class="btn btn-primary"
[disabled]="!canAddAttestation(newAttestation)" (click)="saveIdProvider()">
+ <button class="btn btn-primary"
[disabled]="!canAddCredential(newCredential)" (click)="saveIdProvider()">
<span class="fa fa-plus"></span>
</button>
<button class="btn btn-primary ml-2" (click)="cancelAdding()">
diff --git a/src/app/edit-attestations/edit-attestations.component.ts
b/src/app/edit-credentials/edit-credentials.component.ts
similarity index 64%
rename from src/app/edit-attestations/edit-attestations.component.ts
rename to src/app/edit-credentials/edit-credentials.component.ts
index 011bf80..ff54397 100644
--- a/src/app/edit-attestations/edit-attestations.component.ts
+++ b/src/app/edit-credentials/edit-credentials.component.ts
@@ -2,26 +2,26 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ReclaimService } from '../reclaim.service';
import { Identity } from '../identity';
-import { Attestation } from '../attestation';
+import { Credential } from '../credential';
import { IdentityService } from '../identity.service';
import { from, forkJoin, EMPTY } from 'rxjs';
import { finalize } from 'rxjs/operators';
-import { AttestationService } from '../attestation.service';
+import { CredentialService } from '../credential.service';
import { OAuthService } from 'angular-oauth2-oidc';
import { IdProvider } from '../idProvider';
import { LoginOptions } from 'angular-oauth2-oidc';
import { Scope } from '../scope';
@Component({
- selector: 'app-edit-attestations',
- templateUrl: './edit-attestations.component.html',
- styleUrls: ['./edit-attestations.component.css']
+ selector: 'app-edit-credentials',
+ templateUrl: './edit-credentials.component.html',
+ styleUrls: ['./edit-credentials.component.css']
})
-export class EditAttestationsComponent implements OnInit {
+export class EditCredentialsComponent implements OnInit {
identity: Identity;
- attestations: Attestation[];
- newAttestation: Attestation;
+ credentials: Credential[];
+ newCredential: Credential;
newIdProvider: IdProvider;
webfingerEmail: string;
emailNotFoundAlertClosed: boolean;
@@ -32,11 +32,11 @@ export class EditAttestationsComponent implements OnInit {
private identityService: IdentityService,
private activatedRoute: ActivatedRoute,
private router: Router,
- private attestationService: AttestationService,
+ private credentialService: CredentialService,
private oauthService: OAuthService) { }
ngOnInit() {
- this.newAttestation = new Attestation('', '', '', 'JWT', '', 0, []);
+ this.newCredential = new Credential('', '', '', 'JWT', '', 0, []);
this.identity = new Identity('','');
this.newIdProvider = new IdProvider ('', '', '');
this.webfingerEmail = '';
@@ -44,13 +44,13 @@ export class EditAttestationsComponent implements OnInit {
this.errorMassage = '';
this.loadScopesFromLocalStorage()
this.loadIdProviderFromLocalStorage();
- this.attestations = [];
+ this.credentials = [];
if (this.newIdProvider.url !== ''){
const loginOptions: LoginOptions = {
- customHashFragment: "?code="+localStorage.getItem("attestationCode") +
"&state=" + localStorage.getItem("attestationState") + "&session_state="+
localStorage.getItem("attestationSession_State"),
+ customHashFragment: "?code="+localStorage.getItem("credentialCode") +
"&state=" + localStorage.getItem("credentialState") + "&session_state="+
localStorage.getItem("credentialSession_State"),
}
this.configureOauthService();
- if (!localStorage.getItem("attestationCode")){
+ if (!localStorage.getItem("credentialCode")){
this.oauthService.loadDiscoveryDocumentAndTryLogin();
}
else{
@@ -67,62 +67,62 @@ export class EditAttestationsComponent implements OnInit {
for (let i = 0; i < ids.length; i++) {
if (ids[i].name == p['id']) {
this.identity = ids[i];
- this.updateAttestations();
+ this.updateCredentials();
}
}
});
});
}
- private updateAttestations() {
- this.reclaimService.getAttestations(this.identity).subscribe(attestation
=> {
- this.attestations = attestation;
+ private updateCredentials() {
+ this.reclaimService.getCredentials(this.identity).subscribe(credential => {
+ this.credentials = credential;
},
err => {
- //this.errorInfos.push("Error retrieving attestation for ``" +
identity.name + "''");
+ //this.errorInfos.push("Error retrieving credential for ``" +
identity.name + "''");
console.log(err);
});
}
saveIdProvider(){
this.saveIdProviderinLocalStorage();
- this.addAttestation();
+ this.addCredential();
}
- addAttestation() {
+ addCredential() {
if (!this.oauthService.hasValidAccessToken()){
console.log("No AccessToken");
return;
}
- this.newAttestation.value = this.oauthService.getAccessToken();
- this.reclaimService.addAttestation(this.identity,
this.newAttestation).subscribe(res => {
- console.log("Saved Attestation");
+ this.newCredential.value = this.oauthService.getAccessToken();
+ this.reclaimService.addCredential(this.identity,
this.newCredential).subscribe(res => {
+ console.log("Saved Credential");
this.resetNewIdProvider();
this.resetScopes();
- this.updateAttestations();
- this.newAttestation.name = '';
- this.newAttestation.value = '';
+ this.updateCredentials();
+ this.newCredential.name = '';
+ this.newCredential.value = '';
this.logOutFromOauthService();
},
err => {
- console.log("Failed saving attestation");
+ console.log("Failed saving credential");
console.log(err);
//this.errorInfos.push("Failed to update identity ``" +
this.identityInEdit.name + "''");
EMPTY
- this.newAttestation.name = '';
- this.newAttestation.value = '';
+ this.newCredential.name = '';
+ this.newCredential.value = '';
this.logOutFromOauthService();
});
}
saveIdProviderinLocalStorage(){
- localStorage.setItem('Authorization: ' + this.newAttestation.name,
'idProvider: ' + this.newIdProvider.url + ';redirectUri: ' +
this.oauthService.redirectUri + ';clientId: ' + this.oauthService.clientId +
';accessToken: ' + this.oauthService.getAccessToken() + ';idToken: ' +
this.oauthService.getIdToken() + ';logoutURL: ' + this.newIdProvider.logoutURL);
+ localStorage.setItem('Authorization: ' + this.newCredential.name,
'idProvider: ' + this.newIdProvider.url + ';redirectUri: ' +
this.oauthService.redirectUri + ';clientId: ' + this.oauthService.clientId +
';accessToken: ' + this.oauthService.getAccessToken() + ';idToken: ' +
this.oauthService.getIdToken() + ';logoutURL: ' + this.newIdProvider.logoutURL);
}
- private storeAttestation() {
+ private storeCredential() {
const promises = [];
- if ((this.newAttestation.value !== '') || (this.newAttestation.type !==
'')) {
- promises.push(from(this.reclaimService.addAttestation(this.identity,
this.newAttestation)));
+ if ((this.newCredential.value !== '') || (this.newCredential.type !== ''))
{
+ promises.push(from(this.reclaimService.addCredential(this.identity,
this.newCredential)));
}
return forkJoin(promises);
}
@@ -138,11 +138,11 @@ export class EditAttestationsComponent implements OnInit {
this.router.navigate(['/edit-identity', this.identity.name]);
}
- isAttestInConflict(attestation: Attestation) {
+ isCredInConflict(credential: Credential) {
let i;
- if (undefined !== this.attestations) {
- for (i = 0; i < this.attestations.length; i++) {
- if (attestation.name === this.attestations[i].name) {
+ if (undefined !== this.credentials) {
+ for (i = 0; i < this.credentials.length; i++) {
+ if (credential.name === this.credentials[i].name) {
return true;
}
}
@@ -150,64 +150,64 @@ export class EditAttestationsComponent implements OnInit {
return false;
}
- deleteAttestation(attestation: Attestation) {
- localStorage.removeItem("Authorization: " + attestation.name);
- this.reclaimService.deleteAttestation(this.identity, attestation)
+ deleteCredential(credential: Credential) {
+ localStorage.removeItem("Authorization: " + credential.name);
+ this.reclaimService.deleteCredential(this.identity, credential)
.subscribe(res => {
//FIXME info dialog
- this.updateAttestations();
+ this.updateCredentials();
},
err => {
- //this.errorInfos.push("Failed to delete attestation ``" +
attestation.name + "''");
+ //this.errorInfos.push("Failed to delete credential ``" +
credential.name + "''");
console.log(err);
});
}
- canAddAttestation(attestation: Attestation) {
+ canAddCredential(credential: Credential) {
if(!this.oauthService.hasValidAccessToken()){
return false;
}
- if ((attestation.name === '')) {
+ if ((credential.name === '')) {
return false;
}
- if (attestation.name.indexOf(' ') >= 0) {
+ if (credential.name.indexOf(' ') >= 0) {
return false;
}
- return !this.isAttestInConflict(attestation);
+ return !this.isCredInConflict(credential);
}
- attestationNameValid(attestation: Attestation) {
- if (attestation.name === '' && attestation.value === '' &&
attestation.type === '') {
+ credentialNameValid(credential: Credential) {
+ if (credential.name === '' && credential.value === '' && credential.type
=== '') {
return true;
}
- if (attestation.name.indexOf(' ') >= 0) {
+ if (credential.name.indexOf(' ') >= 0) {
return false;
}
- if (!/^[a-zA-Z0-9-]+$/.test(attestation.name)) {
+ if (!/^[a-zA-Z0-9-]+$/.test(credential.name)) {
return false;
}
- return !this.isAttestInConflict(attestation);
+ return !this.isCredInConflict(credential);
}
- attestationTypeValid(attestation: Attestation) {
- if (attestation.type === '') {
- return attestation.name === '';
+ credentialTypeValid(credential: Credential) {
+ if (credential.type === '') {
+ return credential.name === '';
}
return true;
}
- attestationValueValid(attestation: Attestation) {
+ credentialValueValid(credential: Credential) {
return true;
}
- getExpiration(attestation: Attestation) {
+ getExpiration(credential: Credential) {
var exp = new Date(0);
- exp.setMilliseconds(attestation.expiration / 1000);
+ exp.setMilliseconds(credential.expiration / 1000);
return exp.toLocaleString();
}
//FIXME
- isAttestationValid(attestation: Attestation) {
+ isCredentialValid(credential: Credential) {
return true;
}
@@ -221,7 +221,7 @@ export class EditAttestationsComponent implements OnInit {
return url.split('//')[1];
}
- getNewAttestationExpiration(){
+ getNewCredentialExpiration(){
var exp = new Date(0);
exp.setMilliseconds(this.oauthService.getIdTokenExpiration());
return exp.toLocaleString();
@@ -250,8 +250,8 @@ export class EditAttestationsComponent implements OnInit {
this.logOutFromOauthService();
this.resetNewIdProvider();
this.resetScopes();
- this.newAttestation.value = '';
- this.newAttestation.name = '';
+ this.newCredential.value = '';
+ this.newCredential.name = '';
}
@@ -261,9 +261,9 @@ export class EditAttestationsComponent implements OnInit {
if (this.webfingerEmail == ''){
return;
}
- localStorage.setItem('userForAttestation', this.identity.name);
+ localStorage.setItem('userForCredential', this.identity.name);
this.isValidEmailforDiscovery();
- this.attestationService.getLink(this.webfingerEmail).subscribe (idProvider
=> {
+ this.credentialService.getLink(this.webfingerEmail).subscribe (idProvider
=> {
this.newIdProvider.url = (idProvider.links [0]).href;
localStorage.setItem('newIdProviderURL', this.newIdProvider.url);
this.newIdProvider.name =
this.getNewIdProviderName(this.newIdProvider.url);
@@ -289,7 +289,7 @@ export class EditAttestationsComponent implements OnInit {
getScopes(){
this.configureOauthService();
-
this.attestationService.getDiscoveryDocument(this.oauthService.issuer).subscribe(openidConfig
=> {
+
this.credentialService.getDiscoveryDocument(this.oauthService.issuer).subscribe(openidConfig
=> {
openidConfig["scopes_supported"].forEach(scope => {
const scopeInterface: Scope = {
scope: scope,
@@ -339,7 +339,7 @@ export class EditAttestationsComponent implements OnInit {
}
configureOauthService(){
- var authCodeFlowConfig =
this.attestationService.getOauthConfig(this.newIdProvider, this.scopes);
+ var authCodeFlowConfig =
this.credentialService.getOauthConfig(this.newIdProvider, this.scopes);
this.oauthService.configure(authCodeFlowConfig);
}
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index f783001..e4cf1e2 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -29,14 +29,14 @@
</div>
</div>
<div class="col-sm">
- <input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
+ <input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
</div>
<div class="col-sm">
- <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimAttested(claim)">
+ <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimAttested(claim)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
</div>
@@ -49,10 +49,10 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <!-- FIXME Allow adding of attestation OR plain value -->
+ <!-- FIXME Allow adding of credential OR plain value -->
<input placeholder="Value" [(ngModel)]="claim.value">
- <!--<input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
+ <!--<input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
</div>
<div class="col-sm">
<button [disabled]="!canAddAttribute(claim)" class="btn
btn-primary" (click)="addAttribute()">
@@ -70,14 +70,14 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
+ <input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
</div>
<div class="col-sm">
- <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimAttested(claim)">
+ <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimAttested(claim)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
</div>
@@ -90,10 +90,10 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <!-- FIXME Allow adding of attestation OR plain value -->
+ <!-- FIXME Allow adding of credential OR plain value -->
<input placeholder="Value" [(ngModel)]="claim.value">
- <!--<input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
+ <!--<input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
</div>
<div class="col-sm">
<button [disabled]="!canAddAttribute(claim)" class="btn
btn-primary" (click)="addAttribute()">
@@ -113,14 +113,14 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
+ <input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
</div>
<div class="col-sm">
- <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimAttested(claim)">
+ <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimAttested(claim)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
</div>
@@ -133,10 +133,10 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <!-- FIXME Allow adding of attestation OR plain value -->
+ <!-- FIXME Allow adding of credential OR plain value -->
<input placeholder="Value" [(ngModel)]="claim.value">
- <!--<input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
+ <!--<input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>-->
</div>
<div class="col-sm">
<button [disabled]="!canAddAttribute(claim)" class="btn
btn-primary" (click)="addAttribute()">
@@ -155,14 +155,14 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(claim)" class="fa
fa-openid"></i><b> {{ getDescription(claim) }}</b></div></div>
<div class="col-sm">
- <input *ngIf="!isClaimAttested(claim)" placeholder="Value"
[(ngModel)]="claim.value">
- <span *ngIf="isClaimAttested(claim)" >{{ getAttestedValue(claim)
}} issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
+ <input *ngIf="!isClaimCred(claim)" placeholder="Value"
[(ngModel)]="claim.value">
+ <span *ngIf="isClaimCred(claim)" >{{ getCredValue(claim) }}
issued by <i>{{ getIssuer(claim) }}</i> as attribute for ``{{ claim.value
}}''</span>
</div>
<div class="col-sm">
- <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimAttested(claim)">
+ <button class="btn btn-primary" (click)="deleteAttribute(claim)"
*ngIf="!isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimAttested(claim)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(claim)" *ngIf="isClaimCred(claim)">
<span class="fa fa-trash"></span>
</button>
</div>
@@ -177,22 +177,22 @@
<div class="col-sm">
<select *ngIf="isExperimental()" class="custom-select"
(change)="claim.flag=$event.target.value; ">
<option value="0">Plain</option>
- <option value="1">Attested</option>
+ <option value="1">Cred</option>
</select>
<input *ngIf="claim.flag == '0'" placeholder="Value"
[(ngModel)]="claim.value">
<select *ngIf="claim.flag == '1'" class="custom-select"
- (change)="claim.attestation=$event.target.value; ">
- <option value="">Select attestation source</option>
- <option *ngFor="let attest of attestations"
value={{attest.id}}>
- {{attest.name}}
+ (change)="claim.credential=$event.target.value; ">
+ <option value="">Select credential source</option>
+ <option *ngFor="let cred of credentials" value={{cred.id}}>
+ {{cred.name}}
</option>
</select>
<select class="custom-select"
- *ngIf="claim.attestation !== '' && claim.flag == '1'"
(change)="claim.value=$event.target.value">
+ *ngIf="claim.credential !== '' && claim.flag == '1'"
(change)="claim.value=$event.target.value">
<option value="">Select claim</option>
- <option *ngFor="let att of attestationValuesForClaim(claim)"
value={{att.name}}>
+ <option *ngFor="let att of credentialValuesForClaim(claim)"
value={{att.name}}>
{{att.value}} <i>({{att.name}})</i>
</option>
</select>
@@ -221,17 +221,17 @@
<div class="col-sm"><div style="min-width: 15em">
<i *ngIf="isClaimRequested(missing)" class="fa
fa-openid"></i><b> {{missing.name}}</b></div></div>
<div class="col-sm">
- <input *ngIf="!isClaimAttestationRequested(missing)"
placeholder="Value" [(ngModel)]="missing.value">
- <select *ngIf="isClaimAttestationRequested(missing)"
class="custom-select" (change)="missing.attestation=$event.target.value; ">
- <option value="">Select attestation source</option>
- <option *ngFor="let attest of attestations"
value={{attest.id}}>
- {{attest.name}}
+ <input *ngIf="!isClaimcredentialRequested(missing)"
placeholder="Value" [(ngModel)]="missing.value">
+ <select *ngIf="isClaimcredentialRequested(missing)"
class="custom-select" (change)="missing.credential=$event.target.value; ">
+ <option value="">Select credential source</option>
+ <option *ngFor="let cred of credentials" value={{cred.id}}>
+ {{cred.name}}
</option>
</select>
- <select *ngIf="isClaimAttestationRequested(missing) &&
missing.attestation !== ''" class="custom-select"
(change)="missing.value=$event.target.value">
+ <select *ngIf="isClaimcredentialRequested(missing) &&
missing.credential !== ''" class="custom-select"
(change)="missing.value=$event.target.value">
<option value="">Select claim</option>
- <option *ngFor="let claim of
attestationValuesForAttested(missing)" value={{claim.name}}>
+ <option *ngFor="let claim of credentialValuesForCred(missing)"
value={{claim.name}}>
{{claim.value}} <i>({{claim.name}})</i>
</option>
</select>
@@ -246,20 +246,20 @@
[class.openid]="inOpenIdFlow()"
[class.text-primary]="isClaimRequested(attribute)"
[class.alert-danger]="newAttribute.name === attribute.name"
- [class.text-secondary]="isClaimAttested(attribute)"
+ [class.text-secondary]="isClaimCred(attribute)"
*ngFor="let attribute of existingNonStandardClaims">
<div class="col-sm">
<i *ngIf="isClaimRequested(attribute)" class="fa
fa-openid"></i><b> {{ attribute.name }}</b>
</div>
<div class="col-sm">
- <input *ngIf="!isClaimAttested(attribute)" placeholder="Value"
[(ngModel)]="attribute.value">
- <span *ngIf="isClaimAttested(attribute)" >{{
getAttestedValue(attribute) }} issued by <i>{{ getIssuer(attribute) }}</i> as
attribute for ``{{ attribute.value }}''</span>
+ <input *ngIf="!isClaimCred(attribute)" placeholder="Value"
[(ngModel)]="attribute.value">
+ <span *ngIf="isClaimCred(attribute)" >{{ getCredValue(attribute)
}} issued by <i>{{ getIssuer(attribute) }}</i> as attribute for ``{{
attribute.value }}''</span>
</div>
<div class="col-sm">
- <button class="btn btn-primary"
(click)="deleteAttribute(attribute)" *ngIf="!isClaimAttested(attribute)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(attribute)" *ngIf="!isClaimCred(attribute)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary"
(click)="deleteAttribute(attribute)" *ngIf="isClaimAttested(attribute)">
+ <button class="btn btn-primary"
(click)="deleteAttribute(attribute)" *ngIf="isClaimCred(attribute)">
<span class="fa fa-trash"></span>
</button>
</div>
@@ -273,21 +273,21 @@
<select *ngIf="isExperimental()" class="custom-select"
(change)="newAttribute.flag=$event.target.value; ">
<option value="0">Plain</option>
- <option value="1">Attested</option>
+ <option value="1">Cred</option>
</select>
<input *ngIf="newAttribute.flag == '0'" placeholder="Value"
[class.text-danger]="!attributeValueValid(newAttribute)"
[(ngModel)]="newAttribute.value">
<select *ngIf="newAttribute.flag == '1'" class="custom-select"
- (change)="newAttribute.attestation=$event.target.value; ">
- <option value="">Select attestation source</option>
- <option *ngFor="let attest of attestations"
value={{attest.id}}>
- {{attest.name}}
+ (change)="newAttribute.credential=$event.target.value; ">
+ <option value="">Select credential source</option>
+ <option *ngFor="let cred of credentials" value={{cred.id}}>
+ {{cred.name}}
</option>
</select>
<select class="custom-select"
- *ngIf="newAttribute.attestation !== '' && newAttribute.flag ==
'0'" (change)="newAttribute.value=$event.target.value">
+ *ngIf="newAttribute.credential !== '' && newAttribute.flag ==
'0'" (change)="newAttribute.value=$event.target.value">
<option value="">Select claim</option>
- <option *ngFor="let claim of
attestationValuesForClaim(newAttribute)" value={{claim.name}}>
+ <option *ngFor="let claim of
credentialValuesForClaim(newAttribute)" value={{claim.name}}>
{{claim.value}} <i>({{claim.name}})</i>
</option>
</select>
@@ -321,9 +321,9 @@
<span class="fa fa-openid"></span>
Manage authorizations
</button>
- <button *ngIf="!inOpenIdFlow() && isExperimental()" class="btn
btn-primary" [routerLink]="['/edit-attestations', identity.name]"
[style.float]="'right'">
+ <button *ngIf="!inOpenIdFlow() && isExperimental()" class="btn
btn-primary" [routerLink]="['/edit-credentials', identity.name]"
[style.float]="'right'">
<span class="fa fa-openid"></span>
- Manage attestations
+ Manage credentials
</button>
</div>
</div>
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index 4ff758b..4cd2664 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -6,7 +6,7 @@ import { GnsService } from '../gns.service';
import { NamestoreService } from '../namestore.service';
import { OpenIdService } from '../open-id.service';
import { Attribute } from '../attribute';
-import { Attestation } from '../attestation';
+import { Credential } from '../credential';
import { IdentityService } from '../identity.service';
import { finalize } from 'rxjs/operators';
import { from, forkJoin, EMPTY } from 'rxjs';
@@ -24,11 +24,11 @@ export class EditIdentityComponent implements OnInit {
identity: Identity;
attributes: Attribute[] = [];
- attestations: Attestation[] = [];
- attestationValues: {};
+ credentials: Credential[] = [];
+ credentialValues: {};
newAttribute: Attribute;
- newAttestedClaim: Attribute;
- missingAttested: Attribute[] = [];
+ newCredClaim: Attribute;
+ missingCred: Attribute[] = [];
requestedClaims: Attribute[] = [];
optionalClaims: Attribute[] = [];
webfingerEmail: string;
@@ -59,13 +59,13 @@ export class EditIdentityComponent implements OnInit {
private router: Router,) {}
ngOnInit() {
- this.attestationValues = {};
+ this.credentialValues = {};
this.webfingerEmail = '';
this.newIdProvider = new IdProvider ('', '', '');
this.loadAuthorizationsFromLocalStorage();
this.identity = new Identity('','');
this.newAttribute = new Attribute('', '', '', '', 'STRING', '0');
- this.newAttestedClaim = new Attribute('', '', '', '', 'STRING', '1');
+ this.newCredClaim = new Attribute('', '', '', '', 'STRING', '1');
this.activatedRoute.params.subscribe(p => {
if (p['id'] === undefined) {
return;
@@ -76,7 +76,7 @@ export class EditIdentityComponent implements OnInit {
if (ids[i].name == p['id']) {
this.identity = ids[i];
this.updateAttributes();
- this.updateAttestations();
+ this.updateCredentials();
}
}
});
@@ -252,16 +252,16 @@ export class EditIdentityComponent implements OnInit {
}
saveIdentity() {
- localStorage.removeItem("userForAttestation");
+ localStorage.removeItem("userForCredential");
this.saveIdentityAttributes();
}
saveIdentityAttributes() {
if (this.newAttribute.flag === '0') {
/**
- * Make sure attestation is not still set
+ * Make sure credential is not still set
*/
- this.newAttribute.attestation = '';
+ this.newAttribute.credential = '';
}
this.actions = "Saving...";
this.storeAttributes()
@@ -307,7 +307,7 @@ export class EditIdentityComponent implements OnInit {
continue;
}
if (attr.flag === '0') {
- attr.attestation = '';
+ attr.credential = '';
}
promises.push(from(this.reclaimService.addAttribute(
this.identity, attr)));
@@ -330,10 +330,10 @@ export class EditIdentityComponent implements OnInit {
if (undefined !== this.attributes) {
for (let attr of this.attributes) {
/*if (attr.flag === '1') {
- continue; //Is an attestation
+ continue; //Is an credential
}*/
if (attr.flag === '0') {
- attr.attestation = '';
+ attr.credential = '';
}
promises.push(
from(this.reclaimService.addAttribute(this.identity, attr)));
@@ -431,8 +431,8 @@ export class EditIdentityComponent implements OnInit {
return false;
}
- isClaimAttestationRequested(attr: Attribute) {
- //TODO check if this claim is in claims parameter and needs attestation
+ isClaimCredentialRequested(attr: Attribute) {
+ //TODO check if this claim is in claims parameter and needs credential
var claims = this.oidcService.getRequestedClaims();
for (let claim of claims) {
if (claim[0] == attr.name) {
@@ -452,51 +452,51 @@ export class EditIdentityComponent implements OnInit {
}
- private updateAttestations() {
- this.reclaimService.getAttestations(this.identity).subscribe(attestations
=> {
- this.attestations = attestations;
+ private updateCredentials() {
+ this.reclaimService.getCredentials(this.identity).subscribe(credentials =>
{
+ this.credentials = credentials;
},
err => {
- //this.errorInfos.push("Error retrieving attestation for ``" +
identity.name + "''");
+ //this.errorInfos.push("Error retrieving credential for ``" +
identity.name + "''");
console.log(err);
});
}
- isClaimAttested(attribute) {
+ isClaimCred(attribute) {
return attribute.flag === '1';
}
- isClaimAttestationValid(attribute: Attribute) {
- if (attribute.attestation === '') {
+ isClaimCredentialValid(attribute: Attribute) {
+ if (attribute.credential === '') {
return attribute.name === '';
}
return true;
}
- attestationValuesForClaim(attribute: Attribute) {
- for (let i = 0; i < this.attestations.length; i++) {
- if (this.attestations[i].id == attribute.attestation) {
- return this.attestations[i].attributes;
+ credentialValuesForClaim(attribute: Attribute) {
+ for (let i = 0; i < this.credentials.length; i++) {
+ if (this.credentials[i].id == attribute.credential) {
+ return this.credentials[i].attributes;
}
}
}
- //FIXME attestations need an issuer field
+ //FIXME credentials need an issuer field
getIssuer(attribute: Attribute) {
- for (let i = 0; i < this.attestations.length; i++) {
- if (this.attestations[i].id == attribute.attestation) {
- return this.attestations[i].issuer;
+ for (let i = 0; i < this.credentials.length; i++) {
+ if (this.credentials[i].id == attribute.credential) {
+ return this.credentials[i].issuer;
}
}
}
- getAttestedValue(attribute: Attribute) {
- for (let i = 0; i < this.attestations.length; i++) {
- if (this.attestations[i].id == attribute.attestation) {
- for (let j = 0; j < this.attestations[i].attributes.length; j++) {
- if (attribute.value == this.attestations[i].attributes[j].name) {
- return this.attestations[i].attributes[j].value;
+ getCredValue(attribute: Attribute) {
+ for (let i = 0; i < this.credentials.length; i++) {
+ if (this.credentials[i].id == attribute.credential) {
+ for (let j = 0; j < this.credentials[i].attributes.length; j++) {
+ if (attribute.value == this.credentials[i].attributes[j].name) {
+ return this.credentials[i].attributes[j].value;
}
}
}
diff --git a/src/app/identity-list/identity-list.component.ts
b/src/app/identity-list/identity-list.component.ts
index ca977b4..5b48d98 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Attribute } from '../attribute';
-import { Attestation } from '../attestation';
+import { Credential } from '../credential';
import { GnsService } from '../gns.service';
import { Identity } from '../identity';
import { IdentityService } from '../identity.service';
@@ -28,7 +28,7 @@ export class IdentityListComponent implements OnInit {
requestedScopes: any;
missingClaims: any;
attributes: any;
- attestations: any;
+ credentials: any;
identities: Identity[];
showConfirmDelete: any;
connected: any;
@@ -50,7 +50,7 @@ export class IdentityListComponent implements OnInit {
ngOnInit() {
this.attributes = {};
- this.attestations = {};
+ this.credentials = {};
this.identities = [];
this.showConfirmDelete = null;
this.requestedScopes = {};
@@ -58,15 +58,15 @@ export class IdentityListComponent implements OnInit {
this.connected = false;
this.modalOpened = false;
if (undefined !== this.route.snapshot.queryParams["code"]) {
- localStorage.setItem('attestationCode',
this.route.snapshot.queryParams["code"]);
- localStorage.setItem('attestationState',
this.route.snapshot.queryParams["state"]);
- localStorage.setItem('attestationSession_State',
this.route.snapshot.queryParams["session_state"]);
- var user = localStorage.getItem('userForAttestation');
- this.router.navigate(['/edit-attestations', user]);
+ localStorage.setItem('credentialCode',
this.route.snapshot.queryParams["code"]);
+ localStorage.setItem('credentialState',
this.route.snapshot.queryParams["state"]);
+ localStorage.setItem('credentialSession_State',
this.route.snapshot.queryParams["session_state"]);
+ var user = localStorage.getItem('userForCredential');
+ this.router.navigate(['/edit-credentials', user]);
}
if (undefined !== this.route.snapshot.queryParams["logout"]){
- var user = localStorage.getItem('userForAttestation');
- this.router.navigate(['/edit-attestations', user]);
+ var user = localStorage.getItem('userForCredential');
+ this.router.navigate(['/edit-credentials', user]);
}
if (!this.oidcService.inOpenIdFlow()) {
this.oidcService.parseRouteParams(this.route.snapshot.queryParams);
@@ -112,17 +112,17 @@ export class IdentityListComponent implements OnInit {
}
this.missingClaims[identity.pubkey] = [];
for (let refscope of refscopes) {
- const attested = new Attribute('', '', '', '', 'STRING', '');
- attested.name = refscope[0];
- this.missingClaims[identity.pubkey].push(attested);
+ const cred = new Attribute('', '', '', '', 'STRING', '');
+ cred.name = refscope[0];
+ this.missingClaims[identity.pubkey].push(cred);
}
}
- private updateAttestations(identity) {
- this.attestations[identity.pubkey] = [];
- this.reclaimService.getAttestations(identity).subscribe(attestations => {
- if (attestations !== null) {
- this.attestations[identity.pubkey] = attestations;
+ private updateCredentials(identity) {
+ this.credentials[identity.pubkey] = [];
+ this.reclaimService.getCredentials(identity).subscribe(credentials => {
+ if (credentials !== null) {
+ this.credentials[identity.pubkey] = credentials;
}
},
err => {
@@ -370,7 +370,7 @@ export class IdentityListComponent implements OnInit {
identities.forEach(identity => {
this.updateAttributes(identity);
- this.updateAttestations(identity);
+ this.updateCredentials(identity);
});
if (this.modalOpened) {
this.closeModal('GnunetInfo');
@@ -424,18 +424,18 @@ export class IdentityListComponent implements OnInit {
return false;
}
- isClaimAttested(attribute: Attribute): boolean {
+ isClaim(attribute: Attribute): boolean {
if (undefined === attribute) { return false; }
return attribute.flag === '1';
}
getAttributeValue(identity: Identity, attribute: Attribute): string {
if (undefined === attribute) { return '?' };
- if (!this.isClaimAttested(attribute)) { return attribute.value };
- if (undefined === this.attestations[identity.pubkey]) { return '?'};
- for (let attest of this.attestations[identity.pubkey]) {
- if (attest.id == attribute.attestation) {
- for (let attr of attest.attributes) {
+ if (!this.isClaim(attribute)) { return attribute.value };
+ if (undefined === this.credentials[identity.pubkey]) { return '?'};
+ for (let cred of this.credentials[identity.pubkey]) {
+ if (cred.id == attribute.credential) {
+ for (let attr of cred.attributes) {
if (attribute.value == attr.name) {
return attr.value;
}
@@ -445,7 +445,7 @@ export class IdentityListComponent implements OnInit {
return "?";
}
- isAttestation(attribute: Attribute) {
+ isCredential(attribute: Attribute) {
if (attribute.flag === '1') {
return true;
}
diff --git a/src/app/open-id.service.ts b/src/app/open-id.service.ts
index f93df08..2e24837 100644
--- a/src/app/open-id.service.ts
+++ b/src/app/open-id.service.ts
@@ -98,10 +98,10 @@ export class OpenIdService {
window.location.href = this.buildAuthorizeRedirect();
}
- setAttestations(attestations: Attribute[]) {
+ setCredentials(credentials: Attribute[]) {
this.referenceString = "";
- for(var i = 0; i < attestations.length; i++) {
- this.referenceString = this.referenceString + attestations[i].name + " ";
+ for(var i = 0; i < credentials.length; i++) {
+ this.referenceString = this.referenceString + credentials[i].name + " ";
}
}
diff --git a/src/app/reclaim.service.ts b/src/app/reclaim.service.ts
index 3851cdd..5828b25 100644
--- a/src/app/reclaim.service.ts
+++ b/src/app/reclaim.service.ts
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
import { Attribute } from './attribute';
import { Reference } from './reference';
-import { Attestation } from './attestation';
+import { Credential } from './credential';
import { ConfigService } from './config.service';
import { GnuNetResponse } from './gnu-net-response';
import { Identity } from './identity';
@@ -41,38 +41,24 @@ export class ReclaimService {
ticket);
}
- deleteReference(identity: Identity, reference: Reference) {
- const options = {headers: new HttpHeaders({'Content-Type':
'application/json',}),
- body: reference,};
- return this.http.delete(this.config.get().apiUrl +
'/reclaim/attestation/reference/' +
- identity.name + '/' + reference.ref_id, options);
+ getCredentials(identity: Identity): Observable<Credential[]> {
+ return this.http.get<Credential[]>(this.config.get().apiUrl +
+ '/reclaim/credential/' + identity.name);
}
- getAttestations(identity: Identity): Observable<Attestation[]> {
- return this.http.get<Attestation[]>(this.config.get().apiUrl +
- '/reclaim/attestation/' + identity.name);
- }
-
- addAttestation(identity: Identity, attestation: Attestation) {
+ addCredential(identity: Identity, credential: Credential) {
var json = {
- "name": attestation.name,
- "value": attestation.value,
- "type": attestation.type
+ "name": credential.name,
+ "value": credential.value,
+ "type": credential.type
}
return this.http.post(this.config.get().apiUrl +
- '/reclaim/attestation/' + identity.name,
+ '/reclaim/credential/' + identity.name,
json);
}
- deleteAttestation(identity: Identity, attestation: Attestation) {
- return this.http.delete(this.config.get().apiUrl + '/reclaim/attestation/'
+
- identity.name + '/' + attestation.id);
- }
-
- /*Not needed
- fixmeExchangeCode(code: String) {
- let json = JSON.parse("{}");
- return
this.http.post("http://localhost:4567/token?grant_type=authorization_code&client_id=reclaimid&redirect_uri=http://localhost:4200/index.html&scope=openid&code="+code,
json);
+ deleteCredential(identity: Identity, credential: Credential) {
+ return this.http.delete(this.config.get().apiUrl + '/reclaim/credential/' +
+ identity.name + '/' + credential.id);
}
- */
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 343/459: fix, (continued)
- [reclaim-ui] 343/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 352/459: update, gnunet, 2021/06/11
- [reclaim-ui] 315/459: add localize package, gnunet, 2021/06/11
- [reclaim-ui] 357/459: reduce update time, gnunet, 2021/06/11
- [reclaim-ui] 319/459: internationalization finished, gnunet, 2021/06/11
- [reclaim-ui] 360/459: clean up, gnunet, 2021/06/11
- [reclaim-ui] 372/459: fix defaults loading, gnunet, 2021/06/11
- [reclaim-ui] 338/459: update en, gnunet, 2021/06/11
- [reclaim-ui] 366/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 333/459: Added translation using Weblate (German), gnunet, 2021/06/11
- [reclaim-ui] 305/459: renamed attestations to credentials,
gnunet <=
- [reclaim-ui] 365/459: preserve history on authz redirect, gnunet, 2021/06/11
- [reclaim-ui] 344/459: translate claims and scopedescription, gnunet, 2021/06/11
- [reclaim-ui] 348/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 374/459: logout before login, gnunet, 2021/06/11
- [reclaim-ui] 367/459: towards better attribute import, gnunet, 2021/06/11
- [reclaim-ui] 351/459: make parser happy, gnunet, 2021/06/11
- [reclaim-ui] 321/459: I18n, gnunet, 2021/06/11
- [reclaim-ui] 354/459: redirect at api request, gnunet, 2021/06/11
- [reclaim-ui] 350/459: do not escape, gnunet, 2021/06/11
- [reclaim-ui] 377/459: ignore some profile claims, gnunet, 2021/06/11