[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 219/459: merge webfinger-service and oauth-helper-service i
From: |
gnunet |
Subject: |
[reclaim-ui] 219/459: merge webfinger-service and oauth-helper-service into attestation-service |
Date: |
Fri, 11 Jun 2021 23:25:11 +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 d1f96d61843af5ac741c80e6f7ba262f3c4dfad6
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Wed Jun 17 15:39:51 2020 +0200
merge webfinger-service and oauth-helper-service into attestation-service
---
src/app/app.module.ts | 6 +--
src/app/attestation.service.ts | 49 ++++++++++++++++++++++++
src/app/edit-identity/edit-identity.component.ts | 14 +++----
src/app/oauth-helper.service.ts | 40 -------------------
src/app/webfinger.service.ts | 16 --------
5 files changed, 57 insertions(+), 68 deletions(-)
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 9d33d97..8d780ae 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -16,8 +16,7 @@ import { ModalComponent } from './modal.component';
import { ModalService } from './modal.service';
import { SearchPipe } from './search.pipe';
import { OpenIdService } from './open-id.service';
-import { WebfingerService } from './webfinger.service';
-import { OauthHelperService } from './oauth-helper.service';
+import { AttestationService } from './attestation.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';
@@ -52,8 +51,7 @@ import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations
GnsService,
OpenIdService,
ConfigService,
- OauthHelperService,
- WebfingerService,
+ AttestationService,
{
provide: APP_INITIALIZER,
useFactory: (config: ConfigService) => () => config.load(),
diff --git a/src/app/attestation.service.ts b/src/app/attestation.service.ts
new file mode 100644
index 0000000..09038fb
--- /dev/null
+++ b/src/app/attestation.service.ts
@@ -0,0 +1,49 @@
+import { HttpClient, HttpHeaders} from '@angular/common/http';
+import { Injectable } from '@angular/core'
+import { Observable } from 'rxjs';
+import { ConfigService } from './config.service'
+import { AuthConfig } from 'angular-oauth2-oidc';
+
+@Injectable()
+export class AttestationService {
+
+ 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);
+ }
+
+ getOauthConfig(idProvider: string){
+ const authCodeFlowConfig: AuthConfig = {
+ // Url of the Identity Provider
+ issuer: idProvider,
+
+ // URL of the SPA to redirect the user to after login
+ redirectUri: window.location.href,
+
+ // 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: 'openid profile omejdn:api',
+
+ showDebugInformation: true,
+ };
+
+ return authCodeFlowConfig;
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index 96e982d..b9586ab 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -10,9 +10,8 @@ import { Attestation } from '../attestation';
import { IdentityService } from '../identity.service';
import { finalize } from 'rxjs/operators';
import { from, forkJoin, EMPTY } from 'rxjs';
-import {WebfingerService} from '../webfinger.service';
+import { AttestationService } from '../attestation.service';
import { OAuthService } from 'angular-oauth2-oidc';
-import { OauthHelperService } from '../oauth-helper.service'
import { Authorization } from '../authorization';
@@ -47,9 +46,8 @@ export class EditIdentityComponent implements OnInit {
private namestoreService: NamestoreService,
private activatedRoute: ActivatedRoute,
private router: Router,
- private webfingerService: WebfingerService,
- private oauthService: OAuthService,
- private oauthHelperService: OauthHelperService) {}
+ private attestationService: AttestationService,
+ private oauthService: OAuthService) {}
ngOnInit() {
this.attributes = [];
@@ -66,7 +64,7 @@ export class EditIdentityComponent implements OnInit {
this.newAttestation = new Attestation('', '', '', 'JWT', '', null, []);
if (this.newIdProvider !== ''){
-
this.oauthService.configure(this.oauthHelperService.getOauthConfig(this.newIdProvider));
+
this.oauthService.configure(this.attestationService.getOauthConfig(this.newIdProvider));
this.oauthService.loadDiscoveryDocumentAndTryLogin();
}
@@ -640,7 +638,7 @@ export class EditIdentityComponent implements OnInit {
}
localStorage.setItem('userForAttestation', this.identity.name);
this.isValidEmailforDiscovery();
- this.webfingerService.getLink(this.webfingerEmail).subscribe (idProvider
=> {
+ this.attestationService.getLink(this.webfingerEmail).subscribe (idProvider
=> {
this.newIdProvider = (idProvider.links [0]).href;
localStorage.setItem('newIdProvider', this.newIdProvider);
console.log(this.newIdProvider);
@@ -686,7 +684,7 @@ export class EditIdentityComponent implements OnInit {
}
loginFhgAccount(){
- var authCodeFlowConfig =
this.oauthHelperService.getOauthConfig(this.newIdProvider);
+ var authCodeFlowConfig =
this.attestationService.getOauthConfig(this.newIdProvider);
this.oauthService.configure(authCodeFlowConfig);
this.oauthService.loadDiscoveryDocumentAndLogin();
this.getId();
diff --git a/src/app/oauth-helper.service.ts b/src/app/oauth-helper.service.ts
deleted file mode 100644
index dc1dcce..0000000
--- a/src/app/oauth-helper.service.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { Injectable } from '@angular/core';
-import { AuthConfig } from 'angular-oauth2-oidc';
-
-@Injectable()
-export class OauthHelperService {
-
- constructor() { }
-
- getOauthConfig(idProvider: string){
- const authCodeFlowConfig: AuthConfig = {
- // Url of the Identity Provider
- issuer: idProvider,
-
- // URL of the SPA to redirect the user to after login
- redirectUri: window.location.href,
-
- // 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: 'openid profile omejdn:api',
-
- showDebugInformation: true,
- };
-
- return authCodeFlowConfig;
- }
-}
diff --git a/src/app/webfinger.service.ts b/src/app/webfinger.service.ts
deleted file mode 100644
index 084b1b4..0000000
--- a/src/app/webfinger.service.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { HttpClient, HttpHeaders} from '@angular/common/http';
-import { Injectable } from '@angular/core'
-import { Observable } from 'rxjs';
-import { ConfigService } from './config.service'
-
-@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);
- }
-
-}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 192/459: minor fixes, (continued)
- [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
- [reclaim-ui] 209/459: trying to save accesstoken in localStorage, gnunet, 2021/06/11
- [reclaim-ui] 219/459: merge webfinger-service and oauth-helper-service into attestation-service,
gnunet <=
- [reclaim-ui] 230/459: fix webfinger, gnunet, 2021/06/11
- [reclaim-ui] 226/459: nothing important, gnunet, 2021/06/11
- [reclaim-ui] 210/459: new Attestation created, gnunet, 2021/06/11
- [reclaim-ui] 202/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 196/459: issuer discoverable, gnunet, 2021/06/11
- [reclaim-ui] 213/459: Attestation is added after account is linked, gnunet, 2021/06/11
- [reclaim-ui] 215/459: merge, gnunet, 2021/06/11
- [reclaim-ui] 211/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 223/459: button label changed, gnunet, 2021/06/11
- [reclaim-ui] 229/459: fix, gnunet, 2021/06/11