[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 201/459: started integrating oauthservice for attestation
From: |
gnunet |
Subject: |
[reclaim-ui] 201/459: started integrating oauthservice for attestation |
Date: |
Fri, 11 Jun 2021 23:24:53 +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 c1a9448cd1a6bfff1d0ae4572443350301623084
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Wed May 27 17:40:19 2020 +0200
started integrating oauthservice for attestation
---
package.json | 6 ++--
src/app/app.module.ts | 8 +++--
src/app/edit-identity/edit-identity.component.ts | 16 ++++++++--
src/app/oauth-helper.service.ts | 40 ++++++++++++++++++++++++
4 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index de58c13..abfc3dc 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
},
"private": true,
"dependencies": {
+ "@angular-devkit/build-angular": "^0.901.6",
"@angular/animations": "^9.0",
"@angular/cli": "^9.0",
"@angular/common": "^9.0",
@@ -21,6 +22,7 @@
"@angular/platform-browser": "^9.0",
"@angular/platform-browser-dynamic": "^9.0",
"@angular/router": "^9.0",
+ "angular-oauth2-oidc": "^9.2.2",
"bootstrap": "^4.4.1",
"core-js": "^3.5",
"font-awesome": "^4.7.0",
@@ -31,13 +33,11 @@
"zone.js": "~0.10.2"
},
"devDependencies": {
- "@angular-devkit/build-angular": "~0.900.3",
- "@angular/compiler-cli": "^9.0",
+ "@angular/compiler-cli": "^9.1.7",
"@angular/language-service": "^9.0",
"codelyzer": "^5.2.0",
"eslint": "^6",
"tslint": "^5.9.1",
- "typescript": "~3.7",
"web-ext-types": "^3.1.0"
}
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 6a2b03a..9d33d97 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -2,6 +2,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
+import { OAuthModule } from 'angular-oauth2-oidc';
import { AppComponent } from './app.component';
import { IdentityListComponent } from
'./identity-list/identity-list.component';
@@ -15,7 +16,8 @@ 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 { WebfingerService } from './webfinger.service';
+import { OauthHelperService } from './oauth-helper.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';
@@ -38,7 +40,8 @@ import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations
BrowserModule,
AppRoutingModule,
HttpClientModule,
- FormsModule
+ FormsModule,
+ OAuthModule.forRoot()
],
providers: [
IdentityService,
@@ -49,6 +52,7 @@ import { EditAttestationsComponent } from
'./edit-attestations/edit-attestations
GnsService,
OpenIdService,
ConfigService,
+ OauthHelperService,
WebfingerService,
{
provide: APP_INITIALIZER,
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index b4fe181..c29ce4a 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -11,6 +11,9 @@ import { IdentityService } from '../identity.service';
import { finalize } from 'rxjs/operators';
import { from, forkJoin, EMPTY } from 'rxjs';
import {WebfingerService} from '../webfinger.service';
+import { OAuthService } from 'angular-oauth2-oidc';
+import { OauthHelperService } from '../oauth-helper.service'
+
@Component({
selector: 'app-edit-identity',
@@ -41,7 +44,9 @@ export class EditIdentityComponent implements OnInit {
private namestoreService: NamestoreService,
private activatedRoute: ActivatedRoute,
private router: Router,
- private webfingerService: WebfingerService) { }
+ private webfingerService: WebfingerService,
+ private oauthService: OAuthService,
+ private oauthHelperService: OauthHelperService) { }
ngOnInit() {
this.attributes = [];
@@ -657,10 +662,17 @@ export class EditIdentityComponent implements OnInit {
}
loginFhgAccount(){
- window.location.href= this.idProvider + '/login';
+ var authCodeFlowConfig = this.oauthHelperService.getOauthConfig();
+ this.oauthService.configure(authCodeFlowConfig);
+ this.oauthService.loadDiscoveryDocumentAndLogin();
+ this.getId();
//window.location.href =
"http://localhost:4567/authorize?redirect_uri=http%3A%2F%2Flocalhost:4200%2Findex.html&client_id=reclaimid&response_type=code&scopes=openid";
}
+ getId (): any{
+ return this.oauthService.getIdentityClaims();
+ }
+
addAttestation(){
}
diff --git a/src/app/oauth-helper.service.ts b/src/app/oauth-helper.service.ts
new file mode 100644
index 0000000..6cd6014
--- /dev/null
+++ b/src/app/oauth-helper.service.ts
@@ -0,0 +1,40 @@
+import { Injectable } from '@angular/core';
+import { AuthConfig } from 'angular-oauth2-oidc';
+
+@Injectable()
+export class OauthHelperService {
+
+ constructor() { }
+
+ getOauthConfig(){
+ const authCodeFlowConfig: AuthConfig = {
+ // Url of the Identity Provider
+ issuer: localStorage.getItem('idProvider'),
+
+ // URL of the SPA to redirect the user to after login
+ redirectUri: window.location.origin + '/index.html',
+
+ // The SPA's id. The SPA is registerd with this id at the auth-server
+ // clientId: 'server.code',
+ clientId: 'reclaim:ID',
+
+ // 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;
+ }
+}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 189/459: experimental switch added, (continued)
- [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, 2021/06/11
- [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 <=
- [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, 2021/06/11
- [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