-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c2d513
commit 5e4c13f
Showing
7 changed files
with
120 additions
and
9 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 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
16 changes: 16 additions & 0 deletions
16
projects/iridium-ui/src/app/services/client-secret.service.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { ClientSecretService } from './client-secret.service'; | ||
|
||
describe('ClientSecretService', () => { | ||
let service: ClientSecretService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(ClientSecretService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
projects/iridium-ui/src/app/services/client-secret.service.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,35 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { ApplicationUpdateRequest } from '../components/dashboard/domain/application-update-request'; | ||
import { ApplicationUpdateResponse } from '../components/dashboard/domain/application-update-response'; | ||
import { environment } from '../../environments/environment'; | ||
import { CookieService } from './cookie.service'; | ||
import { CreateApplicationSecretResponse } from './domain/create-application-secret-response'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class ClientSecretService { | ||
constructor( | ||
private http: HttpClient, | ||
private cookieService: CookieService | ||
) {} | ||
|
||
create(tenantId: string, applicationId: string) { | ||
console.log('create client secret'); | ||
const token = this.cookieService.getCookie('iridium-token'); | ||
const headers = new HttpHeaders({ | ||
Accept: | ||
'application/vnd.iridium.id.authz.client-secret-create-response.1+json', | ||
Authorization: 'Bearer ' + token, | ||
}); | ||
const options = { headers: headers }; | ||
|
||
return this.http.post<CreateApplicationSecretResponse>( | ||
environment.iridium.domain + | ||
`tenants/${tenantId}/applications/${applicationId}/client-secrets`, | ||
null, | ||
options | ||
); | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
projects/iridium-ui/src/app/services/domain/create-application-secret-response.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,7 @@ | ||
export interface CreateApplicationSecretResponse { | ||
id: string; | ||
|
||
secretKey: string; | ||
|
||
created: string; | ||
} |