Feature: OIDC support

This commit is contained in:
Moritz Pflanzer
2023-12-30 11:48:47 +01:00
parent 45e2b7f814
commit 2e597a7176
17 changed files with 609 additions and 2 deletions

View File

@@ -51,4 +51,20 @@ describe('ProfileService', () => {
)
expect(req.request.method).toEqual('POST')
})
it('supports disconnecting a social account', () => {
service.disconnectSocialAccount(1).subscribe()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}profile/disconnect_social_account/`
)
expect(req.request.method).toEqual('POST')
})
it('calls get social account provider endpoint', () => {
service.getSocialAccountProviders().subscribe()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}profile/social_account_providers/`
)
expect(req.request.method).toEqual('GET')
})
})

View File

@@ -1,7 +1,10 @@
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { Observable } from 'rxjs'
import { PaperlessUserProfile } from '../data/user-profile'
import {
PaperlessUserProfile,
SocialAccountProvider,
} from '../data/user-profile'
import { environment } from 'src/environments/environment'
@Injectable({
@@ -31,4 +34,17 @@ export class ProfileService {
{}
)
}
disconnectSocialAccount(id: number): Observable<number> {
return this.http.post<number>(
`${environment.apiBaseUrl}${this.endpoint}/disconnect_social_account/`,
{ id: id }
)
}
getSocialAccountProviders(): Observable<SocialAccountProvider[]> {
return this.http.get<SocialAccountProvider[]>(
`${environment.apiBaseUrl}${this.endpoint}/social_account_providers/`
)
}
}