[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 216/459: idProvider stored in localStorage and loaded to au
From: |
gnunet |
Subject: |
[reclaim-ui] 216/459: idProvider stored in localStorage and loaded to authorization interface |
Date: |
Fri, 11 Jun 2021 23:25:08 +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 75dc44e3a8a27e3f3395600672be5a034e5ff1a3
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Wed Jun 17 10:30:29 2020 +0200
idProvider stored in localStorage and loaded to authorization interface
---
src/app/accessToken.ts | 4 --
src/app/attestation.ts | 2 +-
src/app/authorization.ts | 8 ++++
.../edit-attestations.component.html | 2 +-
src/app/edit-identity/edit-identity.component.html | 6 +--
src/app/edit-identity/edit-identity.component.ts | 51 +++++++++++++++-------
src/app/reclaim.service.ts | 4 +-
src/app/webfinger.service.ts | 4 --
8 files changed, 48 insertions(+), 33 deletions(-)
diff --git a/src/app/accessToken.ts b/src/app/accessToken.ts
deleted file mode 100644
index d14e7e7..0000000
--- a/src/app/accessToken.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface AccessToken {
- idProvider: string;
- accessToken: string;
-}
\ No newline at end of file
diff --git a/src/app/attestation.ts b/src/app/attestation.ts
index 64fdb44..dfc40ff 100644
--- a/src/app/attestation.ts
+++ b/src/app/attestation.ts
@@ -5,7 +5,7 @@ export class Attestation {
public id: string,
public value: string,
public type: string,
- public iss: string,
+ public issuer: string,
public expiration: number,
public attributes: Attribute[]) {}
}
diff --git a/src/app/authorization.ts b/src/app/authorization.ts
new file mode 100644
index 0000000..b69af78
--- /dev/null
+++ b/src/app/authorization.ts
@@ -0,0 +1,8 @@
+export interface Authorization{
+ idProvider: string,
+ attestationName: string,
+ redirectUri: string,
+ clientId: string,
+ accessToken: string,
+ idToken: string
+}
\ No newline at end of file
diff --git a/src/app/edit-attestations/edit-attestations.component.html
b/src/app/edit-attestations/edit-attestations.component.html
index 971779f..d96ec35 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-attestations/edit-attestations.component.html
@@ -31,7 +31,7 @@
<div style="min-width: 15em">
</div>
</td>-->
- <td><div style="min-width: 15em">{{attestation.iss}}</div></td>
+ <td><div style="min-width: 15em">{{attestation.issuer}}</div></td>
<td>
<button class="btn btn-primary"
(click)="deleteAttestation(attestation)">
<span class="fa fa-trash"></span>
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index e4bc2fa..076b8bb 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -159,16 +159,12 @@
<div *ngIf="!emailNotFoundAlertClosed && webfingerEmail==''" class="alert
alert-danger alert-dismissible fade show my-2" role="alert">
<span class="fa fa-warning"></span> No account found with this email
</div>
- <!--IdProvider Exists already warning-->
- <div *ngIf="discoveredIdProviderExistsAlready() && webfingerEmail==''"
class="alert alert-danger alert-dismissible fade show my-2" role="alert">
- <span class="fa fa-warning"></span> The Provider linked to this website
is already linked.
- </div>
<button *ngIf="isExperimental() && !newIdProviderDiscovered()" class="btn
btn-primary mb-4 fhg-link" (click)="getFhGAttestation()">
<span class="fa fa-user"></span> Link Fraunhofer Account
</button>
<!--Link account-->
- <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
!discoveredIdProviderExistsAlready() && !grantedAccessToIdProvider()"
class="btn btn-primary mb-4 fhg-link" (click)="loginFhgAccount()">
+ <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
!grantedAccessToIdProvider()" class="btn btn-primary mb-4 fhg-link"
(click)="loginFhgAccount()">
<span class="fa fa-user"></span> Link {{getNewIdProviderName()}} Account
</button>
<!--Save account-->
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index ef5fa72..392ba21 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -13,7 +13,7 @@ import { from, forkJoin, EMPTY } from 'rxjs';
import {WebfingerService} from '../webfinger.service';
import { OAuthService } from 'angular-oauth2-oidc';
import { OauthHelperService } from '../oauth-helper.service'
-import { AccessToken } from '../accessToken';
+import { Authorization } from '../authorization';
@Component({
@@ -36,7 +36,7 @@ export class EditIdentityComponent implements OnInit {
requestedAttested: Attribute[];
optionalAttested: Attribute[];
webfingerEmail: string;
- accessToken: AccessToken[];
+ authorizations: Authorization[];
newIdProvider: string;
emailNotFoundAlertClosed: boolean;
@@ -59,7 +59,7 @@ export class EditIdentityComponent implements OnInit {
this.webfingerEmail = '';
this.newIdProvider = localStorage.getItem('newIdProvider') || '';
this.emailNotFoundAlertClosed = true;
- this.loadAccessTokenFromLocalStorage();
+ this.loadAuthorizationsFromLocalStorage();
this.identity = new Identity('','');
this.newAttribute = new Attribute('', '', '', '', 'STRING', '');
this.newAttested = new Attribute('', '', '', '', 'STRING', '');
@@ -609,7 +609,7 @@ export class EditIdentityComponent implements OnInit {
getIssuer(attribute: Attribute) {
for (let i = 0; i < this.attestations.length; i++) {
if (this.attestations[i].id == attribute.attestation) {
- return this.attestations[i].iss;
+ return this.attestations[i].issuer;
}
}
}
@@ -657,8 +657,10 @@ export class EditIdentityComponent implements OnInit {
return true;
}
+
+ //not sure if needed -> should be able to link two different accounts from
same provider
discoveredIdProviderExistsAlready(){
- this.accessToken.forEach(token => {
+ this.authorizations.forEach(token => {
if (token.idProvider == this.newIdProvider){
return true;
}
@@ -684,12 +686,16 @@ export class EditIdentityComponent implements OnInit {
}
saveIdProviderinLocalStorage(){
- const newAccessToken: AccessToken = {
+ const newAuthorization: Authorization = {
idProvider: this.newIdProvider,
+ attestationName: this.newAttestation.name,
+ redirectUri: this.oauthService.redirectUri,
+ clientId: this.oauthService.clientId,
accessToken: this.getAccessToken(),
+ idToken: this.oauthService.getIdToken()
}
- this.accessToken.push(newAccessToken);
- localStorage.setItem('idProvider:' + this.newIdProvider, "RedirectUri:" +
this.oauthService.redirectUri + ";ClientId: " + this.oauthService.clientId + ";
AccessToken: " + this.getAccessToken());
+ this.authorizations.push(newAuthorization);
+ localStorage.setItem("Authorization: " + this.newAttestation.name,
'idProvider: ' + this.newIdProvider + ";redirectUri: " +
this.oauthService.redirectUri + ";clientId: " + this.oauthService.clientId +
";accessToken: " + this.getAccessToken() + ";idToken: " +
this.oauthService.getIdToken());
}
addAttestation() {
@@ -709,6 +715,7 @@ export class EditIdentityComponent implements OnInit {
});
this.newAttestation.name = '';
this.newAttestation.value = '';
+ this.logOutFromOauthService
}
saveIdProvider(){
@@ -732,20 +739,32 @@ export class EditIdentityComponent implements OnInit {
return false;
}
- loadAccessTokenFromLocalStorage(){
- this.accessToken = [];
+ loadAuthorizationsFromLocalStorage(){
+ this.authorizations = [];
var potentialIdProviders = Object.keys(localStorage);
potentialIdProviders.forEach(element => {
- if (element.includes('idProvider')){
- var idProvider = element.replace('idProvider:', '');
- const newAccessToken: AccessToken = {
- idProvider: idProvider,
- accessToken: localStorage.getItem(idProvider),
+ if (element.includes('Authorization')){
+ const newAuthorization: Authorization = {
+ attestationName: element.replace('Authorization: ', ''),
+ idProvider: '',
+ redirectUri: '',
+ clientId: '',
+ accessToken: '',
+ idToken: ''
+ }
+ var content = localStorage.getItem(element);
+ content.split(";").forEach(authInfo => {
+ var key = authInfo.split(": ")[0];
+ var value = authInfo.split(": ")[1];
+ newAuthorization[key] = value;
}
- this.accessToken.push(newAccessToken);
+ )
+
+ this.authorizations.push(newAuthorization);
}
});
+ console.log(this.authorizations);
}
logOutFromOauthService(){
diff --git a/src/app/reclaim.service.ts b/src/app/reclaim.service.ts
index fff97b1..91dc643 100644
--- a/src/app/reclaim.service.ts
+++ b/src/app/reclaim.service.ts
@@ -56,8 +56,8 @@ export class ReclaimService {
addAttestation(identity: Identity, attestation: Attestation) {
var json = {
"name": attestation.name,
- "type": attestation.type,
- "value": attestation.value
+ "value": attestation.value,
+ "type": attestation.type
}
return this.http.post(this.config.get().apiUrl +
'/reclaim/attestation/' + identity.name,
diff --git a/src/app/webfinger.service.ts b/src/app/webfinger.service.ts
index 4b1d178..084b1b4 100644
--- a/src/app/webfinger.service.ts
+++ b/src/app/webfinger.service.ts
@@ -3,15 +3,11 @@ import { Injectable } from '@angular/core'
import { Observable } from 'rxjs';
import { ConfigService } from './config.service'
-// https://github.com/d-koppenhagen/webfinger
-
@Injectable()
export class WebfingerService {
constructor(private http: HttpClient, private config: ConfigService) {
}
-
-
getLink (email: string): Observable<any>{
return this.http.get<any>(this.config.get().webfingerUrl +
'/.well-known/webfinger?resource=acct:' + email);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 205/459: login via omejdn:api works, (continued)
- [reclaim-ui] 205/459: login via omejdn:api works, gnunet, 2021/06/11
- [reclaim-ui] 185/459: minor fixes, gnunet, 2021/06/11
- [reclaim-ui] 206/459: attestation name added, gnunet, 2021/06/11
- [reclaim-ui] 186/459: update to new API and structure, gnunet, 2021/06/11
- [reclaim-ui] 208/459: store idProvider/Attestation(not working), gnunet, 2021/06/11
- [reclaim-ui] 207/459: improved emailNotFoundAlert, gnunet, 2021/06/11
- [reclaim-ui] 193/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 189/459: experimental switch added, gnunet, 2021/06/11
- [reclaim-ui] 191/459: update to angular9; minor bugfixes, gnunet, 2021/06/11
- [reclaim-ui] 187/459: add issuer display, gnunet, 2021/06/11
- [reclaim-ui] 216/459: idProvider stored in localStorage and loaded to authorization interface,
gnunet <=
- [reclaim-ui] 204/459: merge yarn.lock, gnunet, 2021/06/11
- [reclaim-ui] 192/459: minor fixes, gnunet, 2021/06/11
- [reclaim-ui] 195/459: fix parsing claims parameter, gnunet, 2021/06/11
- [reclaim-ui] 218/459: login works properly, gnunet, 2021/06/11
- [reclaim-ui] 188/459: add expiration, gnunet, 2021/06/11
- [reclaim-ui] 198/459: back to where it should be, gnunet, 2021/06/11
- [reclaim-ui] 201/459: started integrating oauthservice for attestation, gnunet, 2021/06/11
- [reclaim-ui] 221/459: logout on server side works #19, gnunet, 2021/06/11
- [reclaim-ui] 220/459: attestation name duplication prevented + trying to logout on serverside, gnunet, 2021/06/11
- [reclaim-ui] 224/459: random token request deleted, gnunet, 2021/06/11