-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: optimize login flow Signed-off-by: Mirko Mollik <[email protected]> * add login flow to extension Signed-off-by: Mirko Mollik <[email protected]> * chore: fix lint issues Signed-off-by: Mirko Mollik <[email protected]> --------- Signed-off-by: Mirko Mollik <[email protected]>
- Loading branch information
Showing
45 changed files
with
397 additions
and
108 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<div fxLayout="column" fxLayoutAlign="space-around center" id="content"> | ||
<button mat-flat-button color="primary" (click)="login()">Login</button> | ||
<div fxLayout="column" fxLayoutGap="16px"> | ||
<img src="assets/icons/icon.svg" alt="Wallet" /> | ||
<h3>Login into {{ name }}</h3> | ||
<button mat-flat-button color="primary" (click)="login()">Login</button> | ||
<button mat-button (click)="changeBackend()">Change backend</button> | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -1,22 +1,47 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AuthService } from '../auth/auth.service'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { FlexLayoutModule } from 'ng-flex-layout'; | ||
import { MatDialog, MatDialogModule } from '@angular/material/dialog'; | ||
import { firstValueFrom } from 'rxjs'; | ||
import { BackendDialogComponent, ConfigService } from '@credhub/holder-shared'; | ||
|
||
@Component({ | ||
selector: 'app-login', | ||
standalone: true, | ||
imports: [MatButtonModule, FlexLayoutModule], | ||
imports: [MatButtonModule, FlexLayoutModule, MatDialogModule], | ||
templateUrl: './login.component.html', | ||
styleUrl: './login.component.scss', | ||
}) | ||
export class LoginComponent { | ||
constructor(public authService: AuthService, private route: ActivatedRoute) {} | ||
export class LoginComponent implements OnInit { | ||
name!: string; | ||
|
||
constructor( | ||
public authService: AuthService, | ||
private route: ActivatedRoute, | ||
private matDialog: MatDialog, | ||
private configService: ConfigService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.name = this.configService.getConfig('name'); | ||
} | ||
|
||
login() { | ||
// get the targeturl when passed in the query params | ||
const targetUrl = this.route.snapshot.queryParams['targetUrl']; | ||
this.authService.login(targetUrl !== 'login' ? targetUrl : null); | ||
} | ||
|
||
/** | ||
* Open the dialog to change the backend. Reload the page after the dialog is closed so the new backend is used when the application starts. | ||
*/ | ||
changeBackend() { | ||
firstValueFrom( | ||
this.matDialog | ||
.open(BackendDialogComponent, { disableClose: true }) | ||
.afterClosed() | ||
).then(() => window.location.reload()); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
{ | ||
"backendUrl": "http://localhost:3000", | ||
"oidcUrl": "http://host.docker.internal:8080/realms/wallet", | ||
"oidcClient": "wallet", | ||
"oidcAllowHttp": true | ||
"backendUrl": "http://localhost:3000" | ||
} |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
{ | ||
"backendUrl": "http://localhost:3000", | ||
"oidcUrl": "http://host.docker.internal:8080/realms/wallet", | ||
"oidcClient": "wallet", | ||
"oidcAllowHttp": true | ||
"backendUrl": "http://localhost:3000" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*.ts"], | ||
"include": [ | ||
"src/**/*.ts", | ||
"../../libs/holder-shared/src/lib/config.service.ts" | ||
], | ||
"compilerOptions": {}, | ||
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.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
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
6 changes: 6 additions & 0 deletions
6
apps/holder-backend/src/app/auth/dto/endpoint-response.dto.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,6 @@ | ||
export class EndpointResponse { | ||
oidcUrl: string; | ||
oidcClient: string; | ||
oidcAllowHttp: boolean; | ||
name: 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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { UserDeletedEvent } from '../auth.service'; | ||
import { EndpointResponse } from '../dto/endpoint-response.dto'; | ||
|
||
export abstract class OIDCClient { | ||
abstract endpoints(): EndpointResponse; | ||
abstract userDeleteEvent(payload: UserDeletedEvent): void; | ||
} |
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
29 changes: 7 additions & 22 deletions
29
apps/holder-browser-extension/src/app/login/login.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 |
---|---|---|
@@ -1,23 +1,8 @@ | ||
<div fxLayout="column" fxLayoutAlign="start center" fxLayoutGap="16px"> | ||
<img src="assets/images/icon.png" alt="Logo" class="logo" /> | ||
<form | ||
[formGroup]="form" | ||
(submit)="login()" | ||
fxLayout="column" | ||
fxLayoutAlign="start space-between" | ||
fxLayoutGap="32px" | ||
> | ||
<button | ||
mat-flat-button | ||
color="primary" | ||
type="submit" | ||
[disabled]="form.invalid" | ||
> | ||
Login | ||
</button> | ||
<mat-form-field style="display: none"> | ||
<mat-label>Endpoint</mat-label> | ||
<input matInput formControlName="endpoint" /> | ||
</mat-form-field> | ||
</form> | ||
<div fxLayout="column" fxLayoutAlign="space-around center" id="content"> | ||
<div fxLayout="column" fxLayoutGap="16px"> | ||
<img src="assets/images/icon.svg" alt="Wallet" /> | ||
<h3>Login into {{ name }}</h3> | ||
<button mat-flat-button color="primary" (click)="login()">Login</button> | ||
<button mat-button (click)="changeBackend()">Change backend</button> | ||
</div> | ||
</div> |
Oops, something went wrong.