-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from MatthiasGr/est-renewal
Add EST-Based Certificate Renewal
- Loading branch information
Showing
18 changed files
with
335 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
ids-webconsole/src/main/angular/src/app/keycerts/est-re-enrollment.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface EstReEnrollment { | ||
estUrl: string; | ||
rootCertHash: string; | ||
alias: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ids-webconsole/src/main/angular/src/app/keycerts/identityrenewest.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="mdl-grid"> | ||
<div class="mdl-card card-dark mdl-cell mdl-cell--12-col"> | ||
<div class="mdl-card__title"> | ||
<h2 class="mdl-card__title-text">Renew Identity</h2> | ||
</div> | ||
<div class="mdl-card__supporting-text"> | ||
<form (ngSubmit)="onSubmit()" class="mdl-cell--12-col mdl-grid"> | ||
<div> | ||
<h5>EST Re-Enrollment</h5> | ||
</div> | ||
<div class="mdl-cell--12-col"> | ||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label has-placeholder mdl-cell--12-col form-group"> | ||
<label class="mdl-textfield__label" for="estUrl">EST Url*</label> | ||
<input class="mdl-textfield__input" name="estUrl" type="url" [(ngModel)]="estUrl" required> | ||
</div> | ||
</div> | ||
<div class="mdl-cell--12-col"> | ||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label has-placeholder mdl-cell--12-col form-group"> | ||
<label class="mdl-textfield__label" for="rootCertHash">Root CA Certificate Hash*</label> | ||
<input class="mdl-textfield__input" name="rootCertHash" type="text" [(ngModel)]="rootCertHash" required> | ||
</div> | ||
</div> | ||
<div class="mdl-cell--12-col" style="margin-top:20px"> | ||
<button type="submit" class="mdl-button mdl-color--accent mdl-button--raised">Renew certificate</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<snackbar #errorSnackbar subtitle="Check the trusted connector log for more details"/> |
50 changes: 50 additions & 0 deletions
50
ids-webconsole/src/main/angular/src/app/keycerts/identityrenewest.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
import { ESTService } from './est-service'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { HttpErrorResponse } from '@angular/common/http'; | ||
import { SnackbarComponent } from './snackbar.component'; | ||
|
||
@Component({ | ||
templateUrl: './identityrenewest.component.html' | ||
}) | ||
export class RenewIdentityESTComponent { | ||
estUrl = 'https://daps-dev.aisec.fraunhofer.de'; | ||
rootCertHash = '7d3f260abb4b0bfa339c159398c0ab480a251faa385639218198adcad9a3c17d'; | ||
|
||
@ViewChild("errorSnackbar") | ||
errorSnackbar: SnackbarComponent; | ||
|
||
constructor(private readonly titleService: Title, | ||
private readonly estService: ESTService, | ||
private readonly router: Router, | ||
private readonly route: ActivatedRoute) { | ||
this.titleService.setTitle('Renew Identity via the EST'); | ||
} | ||
|
||
handleError(err: HttpErrorResponse) { | ||
if (err.status === 0) { | ||
this.errorSnackbar.title = 'Network Error'; | ||
} else { | ||
const errObj = JSON.parse(err.error); | ||
if (errObj.message) { | ||
this.errorSnackbar.title = errObj.message; | ||
} else { | ||
// Errors have no message if it is disabled by the spring application | ||
this.errorSnackbar.title = `Error response from connector: ${err.status}: ${errObj.error}`; | ||
} | ||
} | ||
this.errorSnackbar.visible = true; | ||
} | ||
|
||
onSubmit() { | ||
this.estService.renewIdentity({ | ||
estUrl: this.estUrl, | ||
rootCertHash: this.rootCertHash, | ||
alias: this.route.snapshot.paramMap.get('alias') | ||
}).subscribe( | ||
() => this.router.navigate([ '/certificates' ]), | ||
err => this.handleError(err) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ids-webconsole/src/main/angular/src/app/keycerts/snackbar.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.snackbar { | ||
-webkit-transform: translate(-50%, 100px); | ||
transform: translate(-50%, 100px); | ||
} | ||
|
||
.snackbar-content { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.snackbar-subtitle { | ||
font-size: smaller; | ||
} |
9 changes: 9 additions & 0 deletions
9
ids-webconsole/src/main/angular/src/app/keycerts/snackbar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div id="est-error-snackbar" class="mdl-snackbar" [ngClass]="{'snackbar': !visible, 'mdl-snackbar--active': visible}"> | ||
<div class="mdl-snackbar__text snackbar-content"> | ||
<span>{{ title }}</span> | ||
<span *ngIf="subtitle !== null" class="mdl-color-text--grey-300 snackbar-subtitle"> | ||
{{ subtitle }} | ||
</span> | ||
</div> | ||
<button class="mdl-snackbar__action" type="button" (click)="invokeOnDismiss()">Dismiss</button> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
ids-webconsole/src/main/angular/src/app/keycerts/snackbar.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'snackbar', | ||
templateUrl: './snackbar.component.html', | ||
styleUrl: './snackbar.component.css' | ||
}) | ||
export class SnackbarComponent { | ||
@Input() title: string = null; | ||
@Input() subtitle: string = null; | ||
@Input() visible: boolean = false; | ||
@Input() onDismiss: ()=>void = null; | ||
|
||
invokeOnDismiss() { | ||
if (this.onDismiss !== null) { | ||
this.onDismiss() | ||
} else { | ||
this.visible = false; | ||
} | ||
} | ||
} |
Oops, something went wrong.