Skip to content

Commit

Permalink
fix: remove exchange (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
mghilardelli authored Feb 7, 2025
1 parent 377719e commit ebc3a2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions webapp/src/app/auth-insights/auth-insights.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ <h3 i18n>Exchange token</h3>
<sbb-label>role</sbb-label>
<input type="text" sbbInput [formControl]="roleControl"/>
</sbb-form-field>

<button type="button" sbb-button (click)="exchange()">Exchange</button>
</div>

<pre>{{ exchangeClaims | json }}</pre>
12 changes: 2 additions & 10 deletions webapp/src/app/auth-insights/auth-insights.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Component } from '@angular/core';
import { AuthService } from "../auth.service";
import { CommonModule } from "@angular/common";
import { SbbButtonModule } from "@sbb-esta/angular/button";
import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { firstValueFrom, map } from "rxjs";
import { map } from "rxjs";
import { OidcSecurityService } from "angular-auth-oidc-client";
import { SbbInputModule } from "@sbb-esta/angular/input";

Expand All @@ -25,8 +24,6 @@ export class AuthInsightsComponent {
trainControl = new FormControl(new Date().toISOString().split('T')[0] + '_9232', {nonNullable: true});
roleControl = new FormControl('read-only', {nonNullable: true});

exchangeClaims?: string;

get claims() {
return this.oidcSecurityService.getUserData();
}
Expand All @@ -35,11 +32,6 @@ export class AuthInsightsComponent {
return this.oidcSecurityService.getAuthenticationResult().pipe(map((data) => data?.scope));
}

constructor(private oidcSecurityService: OidcSecurityService, private authService: AuthService) {
}

async exchange() {
const token = await firstValueFrom(this.authService.exchange(this.ruControl.value, this.trainControl.value, this.roleControl.value))
this.exchangeClaims = JSON.parse(atob(token.split('.')[1]));
constructor(private oidcSecurityService: OidcSecurityService) {
}
}

0 comments on commit ebc3a2b

Please sign in to comment.