[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 234/459: adding attestation works
From: |
gnunet |
Subject: |
[reclaim-ui] 234/459: adding attestation works |
Date: |
Fri, 11 Jun 2021 23:25:26 +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 456fac4d55f8b612ae9466c17efa5ebbfe63877e
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Mon Jul 13 11:24:43 2020 +0200
adding attestation works
---
src/app/app.module.ts | 4 +++-
.../edit-attestations.component.html | 2 +-
.../edit-attestations.component.ts | 18 +++++++-----------
src/app/edit-identity/edit-identity.component.html | 2 +-
src/app/edit-identity/edit-identity.component.ts | 21 ---------------------
src/app/identity-list/identity-list.component.ts | 4 +++-
6 files changed, 15 insertions(+), 36 deletions(-)
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 8d780ae..64708b7 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -22,6 +22,7 @@ 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 { OAuthStorage } from 'angular-oauth2-oidc';
@NgModule({
declarations: [
@@ -56,7 +57,8 @@ import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations
provide: APP_INITIALIZER,
useFactory: (config: ConfigService) => () => config.load(),
deps: [ConfigService], multi: true
- }
+ },
+ { provide: OAuthStorage, useValue: localStorage },
],
bootstrap: [AppComponent]
})
diff --git a/src/app/edit-attestations/edit-attestations.component.html
b/src/app/edit-attestations/edit-attestations.component.html
index ee7a214..879f9e5 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-attestations/edit-attestations.component.html
@@ -51,7 +51,7 @@
</td>
<td><div style="min-width: 15em">{{newIdProvider.url}}</div></td>
<td>
- <button class="btn btn-primary" (click)="saveIdProvider()">
+ <button class="btn btn-primary"
[disabled]="!canAddAttestation(newAttestation)" (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-attestations/edit-attestations.component.ts
index 6b7f9c1..e34d4dc 100644
--- a/src/app/edit-attestations/edit-attestations.component.ts
+++ b/src/app/edit-attestations/edit-attestations.component.ts
@@ -10,6 +10,7 @@ import { AttestationService } from '../attestation.service';
import { OAuthService } from 'angular-oauth2-oidc';
import { IdProvider } from '../idProvider';
import { ConstantPool } from '@angular/compiler';
+import { LoginOptions } from 'angular-oauth2-oidc';
@Component({
selector: 'app-edit-attestations',
@@ -37,13 +38,12 @@ export class EditAttestationsComponent implements OnInit {
this.loadIdProviderFromLocalStorage();
this.attestations = [];
if (this.newIdProvider.url !== ''){
+ const loginOptions: LoginOptions = {
+ customHashFragment: "?code="+localStorage.getItem("attestationCode") +
"&state=" + localStorage.getItem("attestationState") + "&session_state="+
localStorage.getItem("attestationSession_State"),
+ }
+ console.log(loginOptions.customHashFragment);
this.oauthService.configure(this.attestationService.getOauthConfig(this.newIdProvider));
- this.oauthService.loadDiscoveryDocumentAndTryLogin().then(res => {
- console.log("ngOnInit: logged in");
- console.log(res);
- console.log("Has valid accessToken: " +
this.oauthService.hasValidAccessToken());
- console.log("AccessToken: " + this.oauthService.getAccessToken());
- }).catch(err => console.log(err));
+ this.oauthService.loadDiscoveryDocumentAndTryLogin(loginOptions);
}
this.activatedRoute.params.subscribe(p => {
if (p['id'] === undefined) {
@@ -79,10 +79,7 @@ export class EditAttestationsComponent implements OnInit {
addAttestation() {
if (!this.oauthService.hasValidAccessToken()){
console.log("No AccessToken");
-
this.oauthService.configure(this.attestationService.getOauthConfig(this.newIdProvider));
- this.oauthService.loadDiscoveryDocumentAndTryLogin().then(res => {
- console.log("AddAttestation: logged in");
- console.log(this.oauthService.getAccessToken());}).catch(err =>
console.log(err));
+ return;
}
this.newAttestation.value = this.oauthService.getAccessToken();
this.reclaimService.addAttestation(this.identity,
this.newAttestation).subscribe(res => {
@@ -154,7 +151,6 @@ export class EditAttestationsComponent implements OnInit {
canAddAttestation(attestation: Attestation) {
if(!this.oauthService.hasValidAccessToken()){
- console.log("not logged in");
return false;
}
if ((attestation.name === '')) {
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index 323cdf5..c70b141 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -167,7 +167,7 @@
<button *ngIf="newIdProviderDiscovered() && !grantedAccessToIdProvider()"
class="btn btn-primary mb-4 fhg-link" (click)="loginFhgAccount()">
<span class="fa fa-user"></span> Grant Access to {{newIdProvider.name}}
</button>
- <button *ngIf="newIdProviderDiscovered()" class="btn btn-primary mb-4
fhg-link" (click)="cancleLinking()">
+ <button *ngIf="newIdProviderDiscovered()" class="btn btn-primary mb-4
fhg-link" (click)="cancelLinking()">
Cancel Linking
</button>
</div>
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index f799626..816158e 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -666,17 +666,6 @@ export class EditIdentityComponent implements OnInit {
return true;
}
-
- //not sure if needed -> should be able to link two different accounts from
same provider
- discoveredIdProviderExistsAlready(){
- this.authorizations.forEach(token => {
- if (token.idProvider == this.newIdProvider.url){
- return true;
- }
- });
- return false;
- }
-
newIdProviderDiscovered(){
if (this.newIdProvider.url == ''){
return false;
@@ -695,16 +684,6 @@ export class EditIdentityComponent implements OnInit {
this.getId();
}
- attestationNameDuplicate(){
- let i;
- for (i = 0; i < this.attestations.length; i++) {
- if (this.newAttestation.name === this.attestations[i].name) {
- return true;
- }
- }
- return false;
- }
-
getId (): any{
return this.oauthService.getIdentityClaims();
}
diff --git a/src/app/identity-list/identity-list.component.ts
b/src/app/identity-list/identity-list.component.ts
index b5b233e..9951256 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -41,7 +41,7 @@ export class IdentityListComponent implements OnInit {
private namestoreService: NamestoreService,
private gnsService: GnsService,
private modalService: ModalService,
- private router: Router) {
+ private router: Router,) {
}
ngOnInit() {
@@ -58,6 +58,8 @@ export class IdentityListComponent implements OnInit {
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]);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 245/459: improved scope display, (continued)
- [reclaim-ui] 245/459: improved scope display, gnunet, 2021/06/11
- [reclaim-ui] 236/459: redirect after logout from idProvider, gnunet, 2021/06/11
- [reclaim-ui] 255/459: remove env, gnunet, 2021/06/11
- [reclaim-ui] 228/459: redirect to edit-attestation after linking account, gnunet, 2021/06/11
- [reclaim-ui] 237/459: moved IdProvider-Linking to edit-attestations, gnunet, 2021/06/11
- [reclaim-ui] 242/459: more style, gnunet, 2021/06/11
- [reclaim-ui] 217/459: fixed attestation-save (already existing attestations were always added again), gnunet, 2021/06/11
- [reclaim-ui] 222/459: omejdn:api scope deleted, gnunet, 2021/06/11
- [reclaim-ui] 227/459: redirect now to edit-attestations/clientname should be edit-identity/clientname #20, gnunet, 2021/06/11
- [reclaim-ui] 203/459: yarn.lock, gnunet, 2021/06/11
- [reclaim-ui] 234/459: adding attestation works,
gnunet <=
- [reclaim-ui] 214/459: package.json, gnunet, 2021/06/11
- [reclaim-ui] 240/459: scopes after idProviderDiscovery, gnunet, 2021/06/11
- [reclaim-ui] 244/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 235/459: code duplicates removed, gnunet, 2021/06/11
- [reclaim-ui] 251/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 259/459: fix attribute updates and display, gnunet, 2021/06/11
- [reclaim-ui] 243/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 257/459: minor wording change, gnunet, 2021/06/11
- [reclaim-ui] 248/459: minor info change, gnunet, 2021/06/11
- [reclaim-ui] 275/459: more info boxes, gnunet, 2021/06/11