Skip to content

Commit

Permalink
upgrade-iridium-client (#2)
Browse files Browse the repository at this point in the history
* upgrade-iridium-client

* remove client settings
  • Loading branch information
joshfischer1108 authored Aug 4, 2023
1 parent 81189ef commit 5c5fa0a
Show file tree
Hide file tree
Showing 51 changed files with 133 additions and 751 deletions.
46 changes: 2 additions & 44 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,6 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-iridium-client": {
"projectType": "library",
"root": "projects/ngx-iridium-client",
"sourceRoot": "projects/ngx-iridium-client/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/ngx-iridium-client/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ngx-iridium-client/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/ngx-iridium-client/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/ngx-iridium-client/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/iridium-ui/src/**/*.ts",
"projects/iridium-ui/src/**/*.html"
]
}
}
}
},
"iridium-ui": {
"projectType": "application",
"schematics": {},
Expand Down Expand Up @@ -146,8 +104,8 @@
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/ngx-iridium-client/src/**/*.ts",
"projects/ngx-iridium-client/src/**/*.html"
"projects/iridium-ui/src/**/*.ts",
"projects/iridium-ui/src/**/*.html"
]
}
}
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"lint-ui": "ng lint iridium-ui",
"lint-client": "ng lint ngx-iridium-client",
"lint": "npm run lint-ui && npm run lint-client",
"lint": "npm run lint-ui",
"build": "ng build",
"build-all": "ng build ngx-iridium-client && ng build iridium-ui",
"build-all": "ng build ng build iridium-ui",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
Expand All @@ -24,6 +22,7 @@
"@angular/platform-browser": "^15.2.0",
"@angular/platform-browser-dynamic": "^15.2.0",
"@angular/router": "^15.2.0",
"@iridiumidentity/ngx-iridium-client": "^0.2.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
Expand All @@ -50,4 +49,4 @@
"ng-packagr": "^15.2.2",
"typescript": "~4.9.4"
}
}
}
2 changes: 1 addition & 1 deletion projects/iridium-ui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { RegisterComponent } from './components/register/register.component';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { NgxIridiumCallbackComponent } from 'ngx-iridium-client';
import { authGuard } from './guard/auth.guard';
import { NgxIridiumCallbackComponent } from '@iridiumidentity/ngx-iridium-client';



Expand Down
1 change: 0 additions & 1 deletion projects/iridium-ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NgxIridiumClientService } from 'ngx-iridium-client';


@Component({
Expand Down
2 changes: 1 addition & 1 deletion projects/iridium-ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ import { TenantOverviewComponent } from './components/dashboard/content/tenant-o
import { MatMenuModule } from '@angular/material/menu';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { NgxIridiumClientModule } from 'ngx-iridium-client';
import { NoopInterceptor } from './http-interceptors/http-interceptor';
import {
AddExternalProviderDialog,
LoginBoxOverviewComponent, UpdateExternalProviderDialog
} from './components/dashboard/content/login-box-overview/login-box-overview.component';
import { NgxIridiumClientModule } from '@iridiumidentity/ngx-iridium-client';

@NgModule({
declarations: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<div class="main-container">
<h3>Login Box Settings</h3>
<div class="add-logo-url-container">
<form>
<mat-form-field class="icon-url-field">
<form [formGroup]="updateTenantLogoFormGroup">
<mat-form-field class="icon-url-field" >
<mat-label>Logo URL</mat-label>
<input matInput type="url" placeholder="https://your-logo-url.com">
<input matInput type="url" formControlName="tenantLogoUrl" placeholder="https://your-logo-url.com">
</mat-form-field>
<div class="add-logo-button-container">
<button mat-raised-button (click)="updateLogo()" [disabled]="!updateTenantLogoFormGroup.valid" class="add-logo-button">Update Logo Url</button>
</div>
</form>
<div class="add-logo-button-container">
<button mat-raised-button (click)="updateLogo()" class="add-logo-button">Update Logo Url</button>
</div>

</div>

<div class="create-button-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ApplicationOverviewComponent,
UpdateApplicationDialog
} from '../application-overview/application-overview.component';
import { LoginDescriptorService } from '../../../../services/login-descriptor.service';

@Component({
selector: 'update-external-provider-dialog',
Expand Down Expand Up @@ -73,8 +74,12 @@ export class LoginBoxOverviewComponent implements DynamicContentViewItem, OnInit
dataSource: ExternalProviderResponse[] = [];
externalProviderTemplateSummaries: ExternalProviderTemplateSummaryResponse[] = [];
externalTemplateMapType: ExternalProviderTemplateSummaryMapType = {};
updateTenantLogoFormGroup: UntypedFormGroup;

constructor(private externalProviderTemplateService: ExternalProviderTemplateService, private dialog: MatDialog, private externalProviderService: ExternalIdentityProviderService) {
constructor(private externalProviderTemplateService: ExternalProviderTemplateService, private _formBuilder: UntypedFormBuilder, private loginDescriptorService: LoginDescriptorService, private dialog: MatDialog, private externalProviderService: ExternalIdentityProviderService) {
this.updateTenantLogoFormGroup = this._formBuilder.group({
tenantLogoUrl: ['', Validators.required],
})
}

onRowClick(index: number) {
Expand Down Expand Up @@ -116,6 +121,19 @@ export class LoginBoxOverviewComponent implements DynamicContentViewItem, OnInit
}

updateLogo() {
this.loginDescriptorService.updateTenantLogo(this.updateTenantLogoFormGroup, this.data.tenantId)
.subscribe((result) => {
console.log('update log response ', result)
})
}

describeDescriptor() {
this.loginDescriptorService.get(this.data.tenantId)
.subscribe(response => {
this.updateTenantLogoFormGroup.patchValue({
tenantLogoUrl: response.tenantLogoUrl
})
})

}

Expand All @@ -139,6 +157,7 @@ export class LoginBoxOverviewComponent implements DynamicContentViewItem, OnInit
}

ngOnInit(): void {

this.externalProviderTemplateService.getSummaries()
.subscribe(externalTemplates => {
this.externalProviderTemplateSummaries = externalTemplates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { DynamicContentViewService } from './content/dynamic-content-view.servic
import { DynamicContentView } from './content/dynamic-content-view';
import {MatDialog, MatDialogRef} from '@angular/material/dialog';
import { TenantSelectItem } from './domain/tenant-select-item';
import { NgxIridiumClientService } from '../../../../../ngx-iridium-client/src/lib/ngx-iridium-client.service';
import { TenantService } from '../../services/tenant.service';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatSelectChange } from '@angular/material/select';
import { MenuItemNode } from './domain/menu-item-node';
import { MenuItemService } from '../../services/menu-item.service';
import { Router } from '@angular/router';
import { NgxIridiumClientService } from '@iridiumidentity/ngx-iridium-client';



Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ConfirmationDialogComponent } from './../confirmation-dialog/confirmation-dialog.component';
import { RegisterService } from './../../services/register.service';
import { Component, OnInit } from '@angular/core';
import { UntypedFormBuilder } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { NgxIridiumClientService } from '../../../../../ngx-iridium-client/src/lib/ngx-iridium-client.service';
import { NgxIridiumClientService } from '@iridiumidentity/ngx-iridium-client';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
Expand Down
7 changes: 4 additions & 3 deletions projects/iridium-ui/src/app/guard/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { inject } from '@angular/core';
import { Router } from '@angular/router';
import { NgxIridiumClientService } from 'ngx-iridium-client';
import { tap } from 'rxjs';
import { NgxIridiumClientService } from '@iridiumidentity/ngx-iridium-client';

export const authGuard = async () => {
const router = inject(Router);
const authService = inject(NgxIridiumClientService);
console.log('in auth guard')
// @ts-ignore
authService.isAuthenticated().subscribe({
next: (value) => {
next: (value: any) => {
console.log('next', value)
return true;
},
error: (error) => {
error: (error: any) => {
console.error('error', error)
router.navigateByUrl('/')
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { CookieService } from './cookie.service';
import { AbstractBaseService } from '../../../../ngx-iridium-client/src/lib/service/abstract-base-service';
import { TenantCreateResponse } from './domain/tenant-create-response';
import { environment } from '../../environments/environment';
import { ApplicationTypeSummary } from '../components/dashboard/domain/application-type-summary';

@Injectable({
providedIn: 'root'
})
export class ApplicationTypeService extends AbstractBaseService {
export class ApplicationTypeService {

constructor(private http: HttpClient, private cookieService: CookieService) {
super();
}

get() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export class LoginDescriptorResponse {
displayName: string = '';

usernamePlaceholder: string = '';

usernameLabel: string = '';

usernameType: string = '';

usernameErrorHint: string = '';

pageTitle: string = '';

tenantLogoUrl: string = '';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class TenantLogoUpdateRequest {

logoUrl: string = ''

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { LoginDescriptorService } from './login-descriptor.service';

describe('LoginDescriptorService', () => {
let service: LoginDescriptorService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(LoginDescriptorService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
41 changes: 41 additions & 0 deletions projects/iridium-ui/src/app/services/login-descriptor.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Injectable } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { TenantCreateResponse } from './domain/tenant-create-response';
import { environment } from '../../environments/environment';
import { TenantLogoUpdateRequest } from './domain/tenant-logo-update-request';
import { CookieService } from './cookie.service';
import { ApplicationResponse } from './domain/application-response';
import { LoginDescriptorResponse } from './domain/login-descriptor-response';

@Injectable({
providedIn: 'root'
})
export class LoginDescriptorService {

constructor(private http: HttpClient, private cookieService: CookieService) { }

updateTenantLogo(formGroup: FormGroup, tenantId: string) {
console.log('update ' + tenantId + 'with ' + formGroup.controls['tenantLogoUrl'].value)
const request = new TenantLogoUpdateRequest();
request.logoUrl = formGroup.controls['tenantLogoUrl'].value;
const token = this.cookieService.getCookie('iridium-token')
const headers = new HttpHeaders({
Accept: 'application/vnd.iridium.id.tenant-logo-update-response.1+json',
'Content-Type': 'application/vnd.iridium.id.tenant-logo-update-request.1+json',
'Authorization': 'Bearer ' + token
})
const options = { headers: headers }
return this.http.put<TenantCreateResponse>(environment.iridium.domain + `tenants/${tenantId}/login-descriptors`, request, options).pipe()
}

get(tenantId: string) {
const token = this.cookieService.getCookie('iridium-token')
const headers = new HttpHeaders({
'Accept': 'application/vnd.iridium.id.login-descriptor-response.1+json',
'Authorization': 'Bearer ' + token
})
const options = { headers: headers }
return this.http.get<LoginDescriptorResponse>(environment.iridium.domain + `tenants/${tenantId}/login-descriptors`, options)
}
}
5 changes: 1 addition & 4 deletions projects/iridium-ui/src/app/services/tenant.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpRequest, HttpResponse } from '@angular/common/http';
import { NgxIridiumClientService } from '../../../../ngx-iridium-client/src/lib/ngx-iridium-client.service';
import { CookieService } from './cookie.service';
import { TenantSummaryResponse } from './domain/tenant-summary-response';
import { environment } from '../../environments/environment';
import { AbstractBaseService } from '../../../../ngx-iridium-client/src/lib/service/abstract-base-service';
import { catchError, Observable } from 'rxjs';
import { FormGroup } from '@angular/forms';
import { TenantCreateRequest } from './domain/tenant-create-request';
Expand All @@ -13,10 +11,9 @@ import { TenantCreateResponse } from './domain/tenant-create-response';
@Injectable({
providedIn: 'root'
})
export class TenantService extends AbstractBaseService {
export class TenantService {

constructor(private http: HttpClient, private cookieService: CookieService) {
super();
}

public getTenantSummaries(): Observable<TenantSummaryResponse[]> {
Expand Down
1 change: 0 additions & 1 deletion projects/ngx-iridium-client/.npmrc

This file was deleted.

3 changes: 0 additions & 3 deletions projects/ngx-iridium-client/README.md

This file was deleted.

Loading

0 comments on commit 5c5fa0a

Please sign in to comment.